/** * Constructor for the controller * * @param Application $application * @param Console $console * @return ConsoleController */ public function __construct(Application $application, Console $console) { $this->application = $application; $this->services = $application->services(); $this->console = $console; if ($this->services->isAvailable('database')) { $this->config = (new \Phire\Model\Config())->getAll(); } }
/** * Prepare view * * @param string $template * @return void */ protected function prepareView($template) { $this->view = new View($this->viewPath . '/' . $template); $this->view->application_title = $this->application->config()['application_title']; if (isset($this->sess->failed)) { $this->view->failed = true; } if (isset($this->sess->expired)) { $this->view->expired = true; } if (isset($this->sess->saved)) { $this->view->saved = true; } if (isset($this->sess->removed)) { $this->view->removed = true; } if (isset($this->sess->user)) { $this->services['nav.top']->setRole($this->services['acl']->getRole($this->sess->user->role)); $this->services['nav.top']->returnFalse(true); if ($this->services->isAvailable('nav.fluid')) { $this->services['nav.fluid']->setRole($this->services['acl']->getRole($this->sess->user->role)); $this->services['nav.fluid']->returnFalse(true); } if ($this->services->isAvailable('nav.static')) { $this->services['nav.static']->setRole($this->services['acl']->getRole($this->sess->user->role)); $this->services['nav.static']->returnFalse(true); } $this->view->popNav = $this->services['nav.top']; $this->view->acl = $this->services['acl']; $this->view->user = $this->sess->user; $cookie = \Pop\Cookie\Cookie::getInstance(['path' => '/']); $this->view->windowWidth = $cookie['pop_current_width']; } }
/** * Constructor for the controller * * @param Application $application * @param Request $request * @param Response $response * @return AbstractController */ public function __construct(Application $application, Request $request, Response $response) { $this->application = $application; $this->services = $application->services(); $this->request = $request; $this->response = $response; $this->sess = $this->services['session']; $this->viewPath = __DIR__ . '/../../view'; if ($this->services->isAvailable('database')) { $this->config = (new \Phire\Model\Config())->getAll(); } }