diff --git a/application/Bootstrap.php b/application/Bootstrap.php index bf9591e56..19a2cc72c 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -1,7 +1,7 @@ setFetchMode(DB_FETCHMODE_ASSOC); //Zend_Session::start(); Zend_Validate::setDefaultNamespaces("Zend"); +$front = Zend_Controller_Front::getInstance(); +$front->registerPlugin(new RabbitMqPlugin()); + class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initDoctype() @@ -48,9 +51,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap protected function _initHeadLink() { $view = $this->getResource('view'); - $view->headLink()->appendStylesheet('/css/redmond/jquery-ui-1.8.8.custom.css'); - $this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css'); $this->view->headLink()->appendStylesheet('/css/styles.css'); } @@ -70,14 +71,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->headScript()->appendFile('/js/airtime/common/common.js','text/javascript'); } - protected function _initViewHelpers(){ + protected function _initViewHelpers() + { $view = $this->getResource('view'); $view->addHelperPath('../application/views/helpers', 'Airtime_View_Helper'); } - protected function _initTitle(){ + protected function _initTitle() + { $view = $this->getResource('view'); $view->headTitle(Application_Model_Preference::GetHeadTitle()); } + } diff --git a/application/controllers/plugins/RabbitMqPlugin.php b/application/controllers/plugins/RabbitMqPlugin.php new file mode 100644 index 000000000..3316f01b2 --- /dev/null +++ b/application/controllers/plugins/RabbitMqPlugin.php @@ -0,0 +1,9 @@ +channel(); - $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true); + if (RabbitMq::$doPush) { + $conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"], + $CC_CONFIG["rabbitmq"]["port"], + $CC_CONFIG["rabbitmq"]["user"], + $CC_CONFIG["rabbitmq"]["password"]); + $channel = $conn->channel(); + $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true); - $EXCHANGE = 'airtime-schedule'; - $channel->exchange_declare($EXCHANGE, 'direct', false, true); + $EXCHANGE = 'airtime-schedule'; + $channel->exchange_declare($EXCHANGE, 'direct', false, true); - $data = json_encode(Schedule::ExportRangeAsJson()); - $msg = new AMQPMessage($data, array('content_type' => 'text/plain')); + $data = json_encode(Schedule::ExportRangeAsJson()); + $msg = new AMQPMessage($data, array('content_type' => 'text/plain')); - $channel->basic_publish($msg, $EXCHANGE); - $channel->close(); - $conn->close(); + $channel->basic_publish($msg, $EXCHANGE); + $channel->close(); + $conn->close(); + } } }