/** * 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(); }
/** * @deprecated */ public static function fromParams(UrlParams $params) { if ($params->has('service') && $params->has('host')) { return new Service(MonitoringBackend::instance(), $params->get('host'), $params->get('service')); } elseif ($params->has('host')) { return new Host(MonitoringBackend::instance(), $params->get('host')); } return null; }
public function getUrlParams() { return UrlParams::fromQueryString($this->toQueryString()); }
/** * Shift a query parameter from this URL if it exists, otherwise $default * * @param string $param Parameter name * @param mixed $default Default value in case $param does not exist * * @return mixed */ public function shift($param, $default = null) { return $this->params->shift($param, $default); }
/** * 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(); }