public function onNavigationItemChildrenRequested(NavigationItem $oNavigationItem) { $mIdentifier = $oNavigationItem->getIdentifier(); if ($oNavigationItem instanceof PageNavigationItem && $oNavigationItem->getMe()->isOfType('journal')) { $this->addChildrenToPageNavigationItem($oNavigationItem); } else { if ($oNavigationItem instanceof VirtualNavigationItem) { $this->addChildrenToVirtualNavigationItem($oNavigationItem); } } }
/** * Return the sibling items (ie. items with the same parent) * @return Array - sibling items * @access public */ public function siblings() { $ret = array(); if ($this->parent) { $ret = $this->parent->getChildren(); } return $ret; }
public function __construct(Page $oMe, $oParent = null) { $this->oMe = $oMe; $this->bIsCurrent = null; if ($oParent === null && !$oMe->isRoot()) { $oParent = self::navigationItemForPage($oMe->getParent()); } parent::__construct($oParent); }
/** * @param string $sType Virtual identifier * @param string $sName Page path name * @param string $sTitle Page title * @param string $sLinkText Page link text. Defaults to title. * @param mixed $mData Additional data to be stored for later retrieval */ public function __construct($sType, $sName, $sTitle, $sLinkText = null, $mData = null, $oCanonical = null) { $this->sType = $sType; $this->sName = (string) $sName; $this->sTitle = $sTitle; $this->sLinkText = $sLinkText === null ? $sTitle : $sLinkText; $this->mData = $mData; $this->oCanonical = $oCanonical; parent::__construct(null); }
public function build($navigationArray) { foreach ($navigationArray as $module => $items) { foreach ($items as $label => $destination) { if (is_array($destination)) { $children = array_slice($destination, 1); $destination = $destination[0]; $item = new NavigationItem($label, $destination, $module); foreach ($children as $childLabel => $childDestination) { $child = new NavigationItem($childLabel, $childDestination, $module); $item->addChild($child); } } else { $item = new NavigationItem($label, $destination, $module); } $this->items[] = $item; } } }
public function onNavigationItemChildrenRequested(NavigationItem $oNavigationItem) { if (!($oNavigationItem instanceof PageNavigationItem && $oNavigationItem->getIdentifier() === self::PARENT_PAGE_IDENTIFIER)) { return; } $aDocumentationPartKeys = array(); foreach (DocumentationProviderTypeModule::completeMetaData() as $sPart => $aLanguages) { if (isset($aLanguages[Session::language()])) { $aDocumentationPartKeys[$sPart] = false; } } foreach (DocumentationPartQuery::create()->filterByLanguageId(Session::language())->select('Key')->find() as $sPart) { $aDocumentationPartKeys[$sPart] = true; } ksort($aDocumentationPartKeys); $aDocumentations = DocumentationsFrontendModule::listQuery()->select(array('Key', 'Name', 'Title', 'NameSpace'))->find(); foreach ($aDocumentations as $aParams) { $aConfiguredParts = array(); foreach ($aDocumentationPartKeys as $sKey => $bIsInternal) { if (StringUtil::startsWith($sKey, $aParams['NameSpace'] . '.')) { $aConfiguredParts[$sKey] = $bIsInternal; unset($aDocumentationPartKeys[$sKey]); } else { if ($sKey > $aParams['NameSpace'] . '.') { break; } } } $sTitle = $aParams['Title'] != null ? $aParams['Title'] : $aParams['Name']; $oNavItem = new VirtualNavigationItem(self::ITEM_TYPE, $aParams['Key'], 'Dokumentation ' . $sTitle, $aParams['Name'], $aConfiguredParts); $oNavigationItem->addChild($oNavItem); } // if(count($aDocumentationPartKeys) > 0) { // $oNavItem = new VirtualNavigationItem(self::ITEM_TYPE_UNCATEGORIZED, 'uncategorized', TranslationPeer::getString('documentations.uncategorized'), null, $aDocumentationPartKeys); // $oNavigationItem->addChild($oNavItem); // } }
/** * Структура сайта (навигация и т.д.) * * @return NavigationItem */ private function getStructureImpl() { $MAP = NavigationItem::byPageCode(BASE_PAGE_MAP); $INDEX = NavigationItem::byPageCode(BASE_PAGE_INDEX, 'О проекте'); $INDEX->addChild(NavigationItem::byPageCode(PAGE_OFFICE)); $INDEX->addChild(NavigationItem::byPageCode(PAGE_REGISTRATION)); $INDEX->addChild(NavigationItem::byPageCode(PAGE_PASS_REMIND)); $MAGAZINE = NavigationItem::byPostsProcessor(MagManager::inst(), 'Все выпуски'); $BLOG = NavigationItem::byRubricProcessor(BlogManager::inst(), 'Все заметки', 'Все заметки раздела'); $TRAININGS = NavigationItem::byRubricProcessor(TrainManager::inst(), 'Все занятия', 'Все занятия в разделе'); $TRAININGS->addChild(NavigationItem::byPageCode(PAGE_LESSON_HOW_TO)); $FEEDBACK = NavigationItem::byPageCode(BASE_PAGE_FEEDBACK, 'Об авторе'); $FEEDBACK->addChild(NavigationItem::byHref(FeedbackManager::inst()->writeToUsHref())->setNoBg()); $FEEDBACK->addChild(NavigationItem::byPageCode(PAGE_HELPUS)); //Окончательная структура $MAP->addChild($INDEX); $MAP->addChild($MAGAZINE); $MAP->addChild($BLOG); $MAP->addChild($TRAININGS); $MAP->addChild($FEEDBACK); return $MAP; }
/** * Merges this navigation item with the other parameter and returns a new NavigationItem. * Works only if there are no duplicate values on one level. * @param NavigationItem $other The navigation item this one should be merged with * @return NavigationItem */ public function merge(NavigationItem $other = null) { // Create new item $new = $this->copyChildless(); // Add all children from this item foreach ($this->getChildren() as $child) { /** @var NavigationItem $child */ $new->addChild($child->merge($other != null ? $other->findChildren($child) : null)); } // Add all children from the other item if ($other != null) { foreach ($other->getChildren() as $child) { /** @var NavigationItem $child */ if (!$new->find($child)) { $new->addChild($child->merge($this->copyChildless())); } } } return $new; }
public function __toString() { return parent::__toString(); }
/** * addXmlUrlsetChilds * @param NavigationItem|NavigationTree $objItem * @param string $strUrl * @param string $strLanguageCode * @return void */ public function addXmlUrlsetChilds($objItem, $strUrl, $strLanguageCode, $intLevel = 0) { if ($objItem->getUrl() != '') { $strItemUrl = strpos($objItem->getUrl(), 'http://') !== false ? str_replace('&', '&', $objItem->getUrl()) : $strUrl . str_replace('&', '&', $objItem->getUrl()); if (!array_search($strItemUrl, $this->arrUrls)) { $this->arrUrls[] = $strItemUrl; $objUrl = $this->objDoc->createElement('url'); $objUrl->appendChild($this->objDoc->createElement('loc', $strItemUrl)); if ($objItem->getUrl() == '/' . $strLanguageCode . '/') { $objUrl->appendChild($this->objDoc->createElement('lastmod', date('Y-m-d'))); } else { if ($objItem->getChanged('', true) !== null) { $objUrl->appendChild($this->objDoc->createElement('lastmod', $objItem->getChanged('Y-m-d'))); } } if ($objItem->getUrl() == '/' . $strLanguageCode . '/') { $objUrl->appendChild($this->objDoc->createElement('changefreq', 'daily')); $objUrl->appendChild($this->objDoc->createElement('priority', '0.8')); } $objUrl = $this->objUrlset->appendChild($objUrl); } } if ($objItem instanceof NavigationTree) { foreach ($objItem as $objChild) { $this->addXmlUrlsetChilds($objChild, $strUrl, $strLanguageCode, $intLevel + 1); } } }
/** * indexAction * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function indexAction() { $this->getModelFolders(); $objRootLevels = $this->objModelFolders->loadAllRootLevels($this->core->sysConfig->modules->cms); $objRootLevelNavigation = new NavigationTree(); if (count($objRootLevels) > 0) { $intOrder = 0; foreach ($objRootLevels as $objRootLevel) { $intOrder++; if (!$objRootLevelNavigation->hasSubTree('order_' . $objRootLevel->order)) { $objNavGroup = new NavigationTree(); $objNavGroup->setId($objRootLevel->order); $objNavGroup->setItemId($objRootLevel->id); $objNavGroup->setTypeId($objRootLevel->idRootLevelTypes); $objNavGroup->setTitle($objRootLevel->title); $objNavGroup->setUrl($objRootLevel->href); $objNavGroup->setLanguageId((int) $objRootLevel->rootLevelGuiLanguageId > 0 ? $objRootLevel->rootLevelGuiLanguageId : $objRootLevel->rootLevelLanguageId); $objRootLevelNavigation->addTree($objNavGroup, 'order_' . $objRootLevel->order); } $objNavItem = new NavigationItem(); $objNavItem->setId($objRootLevel->id); $objNavItem->setItemId($objRootLevel->id); $objNavItem->setTypeId($objRootLevel->idRootLevelTypes); $objNavItem->setTitle($objRootLevel->title); $objNavItem->setUrl($objRootLevel->href); $objNavItem->setOrder($intOrder); $objNavItem->setParentId($objRootLevel->order); $objNavItem->setLanguageId((int) $objRootLevel->rootLevelGuiLanguageId > 0 ? $objRootLevel->rootLevelGuiLanguageId : $objRootLevel->rootLevelLanguageId); $objRootLevelNavigation->addToParentTree($objNavItem, 'rootLevelId_' . $objRootLevel->id); } } $this->view->assign('rootLevelNavigation', $objRootLevelNavigation); $this->view->assign('rootLevelMaintenances', $this->loadActiveMaintenances()); $this->view->assign('folderFormDefaultId', $this->core->sysConfig->form->ids->folders->default); $this->view->assign('folderBlogFormDefaultId', $this->core->sysConfig->form->ids->folders->blog); $this->view->assign('pageFormDefaultId', $this->core->sysConfig->page_types->page->default_formId); $this->view->assign('pageTemplateDefaultId', $this->core->sysConfig->page_types->page->default_templateId); $this->view->assign('pageTypeDefaultId', $this->core->sysConfig->page_types->page->id); }
/** * {@inheritdoc} */ public function toArray() { $result = parent::toArray(); // build options object $dataNavigation = ['rootUrl' => $this->dataUrl, 'url' => $this->dataUrl, 'resultKey' => $this->dataResultKey, 'nameKey' => $this->dataNameKey, 'childrenLinkKey' => $this->dataChildrenLinkKey, 'showAddButton' => $this->showAddButton, 'instanceName' => $this->instanceName, 'translates' => ['noData' => $this->noDataTranslationKey, 'title' => $this->titleTranslationKey, 'addButton' => $this->addButtonTranslationKey, 'search' => $this->searchTranslationKey]]; // not setted values should be removed $dataNavigation = array_filter($dataNavigation); $result['dataNavigation'] = $dataNavigation; return $result; }
/** * indexAction * @author Cornelius Hansjakob <*****@*****.**> * @version 1.0 */ public function indexAction() { $this->getModelFolders(); $objRootLevels = $this->objModelFolders->loadAllRootLevelsWithGroups($this->core->sysConfig->modules->contacts); $objRootLevelNavigation = new NavigationTree(); if (count($objRootLevels) > 0) { $intOrder = 0; foreach ($objRootLevels as $objRootLevel) { $intOrder++; if (!$objRootLevelNavigation->hasSubTree($objRootLevel->name)) { $objNavGroup = new NavigationTree(); $objNavGroup->setId($objRootLevel->idRootLevelGroups); $objNavGroup->setItemId($objRootLevel->name); $objNavGroup->setTypeId($objRootLevel->idRootLevelGroups); $objNavGroup->setTitle($objRootLevel->rootLevelGroupTitle); $objNavGroup->setUrl($objRootLevel->href); $objNavGroup->setLanguageId((int) $objRootLevel->rootLevelGuiLanguageId > 0 ? $objRootLevel->rootLevelGuiLanguageId : $objRootLevel->rootLevelLanguageId); $objRootLevelNavigation->addTree($objNavGroup, $objRootLevel->name); } $objNavItem = new NavigationItem(); $objNavItem->setId($objRootLevel->id); $objNavItem->setItemId($objRootLevel->name); $objNavItem->setTypeId($objRootLevel->idRootLevelTypes); $objNavItem->setTitle($objRootLevel->title); $objNavItem->setUrl($objRootLevel->href); $objNavItem->setOrder($intOrder); $objNavItem->setParentId($objRootLevel->idRootLevelGroups); $objNavItem->setLanguageId((int) $objRootLevel->rootLevelGuiLanguageId > 0 ? $objRootLevel->rootLevelGuiLanguageId : $objRootLevel->rootLevelLanguageId); $objRootLevelNavigation->addToParentTree($objNavItem, $objRootLevel->name . '_' . $objRootLevel->id); } } $this->view->assign('rootLevelNavigation', $objRootLevelNavigation); $this->view->assign('rootLevelId', $this->getRequest()->getParam('rootLevelId')); $this->view->assign('rootLevelGroupId', $this->getRequest()->getParam('rootLevelGroupId')); $this->view->assign('rootLevelGroupKey', $this->getRequest()->getParam('rootLevelGroupKey')); $this->view->assign('rootLevelType', $this->getRequest()->getParam('rootLevelType')); $this->core->logger->debug($this->getRequest()->getParam('rootLevelId')); $this->core->logger->debug($this->getRequest()->getParam('rootLevelGroupId')); $this->core->logger->debug($this->getRequest()->getParam('rootLevelType')); $strRenderSciprt = $this->getRequest()->getParam('layoutType') == 'list' ? 'list.phtml' : 'tree.phtml'; $this->renderScript('navigation/' . $strRenderSciprt); }
/** * loadSitemap * @retrun NavigationTree * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function loadSitemap() { try { $this->getModelFolders(); $this->evaluateRootFolderId(); $objSitemap = new NavigationTree(); $objSitemap->setId(0); if ($this->intRootLevelId > 0) { $objNavigationData = $this->objModelFolders->loadWebsiteRootLevelChilds($this->intRootLevelId, 99, -1, true); $intTreeId = 0; foreach ($objNavigationData as $objNavigationItem) { if ($objNavigationItem->title != '') { if ($objNavigationItem->isStartPage == 1 && $objNavigationItem->depth == 0) { /** * add to parent tree */ if (isset($objTree) && is_object($objTree) && $objTree instanceof NavigationTree) { $objSitemap->addToParentTree($objTree, 'tree_' . $objTree->getId()); } $objTree = new NavigationTree(); $objTree->setTitle($objNavigationItem->folderTitle != '' ? $objNavigationItem->folderTitle : $objNavigationItem->title); $objTree->setId($objNavigationItem->idFolder); $objTree->setParentId(0); $objTree->setTypeId($objNavigationItem->idPageTypes); $objTree->setItemId($objNavigationItem->folderId); $objTree->setOrder($objNavigationItem->folderOrder); $objTree->setUrl($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->external : '/' . strtolower($objNavigationItem->languageCode) . '/' . $objNavigationItem->url); $objTree->setTarget($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->target : ''); $objTree->setChanged($objNavigationItem->changed); $arrPageGlobaLinkTypes = array($this->core->sysConfig->page_types->product_tree->id, $this->core->sysConfig->page_types->press_area->id, $this->core->sysConfig->page_types->courses->id, $this->core->sysConfig->page_types->events->id); if (in_array($objNavigationItem->idPageTypes, $arrPageGlobaLinkTypes)) { $arrFilter = array(); if ($this->objPage instanceof Page && $this->objPage->getElementId() == $objNavigationItem->idPage) { $arrFilter = array('CategoryId' => $this->objPage->getFieldValue('entry_category'), 'LabelId' => $this->objPage->getFieldValue('entry_label'), 'SorttypeId' => $this->objPage->getFieldValue('entry_sorttype'), 'ParentId' => $this->objPage->getFieldValue('entry_point')); } else { $arrFilter = array('CategoryId' => $objNavigationItem->entry_category, 'LabelId' => $objNavigationItem->entry_label, 'SorttypeId' => $objNavigationItem->entry_sorttype, 'ParentId' => $objNavigationItem->entry_point); } if (count($arrFilter) > 0) { $this->addGlobalTree($objTree, $objNavigationItem->idPageTypes, $arrFilter, 999); } } $intTreeId = $objNavigationItem->idFolder; } else { if ($intTreeId != $objNavigationItem->idFolder) { /** * add to parent tree */ if (isset($objTree) && is_object($objTree) && $objTree instanceof NavigationTree) { $objSitemap->addToParentTree($objTree, 'tree_' . $objTree->getId()); } $objTree = new NavigationTree(); $objTree->setTitle($objNavigationItem->folderTitle); $objTree->setId($objNavigationItem->idFolder); $objTree->setTypeId($objNavigationItem->idPageTypes); $objTree->setParentId($objNavigationItem->parentId); $objTree->setItemId($objNavigationItem->folderId); $objTree->setOrder($objNavigationItem->folderOrder); $objTree->setUrl($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->external : '/' . strtolower($objNavigationItem->languageCode) . '/' . $objNavigationItem->url); $objTree->setTarget($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->target : ''); $objTree->setChanged($objNavigationItem->changed); $arrPageGlobaLinkTypes = array($this->core->sysConfig->page_types->product_tree->id, $this->core->sysConfig->page_types->press_area->id, $this->core->sysConfig->page_types->courses->id, $this->core->sysConfig->page_types->events->id); if (in_array($objNavigationItem->idPageTypes, $arrPageGlobaLinkTypes)) { $arrFilter = array(); if ($this->objPage instanceof Page && $this->objPage->getElementId() == $objNavigationItem->idPage) { $arrFilter = array('CategoryId' => $this->objPage->getFieldValue('entry_category'), 'LabelId' => $this->objPage->getFieldValue('entry_label'), 'SorttypeId' => $this->objPage->getFieldValue('entry_sorttype'), 'ParentId' => $this->objPage->getFieldValue('entry_point')); } else { $arrFilter = array('CategoryId' => $objNavigationItem->entry_category, 'LabelId' => $objNavigationItem->entry_label, 'SorttypeId' => $objNavigationItem->entry_sorttype, 'ParentId' => $objNavigationItem->entry_point); } if (count($arrFilter) > 0) { $this->addGlobalTree($objTree, $objNavigationItem->idPageTypes, $arrFilter, 999); } } $intTreeId = $objNavigationItem->idFolder; } if ($objNavigationItem->pageId != null) { if ($objNavigationItem->isStartPage == 1 && isset($objTree)) { $objTree->setUrl($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->external : '/' . strtolower($objNavigationItem->languageCode) . '/' . $objNavigationItem->url); $objTree->setTarget($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->target : ''); } else { $objItem = new NavigationItem(); $objItem->setTitle($objNavigationItem->title); $objItem->setUrl($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->external : '/' . strtolower($objNavigationItem->languageCode) . '/' . $objNavigationItem->url); $objItem->setTarget($objNavigationItem->idPageTypes == $this->core->sysConfig->page_types->external->id ? $objNavigationItem->target : ''); $objItem->setId($objNavigationItem->idPage); $objItem->setTypeId($objNavigationItem->idPageTypes); $objItem->setParentId($objNavigationItem->idFolder); $objItem->setItemId($objNavigationItem->pageId); $objItem->setOrder($objNavigationItem->pageOrder); $objItem->setChanged($objNavigationItem->changed); if (isset($objTree)) { $objTree->addItem($objItem, 'item_' . $objItem->getId()); } else { $objSitemap->addItem($objItem, 'item_' . $objItem->getId()); } } } } } } } /** * add to parent tree */ if (isset($objTree) && is_object($objTree) && $objTree instanceof NavigationTree) { $objSitemap->addToParentTree($objTree, 'tree_' . $objTree->getId()); } return $objSitemap; } catch (Exception $exc) { $this->core->logger->err($exc); } }
public function addChild(NavigationItem $oChild) { $this->prepareChildren(); $oChild->oParent = $this; $this->aCustomChildren[$oChild->getName()] = $oChild; }
/** * loadStaticSubNavigation * @param integer $intDepth * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function loadStaticSubNavigation($intDepth = 2) { try { $this->getModelFolders(); $this->evaluateRootFolderId(); $objNavigationTree = new NavigationTree(); $objNavigationTree->setId($this->intRootFolderId); if ($this->intRootFolderId > 0) { $objSubNavigationData = $this->objModelFolders->loadWebsiteStaticSubNavigation($this->intRootFolderId, $intDepth); $intTreeId = 0; foreach ($objSubNavigationData as $objSubNavigationItem) { if ($this->intRootFolderId == $objSubNavigationItem->idFolder) { if (isset($objSubNavigationItem->isStartPage) && $objSubNavigationItem->isStartPage == 1) { $objNavigationTree->setTitle($objSubNavigationItem->folderTitle); $objNavigationTree->setUrl('/' . strtolower($objSubNavigationItem->languageCode) . '/' . $objSubNavigationItem->url); } else { if (isset($objSubNavigationItem->idWidgetInstance)) { $objItem = new NavigationItem(); $objItem->setTitle($objSubNavigationItem->widgetInstanceTitle); $objItem->setUrl('/' . strtolower($objSubNavigationItem->languageCode) . '/' . $objSubNavigationItem->url); //TODO Set Url $objItem->setId($objSubNavigationItem->idWidgetInstance); $objItem->setParentId($objSubNavigationItem->idFolder); $objItem->setOrder($objSubNavigationItem->widgetInstanceOrder); $objItem->setItemId($objSubNavigationItem->idWidgetInstance); } else { if (isset($objSubNavigationItem->pageId)) { $objItem = new NavigationItem(); $objItem->setTitle($objSubNavigationItem->pageTitle); $objItem->setUrl('/' . strtolower($objSubNavigationItem->languageCode) . '/' . $objSubNavigationItem->url); $objItem->setId($objSubNavigationItem->idPage); $objItem->setParentId($objSubNavigationItem->idFolder); $objItem->setOrder($objSubNavigationItem->pageOrder); $objItem->setItemId($objSubNavigationItem->idPage); } } if (isset($objItem)) { $objNavigationTree->addItem($objItem, 'item_' . $objItem->getId()); } } } else { if ($intTreeId != $objSubNavigationItem->idFolder) { /** * add to parent tree */ if (isset($objTree) && is_object($objTree) && $objTree instanceof NavigationTree) { $objNavigationTree->addToParentTree($objTree, 'tree_' . $objTree->getId()); } $objTree = new NavigationTree(); $objTree->setTitle($objSubNavigationItem->folderTitle); $objTree->setId($objSubNavigationItem->idFolder); $objTree->setParentId($objSubNavigationItem->parentId); $objTree->setOrder($objSubNavigationItem->folderOrder); $objTree->setItemId($objSubNavigationItem->folderId); $intTreeId = $objSubNavigationItem->idFolder; } if ($objSubNavigationItem->pageId != null) { if ($objSubNavigationItem->isStartPage == 1) { $objTree->setUrl('/' . strtolower($objSubNavigationItem->languageCode) . '/' . $objSubNavigationItem->url); //$objTree->setItemId($objSubNavigationItem->pageId); } else { $objItem = new NavigationItem(); $objItem->setTitle($objSubNavigationItem->pageTitle); $objItem->setUrl('/' . strtolower($objSubNavigationItem->languageCode) . '/' . $objSubNavigationItem->url); $objItem->setId($objSubNavigationItem->idPage); $objItem->setParentId($objSubNavigationItem->idFolder); $objItem->setOrder($objSubNavigationItem->pageOrder); $objItem->setItemId($objSubNavigationItem->pageId); $objTree->addItem($objItem, 'item_' . $objItem->getId()); } } } } } /** * add to parent tree */ if (isset($objTree) && is_object($objTree) && $objTree instanceof NavigationTree) { $objNavigationTree->addToParentTree($objTree, 'tree_' . $objTree->getId()); } $this->objSubNavigation = $objNavigationTree; } catch (Exception $exc) { $this->core->logger->err($exc); } }
/** * addToParentTree * @param NavigationTree|NavigationItem $objNav * @param string $strName * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function addToParentTree($objNav, $strName = null) { if ($this->intId == $objNav->getParentId()) { if ($objNav instanceof NavigationTree) { $this->addTree($objNav, $strName); } else { if ($objNav instanceof NavigationItem) { $this->addItem($objNav, $strName); } } return true; } else { foreach ($this->arrTrees as $objSubTree) { if ($objSubTree->addToParentTree($objNav, $strName)) { break; } } } }
/** * @param int $iLevel level of current NavigationItem (expensive to calculate from the NavigationItem alone) * @param BooleanParser $oBooleanParser the BooleanParser instance holding information about the current NavigationItem’s properties] * @param NavigationItem $oNavigationItem the current navigation item * @return string parsed navigation */ private function getConfigForPage($iLevel, $oBooleanParser, $oNavigationItem) { $aConfigToCheck = @$this->aConfig[$iLevel]; if ($aConfigToCheck === null) { if (!isset($this->aConfig['all'])) { return null; } $aConfigToCheck = $this->aConfig['all']; } foreach ($aConfigToCheck as $aConfig) { if (isset($aConfig['page_name']) && $aConfig['page_name'] !== $oNavigationItem->getName()) { continue; } if (isset($aConfig['page_identifier']) && $aConfig['page_identifier'] !== $oNavigationItem->getIdentifier()) { continue; } if (isset($aConfig['page_type']) && $aConfig['page_type'] !== $oNavigationItem->getType()) { continue; } if (!isset($aConfig['on']) || $oBooleanParser->parse($aConfig['on'])) { return $aConfig; } } return null; }