/** * 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); }
/** * indexAction * @author Thomas Schedler <*****@*****.**> * @version 1.0 */ public function indexAction() { $this->getModelFolders(); $objRootLevels = $this->objModelFolders->loadAllRootLevelsWithGroups($this->core->sysConfig->modules->global); $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')); $strRenderSciprt = $this->getRequest()->getParam('layoutType') == 'list' ? 'list.phtml' : 'tree.phtml'; $this->renderScript('navigation/' . $strRenderSciprt); }
/** * 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); } }
/** * 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); } }