/**
  * This method perform a broadcast for a concrete event
  *
  */
 public function broadcastEvent(__Event &$event)
 {
     $event_type = $event->getEventType();
     if (key_exists($event_type, $this->_event_listeners)) {
         foreach ($this->_event_listeners[$event_type] as &$event_listener) {
             $event_listener->receiveEvent($event);
         }
     }
 }
 /**
  * This method is called by the {@link __EventDispatcher} when a new event is raised and the current {@link __EventListener} is suscribed to it.
  *
  * @param __Event $event The raised event reference
  */
 public function receiveEvent(__Event &$event)
 {
     if ($event instanceof __ContextEvent && $event->getContextId() == $this->getContextId()) {
         if ($this->_send_event_to_callback == true) {
             $parameters = array();
             $parameters[] =& $event;
             $this->_callback->execute($parameters);
         } else {
             $this->_callback->execute();
         }
     }
 }
 public function __construct(&$raiser_object, $event_type, $context_id = null)
 {
     parent::__construct($raiser_object, $event_type);
     if ($context_id == null) {
         $context_id = __CurrentContext::getInstance()->getContextId();
     }
     $this->_context_id = $context_id;
 }
 /**
  * This method is called everytime the EVENT_ON_REQUIRED_PERMISSION_ASSIGNMENT event is raised,
  * which means that a __SystemResource instance has acquired permissions and need to check
  * if current user has access to then
  *
  * @param __Event $event The event EVENT_ON_REQUIRED_PERMISSION_ASSIGNMENT, which contains the __SystemReosurce
  */
 public function onRequiredPermissionAssignment(__Event &$event)
 {
     $system_resource = $event->getRaiserObject();
     $this->checkAccess($system_resource);
 }