當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Controller_Action::preDispatch方法代碼示例

本文整理匯總了PHP中Zend_Controller_Action::preDispatch方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Action::preDispatch方法的具體用法?PHP Zend_Controller_Action::preDispatch怎麽用?PHP Zend_Controller_Action::preDispatch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Controller_Action的用法示例。


在下文中一共展示了Zend_Controller_Action::preDispatch方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     Centurion_Signal::factory('pre_dispatch')->send($this);
     //TODO: temporary, implement a way in Zend_Navigation_Page_Mvc to active a page in all actions
     $pages = $this->view->navigation()->findBy('uri', $this->_request->getRequestUri(), true);
     if (count($pages) === 0) {
         $tempPages = $this->view->navigation()->findBy('controller', $this->_request->getControllerName(), true);
         $pages = array();
         foreach ($tempPages as $key => $page) {
             if ($page->module == $this->_request->getModuleName()) {
                 $pages[] = $page;
             }
         }
         if (count($pages) === 0) {
             if (Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName() !== 'default') {
                 $pages = $this->view->navigation()->findBy('route', Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), true);
             }
         }
     }
     foreach ($pages as $key => $page) {
         $page->active = true;
         $page->setActive(true);
     }
 }
開發者ID:netconstructor,項目名稱:Centurion,代碼行數:25,代碼來源:Action.php

示例2: preDispatch

 /**
  * Setzt alle Daten des Layouts aus den Einstellungsdateien
  * @throw Zend_Controller_Dispatcher_Exception
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $modulename = $this->getRequest()->getModuleName();
     $this->view->modulename = $modulename;
     $controllername = $this->getRequest()->getControllerName();
     $this->view->controllername = $controllername;
     $actionname = $this->getRequest()->getActionName();
     $recordAccount = null;
     if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') && Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) {
         $sessionNamespace = new Zend_Session_Namespace();
         if (isset($sessionNamespace->sessionhash)) {
             $logicSession = new DragonX_Account_Logic_Session();
             try {
                 $recordAccount = $logicSession->getAccount($sessionNamespace->sessionhash);
                 $this->view->sessionhash = $sessionNamespace->sessionhash;
                 Zend_Registry::set('recordAccount', $recordAccount);
                 $this->view->recordAccount = $recordAccount;
                 $logicEmailaddress = new DragonX_Emailaddress_Logic_Emailaddress();
                 $this->view->recordEmailaddress = $logicEmailaddress->getEmailaddress($recordAccount);
                 $logicDeletion = new DragonX_Account_Logic_Deletion();
                 $recordDeletion = $logicDeletion->getDeletion($recordAccount);
                 if (isset($recordDeletion)) {
                     $this->view->recordDeletion = $recordDeletion;
                 }
             } catch (Exception $exception) {
                 $sessionNamespace->unsetAll();
                 if ($modulename == 'homepage' && $controllername == 'account' && $actionname == 'logout') {
                     $this->_helper->FlashMessenger('<div class="alert alert-success">Abmeldung erfolgreich</div>');
                 } else {
                     $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session ist abgelaufen. Profil muss neu angemeldet werden</div>');
                 }
             }
         }
     }
     $this->view->configApplication = new Dragon_Application_Config('dragon/application/application');
     $modulenamearray = explode('_', $modulename);
     $controllerarea = end($modulenamearray);
     $this->view->controllerarea = $controllerarea;
     switch ($controllerarea) {
         case 'homepage':
             $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/homepage');
             break;
         case 'administration':
             if (!Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Account') || !Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Emailaddress')) {
                 throw new Dragon_Application_Exception_User('incorrect controller', array('controllername' => $controllername));
             }
             if (!isset($recordAccount)) {
                 $this->_helper->FlashMessenger('<div class="alert alert-error">Die Session wurde noch nicht gestartet oder ist abgelaufen. Profil muss angemeldet werden</div>');
                 $this->_redirect('account/showlogin?' . http_build_query(array('redirect' => $modulename . '/' . $controllername . '/' . $actionname)));
             }
             if (Zend_Registry::get('Dragon_Package_Registry')->isAvailable('DragonX', 'Acl')) {
                 $logicAcl = new DragonX_Acl_Logic_Acl();
                 $this->view->resources = $logicAcl->getResources($recordAccount);
             }
             $this->view->configNavigation = new Dragon_Application_Config('dragonx/homepage/navigation/administration');
             break;
     }
 }
開發者ID:dragonprojects,項目名稱:dragonjsonserver,代碼行數:63,代碼來源:Abstract.php

示例3: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         $this->_redirect('auth/login');
     }
 }
開發者ID:abtris,項目名稱:ZF-Examples-My-Quickstart,代碼行數:8,代碼來源:PostController.php

示例4: preDispatch

 public function preDispatch()
 {
     X_Debug::i("Required action: [" . $this->getRequest()->getControllerName() . '/' . $this->getRequest()->getActionName() . ']');
     parent::preDispatch();
     // call plugins trigger
     // TODO check if plugin broker should be called before parent::preDispatch
     X_VlcShares_Plugins::broker()->gen_beforePageBuild($this);
     //$this->_helper->url->url()
 }
開發者ID:google-code-backups,項目名稱:vlc-shares,代碼行數:9,代碼來源:Action.php

示例5: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     $request = $this->getRequest();
     parent::__call($request->getActionName(), array());
     if (!$this->checkActionAccess($request->getControllerName(), $request->getActionName())) {
         throw new Rabotal_Exception_Access('Access denied!', 403);
     }
 }
開發者ID:romikring,項目名稱:rcalex,代碼行數:9,代碼來源:Action.php

示例6: preDispatch

 public function preDispatch()
 {
     $this->view->baseUrl = $this->getRequest()->getBaseUrl();
     $themeDir = Zend_Registry::get("themeDir");
     require_once "{$themeDir}/config.php";
     if ($this->getRequest()->disableLayout) {
         $this->_helper->layout()->disableLayout();
     }
     return parent::preDispatch();
 }
開發者ID:blerby,項目名稱:blerby,代碼行數:10,代碼來源:Action.php

示例7: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     //exit;
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $authStorage = Zend_Auth::getInstance()->getStorage()->read();
         $isAuth = true;
     } else {
         $authStorage = null;
         $isAuth = false;
     }
 }
開發者ID:josmel,項目名稱:adminwap,代碼行數:12,代碼來源:Action.php

示例8: preDispatch

 public function preDispatch()
 {
     $config = Zend_Registry::get('config');
     if (trim($config->ambiente->db->host) != "") {
         $this->_redirect("auth/login/");
     }
     parent::preDispatch();
     $this->view->hideMenu = true;
     if (Zend_Auth::getInstance()->hasIdentity() && $this->getRequest()->getActionName() == "installed") {
         $this->_redirect("index");
     }
 }
開發者ID:rootzig,項目名稱:SNEP,代碼行數:12,代碼來源:InstallerController.php

示例9: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     $request = $this->getRequest();
     $this->view->module = $request->getModuleName();
     $this->view->actionName = $request->getActionName();
     $this->view->controllerName = $request->getControllerName();
     $this->view->params = $params = $request->getParams();
     $this->view->metas($params);
     $this->checkACL();
     $this->setAppLayout();
 }
開發者ID:riteshsahu1981,項目名稱:we,代碼行數:12,代碼來源:Action.php

示例10: preDispatch

 /**
  * Pre-dispatch routines
  * Asignar variables de entorno
  *
  * @return void
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $config = $this->getConfig();
     $this->config = $this->getConfig();
     $this->log = $this->getLog();
     //$this->cache = $this->getCache();
     $this->siteUrl = $this->config->app->siteUrl;
     $this->view->assign('siteUrl', $config->app->siteUrl);
     if (APPLICATION_ENV != 'production') {
         $sep = sprintf('[%s]', strtoupper(substr(APPLICATION_ENV, 0, 3)));
         $this->view->headTitle()->prepend($sep);
     }
 }
開發者ID:josmel,項目名稱:DevelEntretenimientoEntel,代碼行數:20,代碼來源:Action.php

示例11: preDispatch

 public function preDispatch()
 {
     $auth = Zend_Auth::getInstance();
     $this->data_user = $auth->getIdentity();
     if (!$auth->hasIdentity()) {
         $this->redirect('/login');
     } else {
         $acl = new Application_Model_Acl_Acl();
         if (!$acl->isAllowed()) {
             $this->redirect('/error/forbidden');
         }
     }
     $this->view->user = $this->data_user;
     parent::preDispatch();
 }
開發者ID:Dinookys,項目名稱:zend_app,代碼行數:15,代碼來源:UsuariosController.php

示例12: preDispatch

 /**
  * Pre-dispatch routines
  * Asignar variables de entorno
  *
  * @return void
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->view->controller = $this->getRequest()->getControllerName();
     $this->view->action = $this->getRequest()->getActionName();
     $this->view->module = $this->getRequest()->getModuleName();
     //        $config = $this->getConfig();
     //        $this->config = $this->getConfig();
     //Zend_Debug::dump($this->config);exit;
     //$this->log = $this->getLog();
     //$this->cache = $this->getCache();
     //        $this->siteUrl = $this->config['app']['siteUrl'];
     //        $this->view->assign('siteUrl', $config['app']['siteUrl']);
     //        $this->view->assign('translator', $this->_translate);
 }
開發者ID:josmel,項目名稱:adminwap,代碼行數:21,代碼來源:Action.php

示例13: preDispatch

 function preDispatch()
 {
     parent::preDispatch();
     $this->view->sessionId = Zend_Session::getId();
     $this->oConfig = Zend_Registry::get('config');
     $this->oDb = Zend_Registry::get('db');
     $this->oSession = new Zend_Session_Namespace(Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('applicationName'));
     $this->oAcl = Zend_Auth::getInstance();
     if (APPLICATION_ENV == 'development') {
         $this->_activateFirebug();
     }
     $this->view->auth = $this->getUser();
     $this->view->controller = $this->getRequest()->getControllerName();
     $this->view->action = $this->getRequest()->getActionName();
     $this->_aUserInfo = $this->getUser();
     $this->view->userInfo = $this->_aUserInfo;
 }
開發者ID:pansot2,項目名稱:PadCMS-backend,代碼行數:17,代碼來源:Action.php

示例14: preDispatch

 public function preDispatch()
 {
     // этот контроллер недоступен без регистрации
     if (!$this->isAuth()) {
         $this->_redirect('/auth/login');
         return;
     }
     if (!$this->webacula_acl->hasRole('root_role')) {
         throw new Exception($this->view->translate->_('Webacula error. Role mechanism is broken. Check Webacula tables.'));
         return;
     }
     $controller = $this->getRequest()->getControllerName();
     if ($this->identity->role_name) {
         if (!$this->webacula_acl->isAllowed($this->identity->role_name, $controller)) {
             $msg = sprintf($this->view->translate->_('You try to use Webacula menu "%s".'), $controller);
             $this->_forward('webacula-access-denied', 'error', null, array('msg' => $msg));
             // action, controller
             return;
         }
     }
     parent::preDispatch();
 }
開發者ID:neverstoplwy,項目名稱:contrib-webacula,代碼行數:22,代碼來源:ControllerAclAction.php

示例15: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     $navigation = Site_Service_Menu::getInstance()->getNavigation();
     $controller = $this->getRequest()->getControllerName();
     $module = $this->getRequest()->getModuleName();
     $url = $this->getRequest()->getPathInfo();
     $page = $navigation->findOneByUri($url);
     $this->view->currentPage = $page;
     if ($page) {
         $page->setActive(true);
     }
     if ($page && !empty($page->resource)) {
         $resource = $page->resource;
     } else {
         $resource = Site_Acl::RESOURCE_PUBLIC;
     }
     // Проверяем, авторизован ли пользователь
     $role = Site_Service_Auth::getInstance()->getUser()->getRole();
     $acl = Site_Acl::getInstance();
     // К этим 2 контроллерам доступ есть всегда
     if ($controller != 'error' && $controller != 'auth' && $module == 'default') {
         $allowed = $acl->isAllowed($role, $resource);
         if (!$allowed) {
             $url = $this->getRequest()->getRequestUri();
             if (Site_Service_Auth::getInstance()->isLoggedIn()) {
                 $this->forward('deny', 'error');
             } else {
                 $this->redirect('auth/login?from=' . urlencode($url) . '&warn=1');
             }
             return;
         }
     }
     // Меню
     $this->view->navigation($navigation);
     $this->view->navigation()->setAcl($acl)->setRole($role);
     // login
     $this->view->loggedUser = Site_Service_Auth::getInstance()->getUser();
 }
開發者ID:Konstnantin,項目名稱:zf-app,代碼行數:39,代碼來源:Action.php


注:本文中的Zend_Controller_Action::preDispatch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。