/**
 * Calls all listeners on the specific eventName
 * @param string $eventName - Name of event
 * @param Event $eventObject - Event object to pass to listeners
 */
 public function callEvent($eventName, Event $eventObject){
     /** @TODO call all listeners and pass the event object to them */
     $listeners = $this->_listeners[$eventName];
     foreach($listener as $listeners){
         call_user_function_array(
             array($listener->method,$listener->function), 
             $eventObject
         );
     }
 }
Пример #2
0
 protected function hasPermission_form($node, $args)
 {
     if (count($args) < 2) {
         I2CE::raiseError("Two few arguments for permision form() method");
         return null;
     }
     $formname = array_shift($args);
     $method = array_shift($args);
     $form = $this->template->getForm($formname, $node);
     if (!$form instanceof I2CE_Form) {
         I2CE::raiseError("Unable to find form {$formname}");
         return null;
     }
     if (!$form->_hasMethod($method)) {
         I2CE::raiseError("Method {$method} is not callable in {$formname}:" . get_class($form));
         return null;
     }
     return call_user_function_array(array($form, $method), $args);
 }
 protected function hasPermsssion_module($node, $args)
 {
     if (count($args) < 2) {
         I2CE::raiseError("Expecting at least two arguments to method() function");
     }
     $module = array_shift($args);
     $method = array_shift($args);
     $factory = I2CE_ModuleFactory::instance();
     $class = $factory->getClass($module);
     if (!$class instanceof I2CE_Module) {
         I2CE::raiseError("Invalid module {$module}");
         return null;
     }
     if (!$class->_hasMethod($method)) {
         I2CE::raiseError("Invalid method {$method} for class {$class}:" . get_class($class));
     }
     return call_user_function_array(array($class, $method), $args);
 }