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


PHP Zend_Controller_Front类代码示例

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


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

示例1: init

 public function init()
 {
     $this->setAttrib('id', 'ynevent_review_create')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('id' => $this->_event->getIdentity(), 'tab' => $this->_tab), 'event_profile', true))->setAttrib('onsubmit', 'return checkReviewBody();')->setAttrib('class', '');
     // Review content body
     $this->addElement('Textarea', 'body', array('label' => 'Write Review', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'style' => "width:100%"));
     $this->addElement('Button', 'submit', array('label' => 'Submit', 'ignore' => true, 'type' => 'submit', 'decorators' => array('ViewHelper'), 'style' => 'margin-top:6px'));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:7,代码来源:Create.php

示例2: _checkAuthorization

 /**
  * Check authorization
  */
 protected function _checkAuthorization()
 {
     $routeName = Zend_Controller_Front::getInstance()->getRouter()->hasRoute('admin') ? 'admin' : 'default';
     $lang = $this->_request->getParam('lang');
     if (!Zend_Auth::getInstance()->hasIdentity()) {
         //if ajax request
         if ($this->getRequest()->isXmlHttpRequest()) {
             /*return $this->getHelper('json')->direct(array(
                   'success'   => false,
                   'message'   => $this->view->translate("Please login first")
               ));*/
             throw new Zend_Controller_Action_Exception("Please login first", 403);
         }
         //store to return
         $this->returnHere();
         //redirect to login page
         $this->_redirect($this->view->url(array('controller' => 'index', 'action' => 'login', 'module' => 'admin', 'lang' => $lang), $routeName, true));
     }
     $aclLoader = HCMS_Acl_Loader::getInstance();
     //check permission
     if (!$aclLoader->getAcl()->isAllowed($aclLoader->getCurrentRoleCode(), $this->_authResourse, $this->_authPrivilege)) {
         //redirect to login page
         $this->_redirect($this->view->url(array('module' => 'admin', 'controller' => 'index', 'action' => 'login', 'lang' => $lang), $routeName, true));
         throw new Zend_Controller_Action_Exception("You are not allowed to access this page", 403);
     }
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:29,代码来源:Admin.php

示例3: getPanel

 /**
  * Gets content panel for the Debugbar
  *
  * @return string
  */
 public function getPanel()
 {
     $response = Zend_Controller_Front::getInstance()->getResponse();
     $errorCount = count(self::$errors);
     if (!$response->isException() && !$errorCount) {
         return '';
     }
     $html = '';
     foreach ($response->getException() as $e) {
         $html .= '<h4>' . get_class($e) . ': ' . $e->getMessage() . '</h4><p>thrown in ' . $e->getFile() . ' on line ' . $e->getLine() . '</p>';
         $html .= '<h4>Call Stack</h4><ol>';
         foreach ($e->getTrace() as $t) {
             $func = $t['function'] . '()';
             if (isset($t['class'])) {
                 $func = $t['class'] . $t['type'] . $func;
             }
             if (!isset($t['file'])) {
                 $t['file'] = 'unknown';
             }
             if (!isset($t['line'])) {
                 $t['line'] = 'n/a';
             }
             $html .= '<li>' . $func . '<br>in ' . str_replace($_SERVER['DOCUMENT_ROOT'], '', $t['file']) . ' on line ' . $t['line'] . '</li>';
         }
         $html .= '</ol>';
     }
     if ($errorCount) {
         $html .= '<h4>Errors</h4><ol>';
         foreach (self::$errors as $error) {
             $html .= '<li>' . sprintf("%s: %s in %s on line %d", $error['type'], $error['message'], str_replace($_SERVER['DOCUMENT_ROOT'], '', $error['file']), $error['line']) . '</li>';
         }
         $html .= '</ol>';
     }
     return $html;
 }
开发者ID:josmel,项目名称:adminwap,代码行数:40,代码来源:Exception.php

示例4: __construct

 /**
  * Constructor
  *
  * Initialize environment, root path, and configuration.
  *
  * @param  string      $env
  * @param  string|null $root
  * @return void
  */
 public function __construct()
 {
     // Get front controller instance
     $this->_front = Zend_Controller_Front::getInstance();
     // Get request object
     $this->_request = $this->_front->getRequest();
 }
开发者ID:ngukho,项目名称:ducbui-cms,代码行数:16,代码来源:Initializer.php

示例5: __construct

 /**
  * Constructor
  *
  * @param Zend_Controller_Front $front Front Controller object
  * @param array $defaults Defaults for map variables with keys as variable names
  * @param array $responders Modules or controllers to receive RESTful routes
  */
 public function __construct(Zend_Controller_Front $front, array $defaults = array(), array $responders = array())
 {
     $this->_defaults = $defaults;
     if ($responders) {
         $this->_parseResponders($responders);
     }
     if (isset($front)) {
         $this->_request = $front->getRequest();
         $this->_dispatcher = $front->getDispatcher();
     }
 }
开发者ID:robeendey,项目名称:ce,代码行数:18,代码来源:Route.php

示例6: routeShutdown

 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     Zend_Layout::getMvcInstance()->setLayout($request->getModuleName());
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/modules/" . $request->getModuleName() . "/layouts/scripts");
     $eh = Zend_Controller_Front::getInstance()->getPlugin("Zend_Controller_Plugin_ErrorHandler");
     $eh->setErrorHandlerModule($request->getModuleName());
 }
开发者ID:nnevala,项目名称:zf-boilerplate,代码行数:7,代码来源:ModuleLayout.php

示例7: loggedInAs

    public function loggedInAs()
    {
        $auth = Zend_Auth::getInstance();
        if ($auth->hasIdentity()) {
            $user = $auth->getIdentity();
            if (!isset($user->username)) {
                $auth->clearIdentity();
                $info = 'logout';
                return $info;
            }
            $logoutUrl = $this->view->url(array('controller' => 'auth', 'action' => 'logout'), null, true);
            $url = $this->view->url(array('controller' => 'user', 'action' => 'edit', 'id' => $user->id));
            $info = '<div class ="menuButton"><span class="menu">' . $user->username . '</span>';
            $info .= '<ul> 
					<li><a href="' . $url . '">Mon profil</a></li>
					<li class="separator">​</li>
					<li><a href="' . $logoutUrl . '" class="logout">se déconnecter</a></li>
					</ul></div>';
            return $info;
        }
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $controller = $request->getControllerName();
        $action = $request->getActionName();
        if ($controller == 'auth' && $action == 'index') {
            return '';
        }
        $form = new Application_Form_Login();
        $loginUrl = $this->view->url(array('controller' => 'auth', 'action' => 'index'), null, true);
        $info = '<div class ="menuButton"><span class="menu"> Se connecter </span><ul><li class="form">' . $form->setAction($loginUrl) . '</li></ul></div>';
        return $info;
        //$loginUrl = $this->view->url(array('controller'=>'auth', 'action'=>'index'));
        //return '<a href="'.$loginUrl.'">Login</a>';
    }
开发者ID:r1zib,项目名称:salesforce,代码行数:33,代码来源:LoggedInAs.php

示例8: printAction

 public function printAction()
 {
     // desabilitando layout
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     if ($this->getRequest()->isPost()) {
         $arrDigitais = $this->getRequest()->getParam('nuEtiquetas', array());
         $arrDigitaisPrint = array();
         $arrDigitaisValidate = array();
         $withNUP = false;
         foreach ($arrDigitais as $key => $value) {
             $aux1 = explode(' - ', $value);
             $arrDigitaisValidate[$key] = trim($aux1[0]);
             if (count($aux1) > 1) {
                 if ($withNUP === false) {
                     $withNUP = true;
                 }
                 $arrDigitaisPrint[$key] = array('nuEtiqueta' => $arrDigitaisValidate[$key], 'nuNupSiorg' => preg_replace('/\\D+/', '', $aux1[1]));
             } else {
                 $arrDigitaisPrint[$key]['nuEtiqueta'] = $arrDigitaisValidate[$key];
             }
         }
         if ($this->getService()->isValidNuEtiqueta($arrDigitaisValidate)) {
             $etiquetaPdf = new Sgdoce_EtiquetaPdf();
             $textoEtiquetaKey = 'textoEtiqueta';
             if ($withNUP) {
                 $textoEtiquetaKey = 'textoEtiquetaComNup';
             }
             $textoEtiqueta = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption($textoEtiquetaKey);
             $etiquetaPdf->setTextoEtiqueta($textoEtiqueta)->setDigitais($arrDigitaisPrint)->setEtiquetaComNUP($withNUP)->generate();
         }
     }
     echo "Número da digital inválida.";
 }
开发者ID:sgdoc,项目名称:sgdoce-codigo,代码行数:34,代码来源:RestaurarEtiquetaController.php

示例9: _getDbAdapter

 /**
  * Return current db adapter.
  */
 protected function _getDbAdapter()
 {
     $front = Zend_Controller_Front::getInstance();
     $bootstrap = $front->getParam("bootstrap");
     $dbResource = $bootstrap->getPluginResource("db");
     return $dbResource->getDbAdapter();
 }
开发者ID:Yaoming9,项目名称:Projet-Web-PhP,代码行数:10,代码来源:IndexController.php

示例10: __construct

 public function __construct($message = 'Server Error', $code = 400, $extra = null)
 {
     switch ($code) {
         case 401:
             if (null == $message) {
                 $message = 'Not Authorised';
             }
             break;
         case 403:
             if (null == $message) {
                 $message = 'Forbidden';
             }
             break;
         case 404:
             if (null == $message) {
                 $message = 'Not Found';
             }
             break;
         case 405:
             if (null == $message) {
                 $message = 'Method Not Allowed';
             }
             Zend_Controller_Front::getInstance()->getResponse()->setHeader('Allow', $extra['allowed_methods']);
             break;
     }
     parent::__construct($message, $code);
 }
开发者ID:rdallasgray,项目名称:bbx,代码行数:27,代码来源:Exception.php

示例11: init

 public function init()
 {
     $this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
     $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
     $displayname = new Zend_Form_Element_Text('displayname');
     $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $username = new Zend_Form_Element_Text('username');
     $username->setLabel('Username')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
     $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc();
     $levelMultiOptions = array(0 => ' ');
     foreach ($levels as $key => $value) {
         $levelMultiOptions[$key] = $value;
     }
     $level_id = new Zend_Form_Element_Select('level_id');
     $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions);
     $enabled = new Zend_Form_Element_Select('enabled');
     $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->setValue('-1');
     $submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
     $submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
     $this->addElement('Hidden', 'order', array('order' => 10001));
     $this->addElement('Hidden', 'order_direction', array('order' => 10002));
     $this->addElement('Hidden', 'user_id', array('order' => 10003));
     $this->addElements(array($displayname, $username, $email, $level_id, $enabled, $submit));
     // Set default action without URL-specified params
     $params = array();
     foreach (array_keys($this->getValues()) as $key) {
         $params[$key] = null;
     }
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:32,代码来源:Filter.php

示例12: init

 public function init()
 {
     $auth = Zend_Auth::getInstance();
     $this->data_user = $auth->getIdentity();
     if (!$auth->hasIdentity()) {
         $this->redirect('/login');
     } else {
         $this->_acl_model = new Application_Model_Acl_Acl();
         if (!$this->_acl_model->isAllowed()) {
             $this->redirect('/error/forbidden');
         }
     }
     $this->view->user = $this->data_user;
     $this->view->model_user = new Application_Model_Usuarios();
     $this->view->model = new Application_Model_Clientes();
     $this->_modelUsers = new Application_Model_Usuarios();
     $config = Zend_Controller_Front::getInstance()->getParam('bootstrap');
     $this->_custom = $config->getOption('custom');
     // Acessando permissões
     $this->_acl = $config->getOption('acl');
     // Pegando array de configurações para a criação do menu
     $this->view->menu = $config->getOption('menu');
     $this->_FlashMessenger = $this->_helper->getHelper('FlashMessenger');
     $this->view->headTitle(strtoupper($this->getRequest()->getControllerName()) . ' | ' . $this->_custom['company_name']);
     $this->view->controllerName = $this->_controllerName = $this->getRequest()->getControllerName();
     $this->view->actionName = $this->_actionName = $this->getRequest()->getActionName();
     $this->view->user = $this->data_user;
     if ($this->data_user->childrens_ids) {
         $this->_ids = $this->data_user->childrens_ids;
         $this->_ids[] = CURRENT_USER_ID;
     } else {
         $this->_ids = array(CURRENT_USER_ID);
     }
     $this->view->date = new Zend_Date();
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:35,代码来源:ClientesController.php

示例13: init

 public function init()
 {
     header('content-type: text/html; charset=utf8');
     defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl());
     // clear all other sessions
     Application_Form_FrmSessionManager::clearSessionSearch();
 }
开发者ID:samlanh,项目名称:currencyms,代码行数:7,代码来源:IndexController.php

示例14: init

 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setMethod('post');
     //$view = Zend_Layout::getMvcInstance()->getView();
     $url = $this->getView()->url(array('controller' => 'archiwum', 'action' => 'search'), 'default', TRUE);
     $this->setAction($url);
     $request = Zend_Controller_Front::getInstance()->getRequest();
     if ($request->isPost()) {
         $search = $request->getPost('search');
     } else {
         $search = "";
     }
     $this->addElement('text', 'search', array('label' => 'fraza', 'required' => true, 'size' => 58, 'value' => $search, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty', true)));
     $this->addElement('multiCheckbox', 'gdzie', array('label' => 'gdzie szukać:', 'multiOptions' => array('art' => 'Artykuły', 'wyw' => 'Wywiady', 'fel' => 'Felietowny', 'oko' => 'Trzecie oko', 'strona' => 'Pozostałe'), 'disableLoadDefaultDecorators' => true, 'separator' => '&nbsp;'));
     if ($request->isPost()) {
         $checked = array();
         foreach ($request->getPost('gdzie') as $value) {
             $checked[] = $value;
         }
     } else {
         $checked = array('art', 'wyw', 'fel', 'oko', 'strona');
     }
     $this->getElement("gdzie")->setValue($checked);
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'szukaj', 'value' => 'szukaj'));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'id' => 'archiwum')), 'Form'));
     $this->setElementDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
     /**/
     $this->getElement("submit")->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'align' => 'left')), array('Label', array('tag' => 'td', 'style' => 'visibility:hidden;')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
 }
开发者ID:hYOUstone,项目名称:tsg,代码行数:30,代码来源:Archiwum.php

示例15: 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


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