コード例 #1
0
 /**
  * Init events
  * 
  * @param \Zend\ModuleManager\ModuleEvent $e
  */
 public function initEvents(ModuleEvent $e)
 {
     $model = $this->serviceLocator->get('Application\\Model\\ModelManager')->getInstance('ActionTracker\\Model\\ActionTrackerBase');
     $actions = $model->getActivatedActions();
     // bind all activated events
     if (count($actions)) {
         $eventManager = ActionTrackerEvent::getEventManager();
         foreach ($actions as $action) {
             $eventManager->attach($action->name, function ($e) use($model, $action) {
                 if ($model->getModuleInfo('ActionTracker')) {
                     $model->logAction($action->action_id, $e->getParam('description'), $e->getParam('description_params'));
                 }
             });
         }
     }
 }