/** * Returns an array with relative link and corresponding label as key-value * * @param CmsController $cmsController * * @return array The navigation entries for this module */ public static function getNavigationEntries(CmsController $cmsController) { $localePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR; $translator = $cmsController->getTranslator($localePath); $translator->bindTextDomain('backend', 'UTF-8'); return array(array('target' => '/http-errors', 'label' => $translator->_d('backend', 'HTTP errors'), 'scopes' => BackendNavigationInterface::DISPLAY_IN_ADMIN_BAR | BackendNavigationInterface::DISPLAY_IN_MOD_NAV)); }
/** * @param CmsController $cmsController * @param string $moduleName */ public function __construct(CmsController $cmsController, $moduleName) { $this->cmsController = $cmsController; $this->moduleName = $moduleName; $this->moduleSettings = $cmsController->getModuleSettings($moduleName); $this->moduleModel = new ModuleModel($this->cmsController->getDB()); $this->pageModel = new PageModel($this->cmsController->getDB()); $this->controllerRoutes = array(); $this->moduleRoute = $this->pageModel->getRouteByModule($moduleName); }
public function __construct(Core $core, HttpRequest $httpRequest, Route $route) { parent::__construct($core, $httpRequest, $route); $cacheDir = $this->core->getSiteCacheDir() . 'templates' . DIRECTORY_SEPARATOR; $templateBaseDir = $this->core->getSiteRoot() . 'templates' . DIRECTORY_SEPARATOR; $tplCache = new DirectoryTemplateCache($cacheDir, $templateBaseDir); $this->cmsView = new CmsView(new CmsTemplateEngine($tplCache, 'tst'), $templateBaseDir . $this->currentDomain->template . DIRECTORY_SEPARATOR . 'backend' . DIRECTORY_SEPARATOR); $this->checkAccess(); }
/** * Generates an error page for a thrown exception which was not caught anywhere else in the code * * @param \Exception $e The uncaught exception * * @return HttpResponse The HTTP response for sending back to the client (e.x. a nice styled error message) */ public function generateErrorPage(\Exception $e) { $errorCode = 500; if ($e instanceof HttpException) { $errorCode = $e->getCode(); } if ($e instanceof HttpException === false || $e->getCode() === 500) { $this->logger->error('An uncaught error occurred', $e); } $stmntErrorPage = $this->db->prepare("SELECT ID FROM page WHERE role = 'error' AND error_code = ?"); $resErrorPage = $this->db->select($stmntErrorPage, array($errorCode)); $env = $this->currentDomain->environment; if ($this->core->getSettings()->core->environments->{$env}->debug === true || count($resErrorPage) <= 0) { return parent::generateErrorPage($e); } $pageModel = new PageModel($this->db); $this->cmsPage = $pageModel->getPageByID($resErrorPage[0]->ID); return $this->generateCMSPage($pageModel); }