示例#1
0
 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]);
 }
示例#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);
     }
 }
示例#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;
 }
示例#4
0
文件: event.php 项目: rasuldev/torino
 public function send($sender = null)
 {
     $this->sender = $sender;
     EventManager::getInstance()->send($this);
 }
示例#5
0
 /**
  * Get event manager
  * @return EventManager
  */
 protected static function eventManager()
 {
     return EventManager::getInstance();
 }
示例#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);
 }