protected function __construct($titleKey = '', $pageDepth = 0) { $this->SetSecurityHeaders(); $this->path = str_repeat('../', $pageDepth); $this->server = ServiceLocator::GetServer(); $resources = Resources::GetInstance(); ExceptionHandler::SetExceptionHandler(new WebExceptionHandler(array($this, 'RedirectToError'))); $this->smarty = new SmartyPage($resources, $this->path); $userSession = ServiceLocator::GetServer()->GetUserSession(); $this->smarty->assign('Charset', $resources->Charset); $this->smarty->assign('CurrentLanguage', $resources->CurrentLanguage); $this->smarty->assign('HtmlLang', $resources->HtmlLang); $this->smarty->assign('HtmlTextDirection', $resources->TextDirection); $appTitle = Configuration::Instance()->GetKey(ConfigKeys::APP_TITLE); $pageTile = $resources->GetString($titleKey); $this->smarty->assign('Title', (empty($appTitle) ? 'Booked' : $appTitle) . (empty($pageTile) ? '' : ' - ' . $pageTile)); $this->smarty->assign('CalendarJSFile', $resources->CalendarLanguageFile); $this->smarty->assign('LoggedIn', $userSession->IsLoggedIn()); $this->smarty->assign('Version', Configuration::VERSION); $this->smarty->assign('Path', $this->path); $this->smarty->assign('ScriptUrl', Configuration::Instance()->GetScriptUrl()); $this->smarty->assign('UserName', !is_null($userSession) ? $userSession->FirstName : ''); $this->smarty->assign('DisplayWelcome', $this->DisplayWelcome()); $this->smarty->assign('UserId', $userSession->UserId); $this->smarty->assign('CanViewAdmin', $userSession->IsAdmin); $this->smarty->assign('CanViewGroupAdmin', $userSession->IsGroupAdmin); $this->smarty->assign('CanViewResourceAdmin', $userSession->IsResourceAdmin); $this->smarty->assign('CanViewScheduleAdmin', $userSession->IsScheduleAdmin); $this->smarty->assign('CanViewResponsibilities', !$userSession->IsAdmin && ($userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin)); $allowAllUsersToReports = Configuration::Instance()->GetSectionKey(ConfigSection::REPORTS, ConfigKeys::REPORTS_ALLOW_ALL, new BooleanConverter()); $this->smarty->assign('CanViewReports', $allowAllUsersToReports || $userSession->IsAdmin || $userSession->IsGroupAdmin || $userSession->IsResourceAdmin || $userSession->IsScheduleAdmin); $timeout = Configuration::Instance()->GetKey(ConfigKeys::INACTIVITY_TIMEOUT); if (!empty($timeout)) { $this->smarty->assign('SessionTimeoutSeconds', max($timeout, 1) * 60); } $this->smarty->assign('ShouldLogout', $this->GetShouldAutoLogout()); $this->smarty->assign('CssExtensionFile', Configuration::Instance()->GetKey(ConfigKeys::CSS_EXTENSION_FILE)); $this->smarty->assign('UseLocalJquery', Configuration::Instance()->GetKey(ConfigKeys::USE_LOCAL_JQUERY, new BooleanConverter())); $this->smarty->assign('EnableConfigurationPage', Configuration::Instance()->GetSectionKey(ConfigSection::PAGES, ConfigKeys::PAGES_ENABLE_CONFIGURATION, new BooleanConverter())); $this->smarty->assign('ShowParticipation', !Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION, ConfigKeys::RESERVATION_PREVENT_PARTICIPATION, new BooleanConverter())); $this->smarty->assign('LogoUrl', 'booked.png'); if (file_exists($this->path . 'img/custom-logo.png')) { $this->smarty->assign('LogoUrl', 'custom-logo.png'); } if (file_exists($this->path . 'img/custom-logo.gif')) { $this->smarty->assign('LogoUrl', 'custom-logo.gif'); } if (file_exists($this->path . 'img/custom-logo.jpg')) { $this->smarty->assign('LogoUrl', 'custom-logo.jpg'); } $this->smarty->assign('CssUrl', 'null-style.css'); if (file_exists($this->path . 'css/custom-style.css')) { $this->smarty->assign('CssUrl', 'custom-style.css'); } $logoUrl = Configuration::Instance()->GetKey(ConfigKeys::HOME_URL); if (empty($logoUrl)) { $logoUrl = $this->path . Pages::UrlFromId($userSession->HomepageId); } $this->smarty->assign('HomeUrl', $logoUrl); }