protected function getChildrenImpl($sLanguageId, $bIncludeDisabled, $bIncludeInvisible) { $aResult = array(); foreach ($this->oMe->getChildrenWith($sLanguageId, $bIncludeDisabled, $bIncludeInvisible) as $oPage) { $aResult[$oPage->getName()] = PageNavigationItem::navigationItemForPage($oPage, $this); } return $aResult; }
public function renderFile() { $this->oXmlDocument = new DOMDocument(); $this->oUrl = $this->oXmlDocument->createElement('urlset'); $this->oUrl->setAttribute('xmlns', $this->sXmlNamespace); $this->oXmlDocument->appendChild($this->oUrl); $oRootPage = PagePeer::getRootPage(); $oRootNavigationItem = PageNavigationItem::navigationItemForPage($oRootPage); $this->renderNavigationItem($oRootNavigationItem); header('Content-Type: application/xml;charset=utf-8'); print $this->oXmlDocument->saveXML(); }
public function pages($bIncludeVirtual = false) { $aResult = array(); $cGather = function ($aNavigationItems, $iLevel) use(&$aResult, &$cGather, $bIncludeVirtual) { foreach ($aNavigationItems as $oNavigationItem) { if (!$bIncludeVirtual && !$oNavigationItem instanceof PageNavigationItem) { continue; } $oResult = new StdClass(); $oResult->level = $iLevel; $oResult->page_id = $oNavigationItem->getId(); $oResult->name = $oNavigationItem->getName(); $aResult[] = $oResult; if ($oNavigationItem->hasChildren(null, false, true)) { $cGather($oNavigationItem->getChildren(null, false, true), $iLevel + 1); } } }; $cGather(array(PageNavigationItem::navigationItemForPage(PagePeer::getRootPage())), 0); return $aResult; }
public function renderFile() { //Prerequisites Session::getSession()->setLanguage($this->sLanguageId); //Clear index SearchIndexQuery::create()->filterByLanguageId($this->sLanguageId)->delete(); //Spider index $oRootPage = PagePeer::getRootPage(); $this->oRootNavigationItem = PageNavigationItem::navigationItemForPage($oRootPage); $this->spider($this->oRootNavigationItem); //GC gc_enable(); //Update index PreviewManager::setTemporaryManager('FrontendManager'); foreach ($this->aIndexPaths as $aPath) { $bIsIndexed = $this->index($aPath); set_time_limit(30); $this->gc(); $sMessage = $bIsIndexed ? 'Indexed' : 'Skipped'; print "{$sMessage} <code>/" . htmlentities(implode('/', $aPath)) . "</code><br>\n"; } PreviewManager::revertTemporaryManager(); }
/** * render() */ public function render() { FilterModule::getFilters()->handleRequestStarted(); $bIsDynamic = false; $bIsAjaxRequest = Manager::isPost() && Manager::isXMLHttpRequest(); $aAjaxSections = array('container' => array(), 'navigation' => array()); ///@todo remove legacy support when the need fades $bIsLegacyAjaxRequest = $bIsAjaxRequest && isset($_REQUEST['container_only']); if ($bIsAjaxRequest) { if ($bIsLegacyAjaxRequest) { $_REQUEST['ajax_containers'] = array($_REQUEST['container_only']); } if (isset($_REQUEST['ajax_containers'])) { sort($_REQUEST['ajax_containers']); $aAjaxSections['container'] = $_REQUEST['ajax_containers']; } if (isset($_REQUEST['ajax_navigations'])) { sort($_REQUEST['ajax_navigations']); $aAjaxSections['navigation'] = $_REQUEST['ajax_navigations']; } if (isset($_REQUEST['ajax_title'])) { $aAjaxSections = array_merge($aAjaxSections, array('page_title' => true, 'link_text' => true, 'title' => true)); } asort($aAjaxSections); } $sPageType = self::$CURRENT_PAGE->getPageType(); $this->oPageType = PageTypeModule::getModuleInstance($sPageType, self::$CURRENT_PAGE, self::$CURRENT_NAVIGATION_ITEM); $aAllowedParams = $this->oPageType->acceptedRequestParams($bIsAjaxRequest ? $aAjaxSections['container'] : null); $bParamsNotAllowed = count(array_intersect($this->aPathRequestParams, $aAllowedParams)) !== count($this->aPathRequestParams); $this->bIsNotFound = $this->bIsNotFound || $bParamsNotAllowed; FilterModule::getFilters()->handlePageNotFoundDetectionComplete($this->bIsNotFound, self::$CURRENT_PAGE, self::$CURRENT_NAVIGATION_ITEM, array(&$this->bIsNotFound)); if ($this->bIsNotFound) { FilterModule::getFilters()->handlePageNotFound(); LinkUtil::sendHTTPStatusCode(404, 'Not Found'); $sErrorPageName = Settings::getSetting('error_pages', 'not_found', null); $oPage = null; if ($sErrorPageName) { $oPage = PageQuery::create()->findOneByName($sErrorPageName); } if ($oPage === null) { die(TranslationPeer::getString('wns.page.not_found')); } self::$CURRENT_PAGE = $oPage; self::$CURRENT_NAVIGATION_ITEM = PageNavigationItem::navigationItemForPage($oPage); //Set correct page type of 404 page $sPageType = self::$CURRENT_PAGE->getPageType(); $this->oPageType = PageTypeModule::getModuleInstance($sPageType, self::$CURRENT_PAGE); } else { $this->addCanonicalLink(); } if (!$bIsAjaxRequest) { $oOutput = $this->getXHTMLOutput(); $oOutput->render(); } else { if (!$bIsLegacyAjaxRequest) { header("Content-Type: application/json;charset=utf-8"); } } $sPageIdentifier = implode('/', self::$CURRENT_NAVIGATION_ITEM->getLink()) . '_' . Session::language(); if ($bIsAjaxRequest) { $sPageIdentifier .= '_' . serialize($aAjaxSections); } // Init the template if ($bIsLegacyAjaxRequest) { $this->oTemplate = new Template(TemplateIdentifier::constructIdentifier('container', $_REQUEST['container_only']), null, true, true); } else { if ($bIsAjaxRequest) { $this->oTemplate = new AjaxTemplate($aAjaxSections, true); } else { $this->oTemplate = self::$CURRENT_PAGE->getTemplate(true); } } FilterModule::getFilters()->handleBeforePageFill(self::$CURRENT_PAGE, $this->oTemplate); if (!$bIsLegacyAjaxRequest) { $this->fillAttributes(); $this->fillNavigation(); $this->fillAutofill(); } $this->fillContent(); $this->renderTemplate(); while (ob_get_level() > 0) { ob_end_flush(); } FilterModule::getFilters()->handleRequestFinished(array(self::$CURRENT_PAGE, $bIsDynamic, $bIsAjaxRequest)); }
/** * renderDateNavigationWidget() * * description: display date tree configured in journal/config/config.yml * @return Template object */ private function renderDateNavigationWidget() { $oTemplate = $this->constructTemplate('widget_date_navigation'); if ($this->archiveIsActive()) { $sHref = LinkUtil::link($this->oPage->getLinkArray()); $oTemplate->replaceIdentifier('overview_page_href', $sHref, null, Template::NO_HTML_ESCAPE); } $oNavigation = new Navigation('journal_date_navigation_widget'); $oTemplate->replaceIdentifier('date_navigation', $oNavigation->parse(PageNavigationItem::navigationItemForPage($this->oPage))); return $oTemplate; }