本文整理汇总了PHP中Zend_Controller_Action_HelperBroker::getExistingHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action_HelperBroker::getExistingHelper方法的具体用法?PHP Zend_Controller_Action_HelperBroker::getExistingHelper怎么用?PHP Zend_Controller_Action_HelperBroker::getExistingHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action_HelperBroker
的用法示例。
在下文中一共展示了Zend_Controller_Action_HelperBroker::getExistingHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch()
{
if (@(!$_SESSION['auth_a']['id'])) {
$redirector = Zend_Controller_Action_HelperBroker::getExistingHelper('redirector');
$redirector->gotoUrl("/login");
}
}
示例2: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if($request->getParam('admin')){
$layout = Zend_Layout::getMvcInstance();
$layout->setViewScriptPath(APPLICATION_PATH.'/design/backend/default/default/layout/');
$view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
$view->addScriptPath(APPLICATION_PATH.'/design/backend/default/default/scripts');
// set autoloader
$autoloader = Zend_Loader_Autoloader::getInstance();
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'admin';
$iterator = new DirectoryIterator($path);
$moduleLoaders = array();
foreach($iterator as $folder){
$name = $folder->getFileName();
if($folder->isDir() && !$folder->isDot() && substr($name,0,1) != '.'){
$basePath = $path . DIRECTORY_SEPARATOR . $name;
$moduleLoaders[] = new CG_Application_Module_Autoloader(array(
'namespace' => ucfirst($name),
'basePath' => $basePath ));
}
}
$autoloader->setAutoloaders($moduleLoaders);
}
}
示例3: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = strtolower($request->getModuleName());
$contextSwitch = Zend_Controller_Action_HelperBroker::getStaticHelper('ContextSwitch');
$contexts = array('xml', 'rss', 'json', 'atom', 'kml', 'georss', 'ics', 'rdf', 'xcs');
if (!in_array($contextSwitch->getCurrentContext(), $contexts)) {
$view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
$response = $this->getResponse();
switch ($module) {
case $module == 'default':
$layouttype = 'home';
break;
case $module == 'admin':
$layouttype = 'database';
break;
case $module == 'database':
$layouttype = 'database';
break;
case $module == 'events':
$response->insert('userdata', $view->render('structure/userdata.phtml'));
$response->insert('header', $view->render('structure/header.phtml'));
$response->insert('breadcrumb', $view->render('structure/breadcrumb.phtml'));
$response->insert('sidebar', $view->render('structure/eventsSidebar.phtml'));
$response->insert('navigation', $view->render('structure/navigation.phtml'));
$response->insert('footer', $view->render('structure/footer.phtml'));
$response->insert('messages', $view->render('structure/messages.phtml'));
default:
$layouttype = 'database';
break;
}
} else {
Zend_Controller_Action_HelperBroker::getExistingHelper('Layout')->disableLayout();
}
}
示例4: ACLLink
/**
* Generates acl link
*
* @access public
*
* @param string Project name
*
* @return string HTML link: <a href="test">Test</a>.
*/
public function ACLLink($project)
{
$front = Zend_Controller_Front::getInstance();
$view = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer')->view;
$img = $view->img("lock.png", T_('Rights'));
return '<a href="' . $view->url(array('controller' => 'project', 'action' => 'browser', 'project' => $project), "project", true) . '">' . $img . '</a>';
}
示例5: dispatchLoopShutdown
/**
* dispatchLoopShutdown
*
* @return void
*/
public function dispatchLoopShutdown()
{
$messenger = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
$contextSwitch = Zend_Controller_Action_HelperBroker::getExistingHelper('ContextSwitch');
$contextParam = $contextSwitch->getContextParam();
$front = Zend_Controller_Front::getInstance();
$format = $front->getRequest()->getParam($contextParam);
$view = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer')->view;
$namespaces = array('error', 'warning', 'notice', 'success');
foreach ($namespaces as $namespace) {
$messenger->setNamespace($namespace);
$messages = null;
if ($format != "html" and !is_null($format)) {
if ($messages = $messenger->getCurrentMessages()) {
$messenger->clearCurrentMessages();
} else {
$messages = $messenger->getMessages();
}
} else {
$messages = $messenger->getMessages();
}
if (!is_array($messages)) {
continue;
}
if (count($messages) > 0) {
if (!isset($view->messenger)) {
$view->messenger = array();
}
$view->messenger[$namespace] = $messages;
}
}
}
示例6: postDispatch
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMvcInstance();
// the name "maintenanceMode" is also referred to in the Admin_MaintenanceController,
// so if you change the filename, it needs to be changed there too
$maintenanceModeFileName = 'maintenanceMode';
$register = new Ot_Config_Register();
$identity = Zend_Auth::getInstance()->getIdentity();
$role = empty($identity->role) ? $register->defaultRole->getValue() : $identity->role;
if (isset($identity->masquerading) && $identity->masquerading == true && isset($identity->realAccount) && !is_null($identity->realAccount) && isset($identity->realAccount->role)) {
$role = $identity->realAccount->role;
}
$acl = Zend_Registry::get('acl');
$view = $layout->getView();
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
if (is_file(APPLICATION_PATH . '/../overrides/' . $maintenanceModeFileName) && (!$request->isXmlHttpRequest() && !$viewRenderer->getNeverRender())) {
if (!$acl->isAllowed($role, 'ot_maintenance', 'index')) {
if (!($request->getModuleName() == 'ot' && $request->getControllerName() == 'login' && $request->getActionName() == 'index')) {
$response = $this->getResponse();
$layout->disableLayout();
$response->setBody($view->maintenanceMode()->publicLayout());
}
} else {
$response = $this->getResponse();
// there's no point in setting text here if it's a redirect
if ($response->isRedirect()) {
$response->setBody('');
} else {
$response->setBody($view->maintenanceMode()->header() . $response->getBody());
}
}
}
}
示例7: _assign
protected function _assign($model)
{
if ($this->getRequest()->isHead()) {
Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer')->setNoRender(true);
return;
}
$request = $this->getRequest();
$this->_setEtag($model->etag($this->_context));
$modelName = $model instanceof Bbx_Model ? Inflector::underscore(get_class($model)) : Inflector::tableize($model->getModelName());
if ($request->getParam('list') === 'true') {
$model->renderAsList();
}
if ($this->_context === 'csv') {
$this->_helper->authenticate();
}
if ($request->getParam('download') == 'true') {
$this->_helper->authenticate();
$this->_helper->download($model);
}
if ($this->_context === 'json') {
$options = $this->_context === 'json' ? array('deep' => true) : null;
$this->view->assign($model->toArray($options));
} else {
$this->view->{$modelName} = $model;
}
}
示例8: filter
public function filter($value)
{
if (NULL === self::$view) {
self::$view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')->view;
}
return $this->parse($value);
}
示例9: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$flashMessenger = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer')->view;
$flashMessenger->title = ucfirst($action);
}
示例10: preDispatch
public function preDispatch(\Zend_Controller_Request_Abstract $request)
{
if ($request->getModuleName() == "json") {
header("Content-type: application/json");
$viewRenderer = \Zend_Controller_Action_HelperBroker::getExistingHelper("viewRenderer");
$viewRenderer->setNeverRender();
}
}
示例11: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
$navContainer = null;
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
$viewRenderer->initView();
$view = $viewRenderer->view;
$module = $request->getModuleName();
if ($module == "admin") {
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/navigation.xml', 'nav');
$navContainer = new Zend_Navigation($navContainerConfig);
// Load the xml navigation menu
// check if the database configuration has been set
if (Shineisp_Main::isReady()) {
// Adding the configuration menu items
$configuration = SettingsGroups::getlist();
$submenu = $navContainer->findOneByLabel('Configuration');
foreach ($configuration as $id => $item) {
$pages[] = array('label' => $item, 'uri' => '/admin/settings/index/groupid/' . $id, 'resource' => 'admin:settings');
}
$submenu->addPages($pages);
}
// Attach the Zend ACL to the Navigation menu
$auth = Zend_Auth::getInstance();
if ($auth) {
$acl = $auth->getStorage()->read();
if (is_object($acl)) {
Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole("administrator");
}
}
} elseif ($module == "default") {
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/modules/default/navigation.xml', 'nav');
$navContainer = new Zend_Navigation($navContainerConfig);
// Load the xml navigation menu
// Attach the Zend ACL to the Navigation menu
$auth = Zend_Auth::getInstance();
if ($auth) {
$acl = $auth->getStorage()->read();
if (is_object($acl)) {
Zend_View_Helper_Navigation_HelperAbstract::setDefaultAcl($acl);
Zend_View_Helper_Navigation_HelperAbstract::setDefaultRole("guest");
}
}
}
if ($navContainer) {
foreach ($navContainer->getPages() as $page) {
foreach ($page->getPages() as $subpage) {
foreach ($subpage->getPages() as $subsubpage) {
$uri = $subsubpage->getHref();
if ($uri === $request->getRequestUri()) {
$subsubpage->setActive(true);
}
}
}
}
$view->navigation($navContainer);
}
}
示例12: init
public function init()
{
$this->_helper->contextSwitch()->addActionContext('error', 'json');
$this->_helper->contextSwitch()->addActionContext('login', 'json');
$this->_helper->contextSwitch()->addActionContext('logout', 'json');
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer');
$viewRenderer->setNoRender();
parent::init();
}
示例13: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$request = $this->getRequest();
$moduleName = $request->getModuleName();
$frontController = Zend_Controller_Front::getInstance();
$currentModuleDirectory = $frontController->getModuleDirectory($moduleName);
$layout = Zend_Controller_Action_HelperBroker::getExistingHelper('layout');
$layout->setLayoutPath($currentModuleDirectory . '/views/layouts')->setLayout('layout');
}
示例14: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer');
if (is_null($viewRenderer->view)) {
$viewRenderer->init();
}
// ensure view is created by the view renderer
$this->view = $viewRenderer->view;
}
示例15: _handleError
/**
* @param \Zend_Controller_Request_Abstract $request
* @throws mixed
*/
protected function _handleError(\Zend_Controller_Request_Abstract $request)
{
// remove zend error handler
$front = \Zend_Controller_Front::getInstance();
$front->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler");
$response = $this->getResponse();
if ($response->isException() && !$this->_isInsideErrorHandlerLoop) {
// get errorpage
try {
// enable error handler
$front->setParam('noErrorHandler', false);
$errorPath = Config::getSystemConfig()->documents->error_pages->default;
if (Site::isSiteRequest()) {
$site = Site::getCurrentSite();
$errorPath = $site->getErrorDocument();
}
if (empty($errorPath)) {
$errorPath = "/";
}
$document = Document::getByPath($errorPath);
if (!$document instanceof Document\Page) {
// default is home
$document = Document::getById(1);
}
if ($document instanceof Document\Page) {
$params = Tool::getRoutingDefaults();
if ($module = $document->getModule()) {
$params["module"] = $module;
}
if ($controller = $document->getController()) {
$params["controller"] = $controller;
$params["action"] = "index";
}
if ($action = $document->getAction()) {
$params["action"] = $action;
}
$this->setErrorHandler($params);
$request->setParam("document", $document);
\Zend_Registry::set("pimcore_error_document", $document);
// ensure that a viewRenderer exists, and is enabled
if (!\Zend_Controller_Action_HelperBroker::hasHelper("viewRenderer")) {
$viewRenderer = new \Pimcore\Controller\Action\Helper\ViewRenderer();
\Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
$viewRenderer = \Zend_Controller_Action_HelperBroker::getExistingHelper("viewRenderer");
$viewRenderer->setNoRender(false);
if ($viewRenderer->view === null) {
$viewRenderer->initView(PIMCORE_WEBSITE_PATH . "/views");
}
}
} catch (\Exception $e) {
\Logger::emergency("error page not found");
}
}
// call default ZF error handler
parent::_handleError($request);
}