public function disconnect($keyEvent = NULL, $callable = NULL)
 {
     if ($keyEvent === NULL and $callable == NULL) {
         EventManager::getInstance()->disconnect($this);
         return;
     }
     if ($keyEvent !== NULL and $callable == NULL) {
         EventManager::getInstance()->disconnect($keyEvent, $this);
         return;
     }
     EventManager::getInstance()->disconnect($keyEvent, [$this, $callable]);
 }
Exemple #2
0
 private function __construct()
 {
     try {
         // initialize the event manager and notification classes
         $this->eventManager = EventManager::getInstance();
         $this->notification = ClaroNotification::getInstance();
         $this->notifier = ClaroNotifier::getInstance();
         // initialize logger
         $this->logger = new Logger();
         $this->moduleLabelStack = array();
         if (isset($GLOBALS['tlabelReq'])) {
             $this->pushModuleLabel($GLOBALS['tlabelReq']);
             pushClaroMessage("Set current module to {$GLOBALS['tlabelReq']}", 'debug');
         }
     } catch (Exception $e) {
         die($e);
     }
 }
Exemple #3
0
 static function loadFile($className, $thr = true)
 {
     $folder = explode('\\', $className);
     $path = APP_FOLDER . DS . 'src';
     foreach ($folder as $value) {
         $path .= DS . $value;
     }
     $path .= '.php';
     if (!file_exists($path)) {
         if ($thr) {
             throw new \Exception("the file {$path} does not exist");
         } else {
             return false;
         }
     }
     if (EventManager::getInstance()) {
         EventManager::getInstance()->event('factory.load', null, $path);
     }
     include_once $path;
 }
Exemple #4
0
 public function send($sender = null)
 {
     $this->sender = $sender;
     EventManager::getInstance()->send($this);
 }
 /**
  * Get event manager
  * @return EventManager
  */
 protected static function eventManager()
 {
     return EventManager::getInstance();
 }
Exemple #6
0
 /**
  * unregister event listener
  * @access public
  * @static
  * @param string eventype type of event watching by the listener
  * @param string id listener ID
  * @return boolean
  */
 public static function removeListener($eventType, $id)
 {
     $mngr = EventManager::getInstance();
     return $mngr->unregister($eventType, $id);
 }