/** * @param string $menu * * @return int */ protected function selectMenuItem($menu) { if ($this->request->getArea() !== Core\Controller\AreaEnum::AREA_ADMIN) { $in = [$this->request->getQuery(), $this->request->getUriWithoutPages(), $this->request->getFullPath(), $this->request->getModuleAndController(), $this->request->getModule()]; return $this->menuItemRepository->getLeftIdByUris($menu, $in); } return 0; }
/** * Returns the SEO robots setting for the current page * * @return string */ public function getPageRobotsSetting() { $robots = $this->getRobotsSetting($this->request->getUriWithoutPages()); if (empty($robots)) { $robots = $this->getRobotsSetting($this->request->getFullPath()); } if (empty($robots)) { $robots = $this->getRobotsSetting($this->request->getModule()); } return strtolower(!empty($robots) ? $robots : $this->getRobotsSetting()); }
/** * Generates the table of contents * * @param array $pages * @param string $baseUrlPath * @param boolean $titlesFromDb * @param boolean $customUris * * @return string */ public function generateTOC(array $pages, $baseUrlPath = '', $titlesFromDb = false, $customUris = false) { if (!empty($pages)) { $baseUrlPath = $baseUrlPath === '' ? $this->request->getUriWithoutPages() : $baseUrlPath; $toc = []; $i = 0; foreach ($pages as $page) { $pageNumber = $i + 1; $toc[$i]['title'] = $this->fetchTocPageTitle($page, $pageNumber, $titlesFromDb); $toc[$i]['uri'] = $this->fetchTocPageUri($customUris, $page, $pageNumber, $baseUrlPath); $toc[$i]['selected'] = $this->isCurrentPage($customUris, $page, $pageNumber, $i); if ($toc[$i]['selected'] === true) { $this->title->setPageTitlePostfix($toc[$i]['title']); } ++$i; } $this->view->assign('toc', $toc); return $this->view->fetchTemplate('System/Partials/toc.tpl'); } return ''; }
/** * @return array */ public function render() { if ($this->totalResults > $this->resultsPerPage) { $areaPrefix = $this->request->getArea() === AreaEnum::AREA_ADMIN ? 'acp/' : ''; $link = $this->router->route($areaPrefix . $this->request->getUriWithoutPages()); $this->currentPage = (int) $this->request->getParameters()->get('page', 1); $this->totalPages = (int) ceil($this->totalResults / $this->resultsPerPage); $this->setMetaStatements(); $range = $this->calculateRange(); $this->showFirstPageLink($link, $range); $this->showPreviousPageLink($link); for ($i = (int) $range['start']; $i <= $range['end']; ++$i) { $this->pagination[] = $this->buildPageNumber($i, $link . ($i > 1 ? 'page_' . $i . '/' : '') . $this->urlFragment, '', $this->currentPage === $i); } $this->showNextPageLink($link); $this->showLastPageLink($link, $range); } return $this->pagination; }