本文整理汇总了PHP中Zend_Controller_Action::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Action::__construct方法的具体用法?PHP Zend_Controller_Action::__construct怎么用?PHP Zend_Controller_Action::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Action
的用法示例。
在下文中一共展示了Zend_Controller_Action::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$this->_controller = $this->getRequest()->getControllerName();
if ($this->_controller != "message") {
/* Maikon.Will - Correção de bug - 14/06/2012
*
* O nome do controller vem em minusculo (Ex: treatment)
* Como o windows não é totalmente case sensitivity
* não ocorre erro nenhum, mas rodando em ambientes Unix,
* um ambiente full case sensitivity por padrão, ele não encontrará
* nem o modulo, nem nenhum controler e nenhum respectivo arquivo a este modulo
* pois o nome definido como padrão no produto sempre será Ex: TreatmentForm.php
*
* Antes:
* $form = $this->_controller."Form";
* $model = $this->_controller."Model";
*/
$controller = ucfirst($this->_controller);
$form = $controller . "Form";
$model = $controller . "Model";
/** Ajuste: Deve ser feita validação para quando não existe form e model; */
$this->_form = new $form();
$this->_model = new $model();
}
}
示例2: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$this->_auth = Zend_Auth::getInstance();
$this->_config = Zend_Registry::get('config');
}
示例3: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
date_default_timezone_set(DATE_ZONE);
Logger::configure(LOG_ERROR);
$this->_logger = Logger::getLogger(__CLASS__);
}
示例4: __construct
/**
* Class constructor
*
* The request and response objects should be registered with the
* controller, as should be any additional optional arguments; these will be
* available via {@link getRequest()}, {@link getResponse()}, and
* {@link getInvokeArgs()}, respectively.
*
* When overriding the constructor, please consider this usage as a best
* practice and ensure that each is registered appropriately; the easiest
* way to do so is to simply call parent::__construct($request, $response,
* $invokeArgs).
*
* After the request, response, and invokeArgs are set, the
* {@link $_helper helper broker} is initialized.
*
* Finally, {@link init()} is called as the final action of
* instantiation, and may be safely overridden to perform initialization
* tasks; as a general rule, override {@link init()} instead of the
* constructor to customize an action controller's instantiation.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if (!$request instanceof HCLI_Controller_Request_Cli) {
throw new Exception("CliController may only be accessed from the command line");
}
parent::__construct($request, $response, $invokeArgs);
}
示例5: __construct
/**
* Disables the view for the Zend Framework environment.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$this->_helper->layout()->disableLayout();
$this->getHelper('viewRenderer')->setNoRender();
header("Connection: close");
}
示例6: __construct
/**
* Class constructor
*
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(\Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if ($request->isXmlHttpRequest()) {
$response->setHeader('content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1', true);
}
parent::__construct($request, $response, $invokeArgs);
}
示例7: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array(), $params = null)
{
if (!is_null($params)) {
$this->params = $params;
}
parent::__construct($request, $response, $invokeArgs);
}
示例8: __construct
/**
* Constructor.
*
* @param Zend_Controller_Request_Abstract $request request
* @param Zend_Controller_Response_Abstract $response response
* @param array $invokeArgs parameters
* @throws Zend_Exception
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if ($this->isDebug()) {
$this->_controllerTimer = microtime(true);
}
$this->loadElements();
parent::__construct($request, $response, $invokeArgs);
}
示例9: __construct
/**
* Base controller constructor.
*
* Does the following things:
*
* - Aliases the redirector helper to clean up the syntax
* - Sets the table object automatically if given the class of the model
* to use for CRUD.
* - Sets all the built-in action contexts for the CRUD actions.
*
*
* Instead of overriding this constructor, controller subclasses should
* implement the init() method for initial setup.
*
* @see Zend_Controller_Action::init()
* @param Zend_Controller_Request_Abstract $request Current request object.
* @param Zend_Controller_Response_Abstract $response Response object.
* @param array $invokeArgs Arguments passed to Zend_Controller_Action.
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
if ($this->getParam('result') == 'no') {
unset($_SESSION['RESULTS_URL']);
}
$this->_setActionContexts();
}
示例10: __construct
/**
* Class constructor
*
* The request and response objects should be registered with the
* controller, as should be any additional optional arguments; these will be
* available via {@link getRequest()}, {@link getResponse()}, and
* {@link getInvokeArgs()}, respectively.
*
* When overriding the constructor, please consider this usage as a best
* practice and ensure that each is registered appropriately; the easiest
* way to do so is to simply call parent::__construct($request, $response,
* $invokeArgs).
*
* After the request, response, and invokeArgs are set, the
* {@link $_helper helper broker} is initialized.
*
* Finally, {@link init()} is called as the final action of
* instantiation, and may be safely overridden to perform initialization
* tasks; as a general rule, override {@link init()} instead of the
* constructor to customize an action controller's instantiation.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout()->disableLayout();
} else {
$this->view->headScript()->appendFile('/js/ajaxForm.js');
}
}
示例11: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if ($request === null) {
throw new Am_Exception_InternalError("Class " . get_class($this) . " constructed without \$request and \$response");
}
$invokeArgs['noViewRenderer'] = true;
$this->view = $invokeArgs['di']->view;
parent::__construct($request, $response, $invokeArgs);
}
示例12: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$this->viewSuffix = 'html';
$this->getHelper('ViewRenderer')->setViewSuffix('html');
$bootstrap = $this->getFrontController()->getParam('bootstrap');
$aganConfig = $bootstrap->getOption('agan');
$this->_templatePath = $aganConfig['template']['path'];
$this->_viewScriptPath = $bootstrap->getOption('resources');
$this->_viewScriptPath = $this->_viewScriptPath['view']['basePath'] . '/scripts';
}
示例13: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if (!$request instanceof Sitengine_Controller_Request_Http) {
require_once 'Sitengine/Controller/Exception.php';
throw new Sitengine_Controller_Exception('request must be an instance of Sitengine_Controller_Request_Http');
}
if (!$response instanceof Zend_Controller_Response_Abstract) {
require_once 'Sitengine/Controller/Exception.php';
throw new Sitengine_Controller_Exception('response must be an instance of Zend_Controller_Response_Abstract');
}
parent::__construct($request, $response, $invokeArgs);
}
示例14: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
$view = $this->view;
$view->doctype('XHTML1_STRICT');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
$view->headTitle()->setSeparator(' - ');
$view->addHelperPath(APPLICATION_PATH . '/views/helpers/');
$view->headLink(array('rel' => 'icon', 'href' => 'img/favicon.ico', 'type' => 'image/x-icon'))->headLink(array('rel' => 'apple-touch-icon', 'href' => 'img/apple-touch-icon.png', 'sizes' => '72x72'))->appendStylesheet('css/screen.css', 'screen');
$titles = Zend_Registry::get('Zend_Config')->title;
if ($titles) {
foreach ($titles as $title) {
$view->headTitle($title);
}
}
}
示例15: __construct
/**
* Class constructor
*
* The request and response objects should be registered with the
* controller, as should be any additional optional arguments; these will be
* available via {@link getRequest()}, {@link getResponse()}, and
* {@link getInvokeArgs()}, respectively.
*
* When overriding the constructor, please consider this usage as a best
* practice and ensure that each is registered appropriately; the easiest
* way to do so is to simply call parent::__construct($request, $response,
* $invokeArgs).
*
* After the request, response, and invokeArgs are set, the
* {@link $_helper helper broker} is initialized.
*
* Finally, {@link init()} is called as the final action of
* instantiation, and may be safely overridden to perform initialization
* tasks; as a general rule, override {@link init()} instead of the
* constructor to customize an action controller's instantiation.
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
if (isset($this->ajaxable)) {
// Init AjaxContexts
$ajaxContext = $this->getHelper('AjaxContext');
$ajaxContext->initContext();
}
if (isset($this->contexts)) {
// TODO: TEMPORARY FIX FOR ZF-3690
if (!isset($ajaxContext) || isset($ajaxContext) && $ajaxContext->getCurrentContext() === null) {
// Init ContextSwitch
$this->getHelper('ContextSwitch')->initContext();
}
}
}