public function beforeRender() { $userId = $this->session->read('uid'); $loggedIn = !empty($userId); // ak je prihlaseny iba vtedy ma zmysel kreslit menu a vyber semestra if ($loggedIn) { $menu = new Menu(); $periods = new Periods(); $menuHelper = new MenuHelper(); $selSemester = $this->session->read('semester'); $semesterHtml = $menuHelper->renderSemester($periods->getShortAll(), $selSemester, $this->url); $menuItems = $menu->getForUser($userId); $admin = $this->session->read("admin"); $adminActing = isset($admin); $menuHtml = $menuHelper->render($menuItems, $adminActing); } else { $menuHtml = $semesterHtml = ""; } $this->addToTemplate("SEMESTER", $semesterHtml); $this->addToTemplate("MENU", $menuHtml); $helpHtml = "<a target='_BLANK' href='{$this->helpLink}'>Help</a>"; $this->addToTemplate('HELP', $helpHtml); }