className = substr(array_pop($class), 0, -10); $this->setControllerView(); } protected function setControllerView() { if (View::exists($this->className)) { $this->controllerView = new View($this->className); } else { $this->controllerView = new View\Template('{@content}'); } } protected function setView($action) { if (View::exists($this->className . '/' . $action)) { $this->view = new View($this->className . '/' . $action); } } public function handleAction($action, $actionParams) { $this->setView($action); $response = parent::handleAction($action, $actionParams); if (is_string($response)) { $this->controllerView->content = $response; } elseif (isset($this->view)) { $this->controllerView->content = $this->view->render(); } $this->response->setContent($this->controllerView->render()); return $this->response; } protected function requireAdmin() { if (!$_SESSION['phpci_user']->getIsAdmin()) { throw new ForbiddenException('You do not have permission to do that.'); } } }