/**
  * Attach module notifications
  */
 public function _initAttachModuleEvents()
 {
     $this->_message = Zym_Message_Dispatcher::get();
     $this->_message->attach('Managers_Model_Acl_Managers', 'buildAcl', 'buildAcl');
     $this->_message->attach('Managers_Model_Navigation', 'buildAdminNav', 'buildAdminNav');
     $this->_message->attach('Managers_Model_Version', 'reportVersion', 'reportVersion');
 }
Example #2
0
 public function buildAdminNav()
 {
     if ($this->_nav !== null) {
         return $this->_nav;
     }
     $adminNavResult = Zym_Message_Dispatcher::get()->post('buildAdminNav')->getResult('buildAdminNav');
     $navigation = new Zend_Navigation();
     $missionControlModules = array('missionControl', 'dashboard', 'admin', 'settings', 'system', 'tools');
     $updateService = new FFR_Service_Update();
     if ($updateService->currentSchemaVersion('missionControl') >= 2) {
         $settingService = new Settings_Service_Setting();
         $missionControl = $settingService->fetchSetting('mission_control')->setting_value;
     } else {
         $missionControl = false;
     }
     if ($missionControl == true) {
         foreach ($adminNavResult as $modulePages) {
             if (in_array($modulePages[0]->getModule(), $missionControlModules)) {
                 $navigation->addPages($modulePages);
             }
         }
     } else {
         foreach ($adminNavResult as $modulePages) {
             $navigation->addPages($modulePages);
         }
     }
     $this->_nav = $navigation;
     return $this->_nav;
 }
Example #3
0
 /**
  * Create the parser object
  */
 public function __construct()
 {
     $eventResult = Zym_Message_Dispatcher::get()->post('buildBBCodes')->getResult('buildBBCodes');
     $BBCodes = array();
     foreach ($eventResult as $moduleBBCodes) {
         $BBCodes = array_merge($BBCodes, $moduleBBCodes);
     }
     $this->_parser = new FFR_BBCode_Parser(array('rootOptions' => array(), 'BBCodes' => $BBCodes));
 }
 /**
  * Setup message dispatcher
  *
  * @return void
  */
 protected function _setupMessageDispatcher()
 {
     $demo = new App_Demo_Message();
     $dispatcher = Zym_Message_Dispatcher::get();
     // Register sandy if not already registered
     if (!$dispatcher->isRegistered('sandy')) {
         $dispatcher->attach($demo, 'sandy');
     }
     // Register bill if not already registered
     if (!$dispatcher->isRegistered('bill')) {
         $dispatcher->attach($demo, 'bill', 'hello');
     }
 }
 /**
  * Attach module notifications
  */
 public function _initAttachModuleEvents()
 {
     $this->_message = Zym_Message_Dispatcher::get();
     $this->_message->attach('Tools_Model_Acl_Tools', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_Acl_Cache', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_Acl_Query', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_Acl_Redirection', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_Acl_Sitemap', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_Acl_Minification', 'buildAcl', 'buildAcl');
     $this->_message->attach('Tools_Model_BBCodes', 'buildBBCodes', 'buildBBCodes');
     $this->_message->attach('Tools_Model_Navigation', 'buildAdminNav', 'buildAdminNav');
     $this->_message->attach('Tools_Model_Version', 'reportVersion', 'reportVersion');
 }
Example #6
0
 public function routeStartup(Zend_Controller_Request_Abstract $request)
 {
     $routes = Zym_Message_Dispatcher::get()->post('buildRoutes')->getResult('buildRoutes');
     $front = Zend_Controller_Front::getInstance();
     $router = $front->getRouter();
     if (is_array($routes)) {
         foreach ($routes as $moduleRoutes) {
             foreach ($moduleRoutes as $name => $route) {
                 $router->addRoute($name, $route);
             }
         }
     }
 }
Example #7
0
 public function buildAcl()
 {
     if ($this->_acl !== null) {
         return $this->_acl;
     }
     $aclDefinition = Zym_Message_Dispatcher::get()->post('buildAcl')->getResult('buildAcl');
     $acl = new Zend_Acl();
     foreach ($aclDefinition as $module) {
         if (!$acl->has($module['resource'])) {
             $acl->addResource($module['resource']);
         }
         foreach ($module['rules'] as $key => $rule) {
             if (!$acl->hasRole($key)) {
                 $acl->addRole($key);
             }
             $acl->setRule('OP_ADD', $rule['allPrivileges']['type'], $key, $module['resource']);
         }
     }
     $this->_acl = $acl;
     return $this->_acl;
 }
Example #8
0
<?php
$message = Zym_Message_Dispatcher::get();
$message->attach($theReceivingObject, $testEvent, $customMethod);
Example #9
0
$cache = Zend_Controller_Action_HelperBroker::getStaticHelper('Cache');
$cache->setManager($application->getBootstrap()->getResource('cachemanager'));
switch ($_GET['format']) {
    case 'json':
        $server = new Zend_Json_Server();
        // Indicate the URL endpoint, and the JSON-RPC version used:
        $server->setTarget('/api/jsonrpc/')->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
        $contentTypeHeader = 'Content-Type: text/json';
        break;
    case 'xml':
        $server = new Zend_XmlRpc_Server();
        Zend_XmlRpc_Server_Fault::attachFaultException('FFR_Exception');
        Zend_XmlRpc_Server_Fault::attachFaultException('Zend_Exception');
        $contentTypeHeader = 'Content-Type: text/xml';
        break;
}
$apiList = Zym_Message_Dispatcher::get()->post('buildApi')->getResult('buildApi');
foreach ($apiList as $key => $services) {
    foreach ($services as $service => $class) {
        $server->setClass($class, $service);
    }
}
if ('GET' == $_SERVER['REQUEST_METHOD'] && $_GET['format'] == 'json') {
    // Grab the SMD
    $smd = $server->getServiceMap();
    // Return the SMD to the client
    header($contentTypeHeader);
    echo $smd;
    return;
}
echo $server->handle();
Example #10
0
 /**
  * Tests Zym_Message_Dispatcher::has()
  */
 public function testHas()
 {
     Zym_Message_Dispatcher::get('foo');
     $this->assertTrue(Zym_Message_Dispatcher::has('foo'));
     Zym_Message_Dispatcher::remove('foo');
     $this->assertFalse(Zym_Message_Dispatcher::has('foo'));
 }
Example #11
0
 public function __construct()
 {
     $this->_message = Zym_Message_Dispatcher::get();
     $this->_message->attach($this, 'testEvent');
 }
Example #12
0
 /**
  * Get Message Dispatcher
  *
  * @return Zym_Message_Dispatcher
  */
 public function getMessageDispatcher()
 {
     if (!$this->_messageDispatcher instanceof Zym_Message_Dispatcher) {
         $className = get_class($this);
         $dispatcher = Zym_Message_Dispatcher::get($className);
         $this->_messageDispatcher = $dispatcher;
     }
     return $this->_messageDispatcher;
 }
Example #13
0
 /**
  * Attach module notifications
  */
 public function _initAttachModuleEvents()
 {
     $this->_message = Zym_Message_Dispatcher::get();
     $this->_message->attach('Public_Model_Acl_Public', 'buildAcl', 'buildAcl');
     $this->_message->attach('Public_Model_Version', 'reportVersion', 'reportVersion');
 }