public function init($modelName) { parent::init(); $this->setRoles($modelName); $this->setResources(); $this->setPrivilages(); $this->setAcl(); }
public function preDispatchDisabled() { if (!Zend_Auth::getInstance()->hasIdentity()) { $r = $this->getRequest(); $current = $r->getModuleName() . '.' . $r->getControllerName() . '.' . $r->getActionName(); if (!in_array($current, $this->allowed)) { $r = new Zend_Controller_Action_Helper_Redirector(); $r->gotoRoute(array(), $this->loginRoute, true); } } parent::preDispatch(); }
private function __construct() { parent::init(); $this->view = new Zend_View(); foreach ($this->types as $type) { $this->messages[$type] = array(); if ($type != self::TYPE_DEBUG) { /** @noinspection PhpIncludeInspection */ $this->messagesDict[$type] = (include APPLICATION_PATH . '/configs/messages/' . $type . '.php'); } } $this->readFromSession(); }
public function preDispatch() { $view = $this->getView(); $controller = $this->getActionController(); if (Zend_Auth::getInstance()->hasIdentity()) { $view->isAuth = $controller->isAuth = true; $authData = Zend_Auth::getInstance()->getStorage()->read(); $view->auth = $controller->auth = $authData; } else { $view->isAuth = $controller->isAuth = false; } parent::preDispatch(); }
/** * offsetSet() * * @param int $priority * @param Zend_Controller_Action_Helper_Abstract $helper * @return Zend_Controller_Action_HelperBroker_PriorityStack */ public function offsetSet($priority, $helper) { $priority = (int) $priority; if (!$helper instanceof Zend_Controller_Action_Helper_Abstract) { #require_once 'Zend/Controller/Action/Exception.php'; throw new Zend_Controller_Action_Exception('$helper must extend Zend_Controller_Action_Helper_Abstract.'); } if (array_key_exists($helper->getName(), $this->_helpersByNameRef)) { // remove any object with the same name to retain BC compailitbility // @todo At ZF 2.0 time throw an exception here. $this->offsetUnset($helper->getName()); } if (array_key_exists($priority, $this->_helpersByPriority)) { $priority = $this->getNextFreeHigherPriority($priority); // ensures LIFO trigger_error("A helper with the same priority already exists, reassigning to {$priority}", E_USER_WARNING); } $this->_helpersByPriority[$priority] = $helper; $this->_helpersByNameRef[$helper->getName()] = $helper; if ($priority == ($nextFreeDefault = $this->getNextFreeHigherPriority($this->_nextDefaultPriority))) { $this->_nextDefaultPriority = $nextFreeDefault; } krsort($this->_helpersByPriority); // always make sure priority and LIFO are both enforced return $this; }
public function init() { $this->_registry = new Ot_Config_Register(); $this->_identity = Zend_Auth::getInstance()->getIdentity(); parent::init(); }
/** * Retrieve name that identify this helper class * * @return string */ public function getName() { $name = parent::getName(); return 'Configurator_' . $name; }
/** * setActionController() * * @param Zend_Controller_Action $oActionController * @return Zend_Controller_ActionHelper_Abstract */ public function setActionController(Zend_Controller_Action $oActionController = null) { parent::setActionController($oActionController); $oActionController->view = $this; return $this; }
/** * setHttpResponseCode * * @param $code * @return Kebab_Controller_Helper_Response */ public function setHttpResponseCode($code) { $response = parent::getResponse(); $response->setHttpResponseCode($code); }
/** * addHelper() - Add helper objects * * @param Zend_Controller_Action_Helper_Abstract $helper * @return void */ public static function addHelper(Zend_Controller_Action_Helper_Abstract $helper) { $helper_name = $helper->getName(); self::$_helpers[$helper_name] = $helper; return; }
public function init() { $this->cache = Zend_Registry::get('cache'); parent::init(); }
public function postDispatch() { parent::postDispatch(); if ($this->isStateChanged() && $this->session->current !== null) { $url = $this->session->current->getUrl(); foreach ($this->_preRedirect as $cb) { if ($cb === 1) { $plugin = Zend_Controller_Front::getInstance()->getPlugin('Logger_AppLoggerPlugin'); $plugin->dispatchLoopShutdown(); } else { call_user_func($cb); } } if ($this->redirectAfterStateChange) { $this->getActionController()->getHelper('redirector')->gotoUrlAndExit($url); } } }
/** * setActionController() * * @param Zend_Controller_Action $oActionController * @return Zend_Controller_ActionHelper_Abstract */ public function setActionController(Zend_Controller_Action $oActionController = null) { static $bSmartyInitialized; foreach ($this->_aTranslationsPaths as $sName => $sPath) { $this->_aTranslationsPaths[$sName] = Volcano_Tools::fixPath($sPath); } $aProposedLocales = array(); if ($this->_sRequestParamName && ($sParam = $oActionController->getRequest()->getParam($this->_sRequestParamName))) { $aProposedLocales[] = $sParam; } $sCookieLocale = false; if ($this->_sCookieName && ($sCookieLocale = $oActionController->getRequest()->getCookie($this->_sCookieName))) { $aProposedLocales[] = $sCookieLocale; } $oLocalizer = new Volcano_Localizer($aProposedLocales, $this->_sTranslationAdapterName, $this->_aTranslationsPaths, $this->_bParseRequestHeaders); if ($sCookieLocale != $oLocalizer->getLocale()->getLanguage()) { setcookie($this->_sCookieName, $oLocalizer->getLocale()->getLanguage(), time() + 60 * 60 * 24 * 30, "/"); } parent::setActionController($oActionController); $oActionController->localizer = $oLocalizer; //add localizer to smarty if (Zend_Controller_Action_HelperBroker::hasHelper('Smarty') && !$bSmartyInitialized) { $oSmartyHelper = Zend_Controller_Action_HelperBroker::getExistingHelper('Smarty'); $oSmartyHelper->addCustomFunction('modifier', array($oLocalizer, 'translate'), 'translate'); $oSmartyHelper->locale = array('language' => $oLocalizer->getLocale()->getLanguage(), 'region' => $oLocalizer->getLocale()->getRegion()); $bSmartyInitialized = TRUE; } return $this; }
/** * Adds the given action helper to the broker. * * @param Zend_Controller_Action_Helper_Abstract $helper */ protected function addActionHelper(Zend_Controller_Action_Helper_Abstract $helper) { $this->helpersToRemove[] = $helper->getName(); Zend_Controller_Action_HelperBroker::addHelper($helper); $message = 'Helper "' . $helper->getName() . '" was not added.'; $this->assertTrue(Zend_Controller_Action_HelperBroker::hasHelper($helper->getName()), $message); }
public function init() { $this->_logger = Zend_Registry::get('logger'); parent::init(); }
public function init() { parent::init(); // inject dependencies to action controller $this->container->injectOn($this->getActionController()); }