/** * The constructor starts benchmarking, loads the configuration and sets * other useful controller properties * * @param Request $request * @param Response $response * @param array $invokeArgs Any additional invocation arguments */ public function __construct(Request $request, Response $response, array $invokeArgs = array()) { $this->params = UrlParams::fromQueryString(); $this->setRequest($request)->setResponse($response)->_setInvokeArgs($invokeArgs); $this->_helper = new ActionHelperBroker($this); $this->handlerBrowserWindows(); $moduleName = $this->getModuleName(); $this->view->translationDomain = $moduleName !== 'default' ? $moduleName : 'icinga'; $this->_helper->layout()->isIframe = $request->getUrl()->shift('isIframe'); $this->_helper->layout()->showFullscreen = $request->getUrl()->shift('showFullscreen'); $this->_helper->layout()->moduleName = $moduleName; $this->view->compact = $request->getParam('view') === 'compact'; if ($request->getUrl()->shift('showCompact')) { $this->view->compact = true; } if ($this->rerenderLayout = $request->getUrl()->shift('renderLayout')) { $this->xhrLayout = 'body'; } if ($request->getUrl()->shift('_disableLayout')) { $this->_helper->layout()->disableLayout(); } if ($this->requiresLogin()) { $this->redirectToLogin(Url::fromRequest()); } $this->view->tabs = new Tabs(); $this->prepareInit(); $this->init(); }
public function getUrlParams() { return UrlParams::fromQueryString($this->toQueryString()); }
/** * Overwrite the parameters used in the query part * * @param UrlParams|array $params The new parameters to use for the query part * * @return $this */ public function setParams($params) { if ($params instanceof UrlParams) { $this->params = $params; } elseif (is_array($params)) { $urlParams = UrlParams::fromQueryString(''); foreach ($params as $k => $v) { $urlParams->set($k, $v); } $this->params = $urlParams; } else { throw new ProgrammingError('Url params needs to be either an array or an UrlParams instance'); } return $this; }
/** * The constructor starts benchmarking, loads the configuration and sets * other useful controller properties * * @param Zend_Controller_Request_Abstract $request * @param Zend_Controller_Response_Abstract $response * @param array $invokeArgs Any additional invocation arguments */ public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array()) { /** @var \Icinga\Web\Request $request */ /** @var \Icinga\Web\Response $response */ $this->params = UrlParams::fromQueryString(); $this->setRequest($request)->setResponse($response)->_setInvokeArgs($invokeArgs); $this->_helper = new Zend_Controller_Action_HelperBroker($this); $this->handlerBrowserWindows(); $moduleName = $this->getModuleName(); $this->view->translationDomain = $moduleName !== 'default' ? $moduleName : 'icinga'; $this->_helper->layout()->isIframe = $request->getUrl()->shift('isIframe'); $this->_helper->layout()->showFullscreen = $request->getUrl()->shift('showFullscreen'); $this->_helper->layout()->moduleName = $moduleName; $this->view->compact = $request->getParam('view') === 'compact'; if ($request->getUrl()->shift('showCompact')) { $this->view->compact = true; } if ($this->rerenderLayout = $request->getUrl()->shift('renderLayout')) { $this->xhrLayout = $this->innerLayout; } if ($request->getUrl()->shift('_disableLayout')) { $this->_helper->layout()->disableLayout(); } // $auth->authenticate($request, $response, $this->requiresLogin()); if ($this->requiresLogin()) { if (!$request->isXmlHttpRequest() && $request->isApiRequest()) { Auth::getInstance()->challengeHttp(); } $this->redirectToLogin(Url::fromRequest()); } $this->view->tabs = new Tabs(); $this->prepareInit(); $this->init(); }