/** * 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); } }