コード例 #1
0
 /**
  * Register the default events for this controller
  *
  * @return void
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     $events->attach('dispatch', array($this, 'initJsController'), -10);
     $events->attach('dispatch', array($this->getJsLoader(), 'onMvcDispatch'), -90);
 }
コード例 #2
0
 /**
  * Se encarga de colgar las funciones predispatch y post dispatch para ser ejecutados
  * antes y despues del controlador principal y poder realizar tareas comunes de 
  * inicializacion y post procesamiento  
  * @see \Zend\Mvc\Controller\AbstractController::attachDefaultListeners()
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 100);
     $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'postDispatch'), -100);
 }
コード例 #3
0
 public function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     /* This must run before onDispatch, because we could alter the action param */
     $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'checkPostRequest'), 10);
     return $this;
 }
コード例 #4
0
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     /**
      * @todo Think of how we can automatically redirect to allow page if user hasn't installed
      */
     $this->events->attach('dispatch', array($this, 'preDispatch'), 100);
 }
コード例 #5
0
ファイル: IndexController.php プロジェクト: webpants/YAWIK
 /**
  * attaches further Listeners for generating / processing the output
  *
  * @return $this
  */
 public function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $serviceLocator = $this->getServiceLocator();
     $defaultServices = $serviceLocator->get('DefaultListeners');
     $events = $this->getEventManager();
     $events->attach($defaultServices);
     return $this;
 }
コード例 #6
0
ファイル: AbstractBase.php プロジェクト: ajones3066/vufind
 /**
  * Register the default events for this controller
  *
  * @return void
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     // Attach preDispatch event if we need to check permissions.
     if ($this->accessPermission) {
         $events = $this->getEventManager();
         $events->attach(MvcEvent::EVENT_DISPATCH, [$this, 'preDispatch'], 1000);
     }
 }
コード例 #7
0
ファイル: FileController.php プロジェクト: utrenkner/YAWIK
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     $events->attach(MvcEvent::EVENT_DISPATCH, array($this, 'preDispatch'), 10);
     $serviceLocator = $this->getServiceLocator();
     $defaultServices = $serviceLocator->get('DefaultListeners');
     $events->attach($defaultServices);
 }
コード例 #8
0
 /**
  * Register the default events for this controller
  *
  * @internal
  *      Registers two hooks on "onDispatch":
  *      - change action to form and set mode parameter
  *      - inject sidebar navigation
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     /*
      * "Redirect" action 'new' and 'edit' to 'form' and set the 
      * route parameter 'mode' to the original action.
      * This must run before onDispatch, because we alter the action param 
      */
     $events->attach(MvcEvent::EVENT_DISPATCH, function ($event) {
         $routeMatch = $event->getRouteMatch();
         $action = $routeMatch->getParam('action');
         if ('new' == $action || 'edit' == $action) {
             $routeMatch->setParam('mode', $action);
             $routeMatch->setParam('action', 'form');
         }
     }, 10);
     /*
      * Inject a sidebar view model in the Layout-Model, if 
      * the result in the event is not terminal.
      * This must run after "InjectViewModelListener", which runs with
      * a priority of -100.
      */
     $events->attach(MvcEvent::EVENT_DISPATCH, function ($event) {
         $model = $event->getResult();
         if (!$model instanceof ViewModel || $model->terminate()) {
             return;
         }
         $routeMatch = $event->getRouteMatch();
         $action = $routeMatch->getParam('action');
         if ('form' == $action) {
             $action = $routeMatch->getParam('mode');
         }
         $layout = $event->getViewModel();
         $sidebar = new ViewModel();
         $sidebar->setVariable('action', $action);
         $sidebar->setTemplate('auth/sidebar/groups-menu');
         $layout->addChild($sidebar, 'sidebar_auth_groups-menu');
     }, -110);
     $serviceLocator = $this->getServiceLocator();
     $defaultServices = $serviceLocator->get('DefaultListeners');
     $events->attach($defaultServices);
 }
コード例 #9
0
ファイル: IndexController.php プロジェクト: dsi-agpt/minibus
 /**
  * Attache les évènements
  *
  * @see \Zend\Mvc\Controller\AbstractController::attachDefaultListeners()
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $events = $this->getEventManager();
     $events->attach('dispatch', array($this, 'preDispatch'), 100);
 }
コード例 #10
0
 /**
  * @return void
  */
 protected function attachDefaultListeners()
 {
     parent::attachDefaultListeners();
     $this->events->attach('dispatch', array($this, 'preDispatch'), 100);
     $this->events->attach('dispatch', array($this, 'postDispatch'), -100);
 }