Generates variables for page navigation

@param int $positionCount Paging positions count ( 0 - unlimited )

@return StdClass Object with page navigation data
332198
public function generatePageNavigation($positionCount = 0)
    {
        startProfile('generatePageNavigation');

        $pageNavigation = new StdClass();

        $pageNavigation->NrOfPages = $this->_iCntPages;
        $activePage = $this->getActPage();
        $pageNavigation->actPage = $activePage + 1;
        $url = $this->generatePageNavigationUrl();

        if ($positionCount == 0 || ($positionCount >= $pageNavigation->NrOfPages)) {
            $startNo = 2;
            $finishNo = $pageNavigation->NrOfPages;
        } else {
            $tmpVal = $positionCount - 3;
            $tmpVal2 = floor(($positionCount - 4) / 2);

            // actual page is at the start
            if ($pageNavigation->actPage <= $tmpVal) {
                $startNo = 2;
                $finishNo = $tmpVal + 1;
                // actual page is at the end
            } elseif ($pageNavigation->actPage >= $pageNavigation->NrOfPages - $tmpVal + 1) {
                $startNo = $pageNavigation->NrOfPages - $tmpVal;
                $finishNo = $pageNavigation->NrOfPages - 1;
                // actual page is in the middle
            } else {
                $startNo = $pageNavigation->actPage - $tmpVal2;
                $finishNo = $pageNavigation->actPage + $tmpVal2;
            }
        }

        if ($activePage > 0) {
            $pageNavigation->previousPage = $this->_addPageNrParam($url, $activePage - 1);
        }

        if ($activePage < $pageNavigation->NrOfPages - 1) {
            $pageNavigation->nextPage = $this->_addPageNrParam($url, $activePage + 1);
        }

        if ($pageNavigation->NrOfPages > 1) {
            for ($i = 1; $i < $pageNavigation->NrOfPages + 1; $i++) {
                if ($i == 1 || $i == $pageNavigation->NrOfPages || ($i >= $startNo && $i <= $finishNo)) {
                    $page = new stdClass();
                    $page->url = $this->_addPageNrParam($url, $i - 1);
                    $page->selected = ($i == $pageNavigation->actPage) ? 1 : 0;
                    $pageNavigation->changePage[$i] = $page;
                }
            }

            // first/last one
            $pageNavigation->firstpage = $this->_addPageNrParam($url, 0);
            $pageNavigation->lastpage = $this->_addPageNrParam($url, $pageNavigation->NrOfPages - 1);
        }

        stopProfile('generatePageNavigation');

        return $pageNavigation;
    }
616406
public function generatePageNavigationUrl()
    {
        if ((\OxidEsales\Eshop\Core\Registry::getUtils()->seoIsActive() && ($oRecomm = $this->getActiveRecommList()))) {
            return $oRecomm->getLink();
        }

        return \OxidEsales\Eshop\Application\Controller\FrontendController::generatePageNavigationUrl();
    }
130408
public function totalPages()
    {
        $maxrows      = (($m = $this->getParameter('RowsPerPage')) !== null)?$m:$this->getLocal('MaxRows');
        $totalrecords = (($m = $this->getParameter('TotalRecords')) !== null)?$m:$this->getLocal('TotalRecords');

        if (empty($totalrecords))
            return 0;
        if(empty($maxrows))
            throw new FiltererException('filter \'paging-total-pages\' requires the MaxRows template variable to be set');

        $totalpages = intval(($totalrecords-1)/$maxrows)+1;

        return $totalpages;
    }
885545
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getSourceId();
                break;
            case 2:
                return $this->getPageid();
                break;
            case 3:
                return $this->getTitle();
                break;
            case 4:
                return $this->getDisplaytitle();
                break;
            case 5:
                return $this->getPageImageFree();
                break;
            case 6:
                return $this->getWikibaseItem();
                break;
            case 7:
                return $this->getDisambiguation();
                break;
            case 8:
                return $this->getDefaultsort();
                break;
            case 9:
                return $this->getCreatedAt();
                break;
            case 10:
                return $this->getUpdatedAt();
                break;
            default:
                return null;
                break;
        } // switch()
    }
934536
public function getContextualChildren($position)
    {
        $widgetMapChildren = [];
        $viewWidgetMaps = $this->getContextualView()->getWidgetMapsForViewAndTemplates();

        foreach ($viewWidgetMaps as $viewWidgetMap) {
            if ($viewWidgetMap->getParent() == $this && $viewWidgetMap->getPosition() == $position) {
                $widgetMapChildren[] = $viewWidgetMap;
            }
        }

        return $widgetMapChildren;
    }
779921
public function pagetabs($tabs)
    {
        $tcn = rand(0, getrandmax());

        $html = '<ul class="nav-tabs nav" id="ccm-tabs-' . $tcn . '">';
        $c = Page::getCurrentPage();
        foreach ($tabs as $t) {
            if (is_array($t)) {
                $name = $t[1];
                $_c = $t[0];
            } else {
                $_c = $t;
                $name = $t->getCollectionName();
            }

            $href = Core::make('helper/navigation')->getLinkToCollection($_c);
            $active = false;
            if (is_object($c) && $c->getCollectionID() == $_c->getCollectionID()) {
                $active = true;
            }
            $html .= '<li class="' . (($active) ? 'active' : '') . '"><a href="' . $href . '">' . $name . '</a></li>';
        }
        $html .= '</ul>';

        return $html;
    }
887216
public function getMaxPosition(int $pageId): int
	{
		return $this->connection->query('SELECT IFNULL(MAX([position]), 0) position FROM %table WHERE [pageId] = %i', $this->getTableName(), $pageId)->fetch()->position;
	}
309340
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getMapuid();
                break;
            case 2:
                return $this->getNblaps();
                break;
            case 3:
                return $this->getScore();
                break;
            case 4:
                return $this->getNbfinish();
                break;
            case 5:
                return $this->getAvgscore();
                break;
            case 6:
                return $this->getCheckpoints();
                break;
            case 7:
                return $this->getPlayerId();
                break;
            case 8:
                return $this->getCreatedAt();
                break;
            case 9:
                return $this->getUpdatedAt();
                break;
            default:
                return null;
                break;
        } // switch()
    }
836809
public function renderNav($numberOfPages, $currentPage = 1, $queryParameters = array(), $maxPagesDisplayedAroundCurrent = 2)
    {
        $navigation = array();

        $firstPageDisplayed = 1;
        $lastPageDisplayed = (int)$numberOfPages;

        $leftPartUrl = $this->prepareQueryString($queryParameters);

        if ($currentPage > $maxPagesDisplayedAroundCurrent) {
            $firstPageDisplayed = $currentPage - $maxPagesDisplayedAroundCurrent;
            $navigation[] = '<a href="' . $leftPartUrl . '1" class="navigatorShortcut1">'
                . $this->translator->trans('open_orchestra_display.twig.navigator.first')
                . '</a>';
        }

        if ($currentPage > 1) {
            $navigation[] = '<a href="' . $leftPartUrl . ($currentPage - 1) . ' "class="navigatorShortcut2">'
                . $this->translator->trans('open_orchestra_display.twig.navigator.previous')
                . '</a>';
        }

        if ($firstPageDisplayed > 1) {
            $navigation[] = '...';
        }

        if ($currentPage < $numberOfPages - $maxPagesDisplayedAroundCurrent) {
            $lastPageDisplayed = $currentPage + $maxPagesDisplayedAroundCurrent;
        }

        for ($i = $firstPageDisplayed; $i <= $lastPageDisplayed; $i++) {
            if ($i == $currentPage) {
                $navigation[] = '<span class="navigatorCurrent">' . $i . '</span>';
            } else {
                $navigation[] = ' <a href="' . $leftPartUrl . $i . '" class="navigatorPage">' . $i . '</a>';
            }
        }

        if ($lastPageDisplayed < $numberOfPages) {
            $navigation[] = '...';
        }

        if ($currentPage < $numberOfPages) {
            $navigation[]= '<a href="' . $leftPartUrl . ($currentPage + 1) . '" class="navigatorShortcut2">'
                . $this->translator->trans('open_orchestra_display.twig.navigator.next')
                . '</a>';
        }

        if ($currentPage < $numberOfPages - $maxPagesDisplayedAroundCurrent) {
            $navigation[]= '<a href="' . $leftPartUrl . $numberOfPages . '" class="navigatorShortcut1">'
                . $this->translator->trans('open_orchestra_display.twig.navigator.last')
                . '</a>';
        }

        return implode(' ', $navigation);
    }
1267903
function GetPositionOnPage($url, &$result) 
	{
		$rank = new SearchRank();
		$counter = 0;
		
		foreach ($result->resultElements as $element) 
		{
			$counter++;
			//print "<div>$url :: $counter = ".$element->URL."</div>";
			$normalizedurl = str_replace("/","\\/", $url);
			
			if ($rank->Position == 0 && preg_match("/$normalizedurl/i", $element->URL)) 
			{
				$rank->Position = (int)$counter;
				$rank->Title = $element->title;
				$rank->Snippet = $element->snippet;
				$rank->Url = $element->URL;
			}
		}

		return $rank;
	}
724104
public function getDashboardPaneHeader($title = false, $help = false, $navigatePages = [], $upToPage = false, $favorites = true)
    {
        $c = Page::getCurrentPage();
        $vt = Core::make('helper/validation/token');
        $token = $vt->generate('access_quick_nav');

        $nh = Core::make('helper/navigation');
        $trail = $nh->getTrailToCollection($c);
        if (count($trail) > 1 || count($navigatePages) > 1 || is_object($upToPage)) {
            $parent = Page::getByID($c->getCollectionParentID());
            if (count($trail) > 1 && (!is_object($upToPage))) {
                $upToPage = Page::getByID($parent->getCollectionParentID());
            }
            $subpages = [];
            if ($navigatePages !== -1) {
                if (count($navigatePages) > 0) {
                    $subpages = $navigatePages;
                } else {
                    /*
                     * @var \Concrete\Core\Page\Page[]
                     */
                    $subpages = \Concrete\Block\Autonav\Controller::getChildPages($parent);
                }
            }

            $subpagesP = [];
            if (is_array($subpages)) {
                foreach ($subpages as $sc) {
                    $cp = new Permissions($sc);
                    if ($cp->canViewPage()) {
                        $subpagesP[] = $sc;
                    }
                }
            }

            if (count($subpagesP) > 0 || is_object($upToPage)) {
                $relatedPages = '<ul id="ccm-page-navigate-pages-content" class="dropdown-menu">';

                foreach ($subpagesP as $sc) {
                    if ($sc->getAttribute('exclude_nav')) {
                        continue;
                    }

                    if ($c->getCollectionPath() == $sc->getCollectionPath() || (strpos($c->getCollectionPath(), $sc->getCollectionPath()) == 0) && strpos($c->getCollectionPath(), $sc->getCollectionPath()) !== false) {
                        $class = 'nav-selected';
                    } else {
                        $class = '';
                    }

                    $relatedPages .= '<li class="' . $class . '"><a href="' . $nh->getLinkToCollection($sc) . '">' . t($sc->getCollectionName()) . '</a></li>';
                }

                if ($upToPage) {
                    $relatedPages .= '<li class="ccm-menu-separator"></li>';
                    $relatedPages .= '<li><a href="' . $nh->getLinkToCollection($upToPage) . '">' . t('&lt; Back to %s', t($upToPage->getCollectionName())) . '</a></li>';
                }
                $relatedPages .= '</ul>';
                $navigateTitle = t($parent->getCollectionName());
            }
        }

        $html = '<div class="ccm-pane-header">';

        /*$class = 'icon-star';
        $qn = ConcreteDashboardMenu::getMine();
        $quicknav = $qn->getItems(false);
        if (in_array($c->getCollectionPath(), $quicknav)) {
            $class = 'icon-white icon-star';
        }
        */
        $html .= '<ul class="ccm-pane-header-icons">';
        if (!$help) {
            $ih = Core::make('helper/concrete/ui/help');
            $pageHelp = $ih->getPages();
            if (isset($pageHelp[$c->getCollectionPath()])) {
                $help = $pageHelp[$c->getCollectionPath()];
            }
        }

        if (is_array($help)) {
            $help = $help[0] . '<br/><br/><a href="' . $help[1] . '" class="btn small" target="_blank">' . t('Learn More') . '</a>';
        }

        if (isset($relatedPages)) {
            $html .= '<li><a href="" data-toggle="dropdown" title="' . $navigateTitle . '" id="ccm-page-navigate-pages"><i class="icon-share-alt"></i></a>' . $relatedPages . '</li>';
        }

        if ($help) {
            $html .= '<li><span style="display: none" id="ccm-page-help-content">' . $help . '</span><a href="javascript:void(0)" title="' . t('Help') . '" id="ccm-page-help"><i class="icon-question-sign"></i></a></li>';
        }

        if ($favorites) {
            $html .= '<li><a href="javascript:void(0)" id="ccm-add-to-quick-nav" onclick="CCMDashboard.toggleQuickNav(' . $c->getCollectionID() . ',\'' . $token . '\')"><i class="' . $class . '"></i></a></li>';
        }

        $html .= '<li><a href="javascript:void(0)" onclick="CCMDashboard.closePane(this)"><i class="icon-remove"></i></a></li>';
        $html .= '</ul>';
        if (!$title) {
            $title = $c->getCollectionName();
        }
        $html .= '<h3>' . $title . '</h3>';
        $html .= '</div>';

        return $html;
    }
518885
protected function generateSearchRecord()
    {
        $searchPage = CwpSearchPage::create();
        $searchPage->URLSegment = 'search';
        $searchPage->Title = _t('SilverStripe\\CMS\\Search\\SearchForm.SearchResults', 'Search Results');
        $searchPage->ID = -1;
        return $searchPage;
    }
483456
public function setCountdownPosition($positionX, $positionY, $positionZ = null)
    {
        $this->setPositionProperty($this->countdownProperties, $positionX, $positionY, $positionZ);
        return $this;
    }
595214
public function getTabByPosition($position)
    {
        if (is_numeric($position) && $position < count($this->tabs)) {
            return $this->tabs[$position];
        }

        return null;
    }
477736
public function getVariables()
    {
        $variables = [];

        if ($this->page->getId()) {
            $variables['cms.identifier'] = $this->page->getIdentifier();
            $variables['cms.title']      = $this->page->getTitle();
        }

        return $variables;
    }
1216166
public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getTitle();
                break;
            case 2:
                return $this->getHost();
                break;
            case 3:
                return $this->getEndpoint();
                break;
            case 4:
                return $this->getCreatedAt();
                break;
            case 5:
                return $this->getUpdatedAt();
                break;
            default:
                return null;
                break;
        } // switch()
    }
178450
public function getPagination($className='CPagination')
	{
		if($this->_pagination===null)
		{
			$this->_pagination=new $className;
			if(($id=$this->getId())!='')
				$this->_pagination->pageVar=$id.'_page';
		}
		return $this->_pagination;
	}