当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Action_HelperBroker类代码示例

本文整理汇总了PHP中Zend_Controller_Action_HelperBroker的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action_HelperBroker类的具体用法?PHP Zend_Controller_Action_HelperBroker怎么用?PHP Zend_Controller_Action_HelperBroker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Controller_Action_HelperBroker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getForm

 public function getForm()
 {
     $form = new Zend_Form();
     $form->setMethod('post');
     $form->setDecorators(array(array('ViewScript', array('viewScript' => 'reports/report5Form.phtml'))));
     $items = $this->getPeriodItems('REQ_MOZ_CONTMOVEMENT_YEAR_SPEC');
     $e = new Zend_Form_Element_Select('period', array('label' => 'Рік', 'multiOptions' => $items, 'required' => true, 'style' => 'width: 80px'));
     $form->addElement($e);
     $items = $this->getGuideItems('T_REPORTPLANKIND');
     $e = new Zend_Form_Element_Select('reportplankind', array('label' => 'Звіт/план', 'multiOptions' => $items, 'required' => true, 'style' => 'width: 200px'));
     $form->addElement($e);
     $items = $this->getGuideItems('T_EDUFORM', false);
     $e = new Zend_Form_Element_Select('eduform', array('label' => 'Форма навчання', 'multiOptions' => $items, 'style' => 'width: 200px'));
     $form->addElement($e);
     $items = $this->getGuideItems('T_EDUBASIS', false);
     $e = new Zend_Form_Element_Select('edubase', array('label' => 'Форма фінансування', 'multiOptions' => $items, 'style' => 'width: 200px'));
     $form->addElement($e);
     $items = $this->getGuideItems('T_COUNTRYTYPE', true);
     $e = new Zend_Form_Element_Select('countrytype', array('label' => 'Тип громадянства', 'multiOptions' => $items, 'style' => 'width: 200px'));
     $form->addElement($e);
     if (@(!$this->params['establishment'])) {
         $e = new Zend_Form_Element_Checkbox('indpapers', array('label' => 'Індивідуальні аркуші'));
         $form->addElement($e);
     }
     $refreshAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'page', 'action' => 'show'));
     $e = new Zend_Form_Element_Submit('refresh', array('label' => 'Обновити', 'onclick' => "document.forms[0].action='{$refreshAct}'"));
     $form->addElement($e);
     $excelAct = Zend_Controller_Action_HelperBroker::getStaticHelper('url')->url(array('controller' => 'reports', 'action' => 'excel', 'report' => 5));
     $e = new Zend_Form_Element_Submit('excel', array('label' => 'Excel', 'onclick' => "document.forms[0].action='{$excelAct}'"));
     $form->addElement($e);
     $form->setElementDecorators(array('ViewHelper', 'Errors'));
     return $form;
 }
开发者ID:TDMU,项目名称:contingent5_statserver,代码行数:33,代码来源:Report5.php

示例2: init

 /**
  * Initialize controller
  *
  * @return void
  */
 function init()
 {
     $this->db = Zend_Registry::get('db');
     $this->logger = Zend_Registry::get('logger');
     $this->config = Zend_Registry::get('config');
     $this->viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
 }
开发者ID:ngroesz,项目名称:Photoplate,代码行数:12,代码来源:TemplateController.php

示例3: _initView

 protected function _initView()
 {
     // Start initail view
     $this->bootstrap('layout');
     $config = $this->getOption('views');
     $resources = $this->getOption('resources');
     $view = new Zend_View();
     if (isset($resources['layout']['layoutPath'])) {
         $view->assign('layoutRootPath', $resources['layout']['layoutPath']);
     }
     $this->bootstrap('db');
     Zend_Loader::loadClass('Ht_Utils_SystemSetting');
     $sysSetting = Ht_Utils_SystemSetting::getSettings();
     $view->assign('sysSetting', $sysSetting);
     $view->assign('profile', Zend_Auth::getInstance()->getIdentity());
     Zend_Loader::loadClass("Ht_Model_SystemSetting");
     $this->setSystemLogConfiguration($sysSetting);
     // use the viewrenderer to keep the code DRY
     // instantiate and add the helper in one go
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     $viewRenderer->setViewSuffix('phtml');
     // add it to the action helper broker
     Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
     /**
      * Set inflector for Zend_Layout
      */
     $inflector = new Zend_Filter_Inflector(':script.:suffix');
     $inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml'));
     // Initialise Zend_Layout's MVC helpers
     $this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector);
     return $this->getResource('layout')->getView();
 }
开发者ID:kangza,项目名称:hagtag,代码行数:33,代码来源:Bootstrap.php

示例4: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $loginController = 'authentication';
     $loginAction = 'login';
     $auth = Zend_Auth::getInstance();
     // If user is not logged in and is not requesting login page
     // - redirect to login page.
     if (!$auth->hasIdentity() && $request->getControllerName() != $loginController && $request->getActionName() != $loginAction) {
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
         $redirector->gotoSimpleAndExit($loginAction, $loginController);
     }
     // User is logged in or on login page.
     if ($auth->hasIdentity()) {
         // Is logged in
         // Let's check the credential
         $acl = new Tynex_Models_TynexAcl();
         $identity = $auth->getIdentity();
         // role is a column in the user table (database)
         $isAllowed = $acl->isAllowed($identity->role, $request->getControllerName(), $request->getActionName());
         if (!$isAllowed) {
             $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector');
             $redirector->gotoUrlAndExit('/');
         }
     }
 }
开发者ID:razorcell,项目名称:GBADMIN,代码行数:25,代码来源:AccessCheck.php

示例5: init

 public function init()
 {
     $bootstrap = $this->getBootstrap();
     $bootstrap->bootstrap('FrontController');
     $bootstrap->bootstrap('View');
     $bootstrap->bootstrap('Layout');
     $front = $bootstrap->getResource('FronController');
     Zend_Controller_Action_HelperBroker::addPrefix('Bc_Controller_Action_Helper');
     $bootstrap->bootstrap('Doctrine');
     $manager = Zend_Registry::get('db_manager');
     $options = $this->getOptions();
     if (!isset($options[self::OPTION_PLUGINS_PATH])) {
         throw new Exception('Bad Config! pluginsPath shoud be setted');
     }
     $pluginManager = Bc_Application_Plugin_Manager::getInstance();
     $pluginManager->setPluginsPath($options[self::OPTION_PLUGINS_PATH]);
     $pluginManager->initializePlugins();
     if (!isset($options[self::OPTION_THEMES_PATH])) {
         throw new Exception('Bad Config! themesPath shoud be setted');
     }
     $themesManager = Bc_Application_Theme_Manager::getInstance();
     $themesManager->setThemesPath($options[self::OPTION_THEMES_PATH]);
     $themesManager->setView($bootstrap->getResource('View'));
     $themesManager->setActiveThemeName('minimal');
     $themesManager->setLayout($bootstrap->getResource('Layout'));
     $themesManager->initializeTheme();
 }
开发者ID:BGCX262,项目名称:zsoc-svn-to-git,代码行数:27,代码来源:Plugin.php

示例6: doRequest

 public function doRequest($request)
 {
     // redirector should not exit
     $redirector = \Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $redirector->setExit(false);
     // json helper should not exit
     $json = \Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $zendRequest = new \Zend_Controller_Request_HttpTestCase();
     $zendRequest->setMethod($request->getMethod());
     $zendRequest->setCookies($request->getCookies());
     $zendRequest->setParams($request->getParameters());
     // Sf2's BrowserKit does not distinguish between GET, POST, PUT etc.,
     // so we set all parameters in ZF's request here to not break apps
     // relying on $request->getPost()
     $zendRequest->setPost($request->getParameters());
     $zendRequest->setRawBody($request->getContent());
     $zendRequest->setRequestUri(str_replace('http://localhost', '', $request->getUri()));
     $zendRequest->setHeaders($this->extractHeaders($request));
     $_FILES = $this->remapFiles($request->getFiles());
     $_SERVER = array_merge($_SERVER, $request->getServer());
     $zendResponse = new \Zend_Controller_Response_HttpTestCase();
     $this->front->setRequest($zendRequest)->setResponse($zendResponse);
     ob_start();
     try {
         $this->bootstrap->run();
     } catch (\Exception $e) {
         ob_end_clean();
         throw $e;
     }
     ob_end_clean();
     $this->zendRequest = $zendRequest;
     $response = new Response($zendResponse->getBody(), $zendResponse->getHttpResponseCode(), $this->formatResponseHeaders($zendResponse));
     return $response;
 }
开发者ID:kansey,项目名称:yii2albom,代码行数:35,代码来源:ZF1.php

示例7: authenticate

 public function authenticate($type, $role, $module, $controller, $action)
 {
     // escape error handler
     $front = Zend_Controller_Front::getInstance();
     $params = array($type, $role, $module, $controller, $action);
     $count = count($params);
     $plugins = new Base_Php_Overloader($front->getParam("bootstrap")->getOption('plugins'));
     $errorModule = $plugins->errorHandler->params->module;
     $errorController = $plugins->errorHandler->params->controller;
     $errorAction = $plugins->errorHandler->params->action;
     $redirecting = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     /*
      * the conditions are for to be passed or redirected, default is passed
      * array(typeCondition, roleCondition, moduleCondition, controllerCondition, actionCondition, redirectOrNot, url)
      * order by typeCondition ASC, roleCondition ASC, moduleCondition ASC, controllerCondition ASC, actionCondition ASC
      */
     $permission = array(array(null, null, $errorModule, $errorController, $errorAction, FALSE, null), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', 'index', 'login', false, null), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', 'index', 'logout', true, '/admin/index/login'), array(Auth_Constant_Server::GUEST_TYPE, null, 'admin', null, null, true, '/admin/index/login'), array(Auth_Constant_Server::ADMIN_TYPE, null, 'admin', 'index', 'login', true, '/admin'), array(null, null, 'home', null, null, false, null));
     foreach ($permission as $permission) {
         for ($i = 0; $i <= 4; $i++) {
             if (isset($permission[$i]) && $params[$i] != $permission[$i]) {
                 continue 2;
             }
         }
         if ($permission[5] == true) {
             $redirecting->gotoUrl($permission[6])->redirectAndExit();
         }
         // if a rule is matched, not check remain rules
         return;
     }
 }
开发者ID:HuyTran0424,项目名称:noeavrsev345452dfgdfgsg,代码行数:30,代码来源:Acl.php

示例8: init

 public function init()
 {
     $registry = Zend_Registry::getInstance();
     $config = $registry->get("config");
     $sysCache = $registry->get("sysCache");
     $cacheFiles = new Ml_Cache_Files($sysCache);
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers');
     $frontController = $this->getBootstrap()->getResource('FrontController');
     $dispatcher = $frontController->getDispatcher();
     $request = $frontController->getRequest();
     $router = $frontController->getRouter();
     $router->removeDefaultRoutes();
     $compat = new Zend_Controller_Router_Route_Module(array(), $dispatcher, $request);
     $router->addRoute(HOST_MODULE, $compat);
     $routerConfig = $cacheFiles->getConfigIni(APPLICATION_PATH . '/configs/' . HOST_MODULE . 'Routes.ini');
     $router->addConfig($routerConfig, "apiroutes");
     Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers/helpers');
     $loadOauthStore = Zend_Controller_Action_HelperBroker::getStaticHelper("LoadOauthstore");
     $loadOauthStore->setinstance();
     $loadOauthStore->preloadServer();
     $frontController->setBaseUrl($config['apiroot'])->setParam('noViewRenderer', true)->addModuleDirectory(APPLICATION_PATH . '/modules')->addControllerDirectory(APPLICATION_PATH . '/modules/' . HOST_MODULE . '/controllers');
     $response = new Zend_Controller_Response_Http();
     if (filter_input(INPUT_GET, "responseformat", FILTER_UNSAFE_RAW) == 'json') {
         $contentType = 'application/json';
     } else {
         $contentType = 'text/xml';
     }
     $response->setHeader('Content-Type', $contentType . '; charset=utf-8', true);
     $frontController->setResponse($response);
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:30,代码来源:Api.php

示例9: restContext

 public function restContext()
 {
     if (!$this->getAutoSerialization()) {
         return;
     }
     $view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
     if ($view instanceof Zend_View_Interface) {
         if (method_exists($view, 'getVars')) {
             $vars = $view->getVars();
             if (isset($vars['apiresults'])) {
                 $data = $vars['apiresults'];
                 if (count($data) !== 0) {
                     $serializer = new $this->_availableAdapters[$this->_currentContext]();
                     $body = $serializer->serialize($data);
                     if ($this->_currentContext == 'xml') {
                         $stylesheet = $this->getRequest()->getHeader('X-XSL-Stylesheet');
                         if ($stylesheet !== false and !empty($stylesheet)) {
                             $body = str_replace('<?xml version="1.0"?>', sprintf('<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="%s"?>', $stylesheet), $body);
                         }
                     }
                     if ($this->_currentContext == 'json') {
                         $callback = $this->getRequest()->getParam('jsonp-callback', false);
                         if ($callback !== false and !empty($callback)) {
                             $body = sprintf('%s(%s)', $callback, $body);
                         }
                     }
                     if ($this->_currentContext == 'html') {
                         $body = self::prettyPrint($body, array('format' => 'html'));
                     }
                     $this->getResponse()->setBody($body);
                 }
             }
         }
     }
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:35,代码来源:ContextSwitch.php

示例10: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     $this->_request = Zend_Controller_Front::getInstance()->getRequest();
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     if ($viewRenderer->view && method_exists($viewRenderer->view, 'getVars')) {
         $viewVars = $this->_cleanData($viewRenderer->view->getVars());
     } else {
         $viewVars = "No 'getVars()' method in view class";
     }
     $vars = '<div style="width:50%;float:left;">';
     $vars .= '<h4>View variables</h4>' . '<div id="ZFDebug_vars" style="margin-left:-22px">' . $viewVars . '</div>' . '<h4>Request parameters</h4>' . '<div id="ZFDebug_requests" style="margin-left:-22px">' . $this->_cleanData($this->_request->getParams()) . '</div>';
     $vars .= '</div><div style="width:45%;float:left;">';
     if ($this->_request->isPost()) {
         $vars .= '<h4>Post variables</h4>' . '<div id="ZFDebug_post" style="margin-left:-22px">' . $this->_cleanData($this->_request->getPost()) . '</div>';
     }
     $vars .= '<h4>Constants</h4>';
     $constants = get_defined_constants(true);
     ksort($constants['user']);
     $vars .= '<div id="ZFDebug_constants" style="margin-left:-22px">' . $this->_cleanData($constants['user']) . '</div>';
     $registry = Zend_Registry::getInstance();
     $vars .= '<h4>Zend Registry</h4>';
     $registry->ksort();
     $vars .= '<div id="ZFDebug_registry" style="margin-left:-22px">' . $this->_cleanData($registry) . '</div>';
     $cookies = $this->_request->getCookie();
     $vars .= '<h4>Cookies</h4>' . '<div id="ZFDebug_cookie" style="margin-left:-22px">' . $this->_cleanData($cookies) . '</div>';
     $vars .= '</div><div style="clear:both">&nbsp;</div>';
     return $vars;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:33,代码来源:Variables.php

示例11: _initView

 public function _initView()
 {
     $view = new Twig_Adapter_Zend();
     $view->setScriptPath(APPLICATION_PATH . '/views/scripts/');
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
 }
开发者ID:abtris,项目名称:twigZend,代码行数:7,代码来源:Bootstrap.php

示例12: _out

 /**
  * Na podstawie wybranego helpera wyjścia, przetwarza dane do ostatecznego formatu i wysyła je.
  * @todo metoda do przerobienia - mało elastyczne rozwiązanie.
  * @param Common_Db_Adapter_ListResult $oResult - wyniki/dane do wysłania
  * @param string $helper - helper wyjścia Zend_Controller_Action_Helper_Abstract
  * @param string $sLayout - sciezka do pliku phtml
  */
 public function _out(Common_Db_Adapter_ListResult $oResult)
 {
     Zend_Controller_Action_HelperBroker::addPrefix('Common_Controller_Action_Helper');
     if ($this->_sHelper == null) {
         $this->_sHelper = Common_Response_Grid::OUT_TYPE_JSON;
     }
     if (($sParam = $this->_oRequest->getParam(Common_Response_Grid::REQUEST_OUT_PARAM, null)) && $sParam != null) {
         switch ($sParam) {
             case Common_Response_Grid::OUT_TYPE_JSON:
                 $oHelper = $this->_oController->getHelper($sParam);
                 $oHelper->direct($oResult);
                 break;
             case Common_Response_Grid::OUT_TYPE_CSV:
                 $oHelper = $this->_oController->getHelper($sParam);
                 $oHelper->direct($oResult);
                 break;
             case Common_Response_Grid::OUT_TYPE_HTML:
                 $oHelper = $this->_oController->getHelper($sParam);
                 $oHelper->direct($oResult, $this->_sLayout);
                 break;
             case Common_Response_Grid::OUT_TYPE_PDF:
                 $oHelper = $this->_oController->getHelper($sParam);
                 $oHelper->direct($oResult, $this->_sLayout);
                 break;
             default:
                 throw new Exception('Brak wyjscie -> ' . $sParam);
                 break;
         }
     } else {
         $oHelper = $this->_oController->getHelper($this->_sHelper);
         $oHelper->direct($oResult);
     }
 }
开发者ID:Webowiec,项目名称:zendnote,代码行数:40,代码来源:Grid.php

示例13: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $flash = Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');
     $mvc = Zend_Layout::getMvcInstance();
     $view = $mvc->getView();
     $view->flashMessages = $flash->getMessages();
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:7,代码来源:Messenger.php

示例14: testMissingViewScriptDoesDoubleRender

 public function testMissingViewScriptDoesDoubleRender()
 {
     Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-91, new Zend_Controller_Action_Helper_ViewRenderer());
     // go to the test controller for this funcitonal test
     $this->dispatch('/zend-layout-functional-test-test/missing-view-script');
     $this->assertEquals(trim($this->response->getBody()), "[DEFAULT_LAYOUT_START]\n[DEFAULT_LAYOUT_START]\n[DEFAULT_LAYOUT_END]\n(ErrorController::errorAction output)[DEFAULT_LAYOUT_END]");
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:7,代码来源:FunctionalTest.php

示例15: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     $params = $request->getParams();
     $auth = Zend_Auth::getInstance();
     Zend_Registry::set('Zend_Auth', $auth);
     if ($auth->hasIdentity()) {
         $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
         $identity = $auth->getIdentity();
         $userDb = new Users_Model_DbTable_User();
         $user = array('id' => $identity->id, 'username' => $identity->username, 'name' => $identity->name, 'email' => $identity->email, 'clientid' => $identity->clientid);
         $authNamespace = new Zend_Session_Namespace('Zend_Auth');
         $authNamespace->user = $user['username'];
         if ($_SESSION['__ZF']['Zend_Auth']['ENT'] - time() < 3600) {
             $authNamespace->setExpirationSeconds(3600);
         }
         Zend_Registry::set('User', $user);
         $view->user = $user;
         $clientDb = new Application_Model_DbTable_Client();
         $client = $clientDb->getClient($user['clientid']);
         Zend_Registry::set('Client', $client);
     } elseif ($params['module'] != 'users' && $params['action'] != 'login') {
         $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
         if (isset($params['id']) && $params['id']) {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action'] . '|' . $params['id']));
         } else {
             $redirector->gotoSimple('login', 'user', 'users', array('url' => $params['module'] . '|' . $params['controller'] . '|' . $params['action']));
         }
     }
 }
开发者ID:dewawi,项目名称:dewawi,代码行数:29,代码来源:Auth.php


注:本文中的Zend_Controller_Action_HelperBroker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。