From 1de9bbe022bc4f10b147a7127a39e8b5e51dab4a Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 31 Jul 2014 13:52:02 -0400 Subject: [PATCH] Add all sub levels for main navigation Adding all the sub levels for main nav. First level used is controlled by the define for MAIN_LEVEL_NAV_ARRAY in setup.phtml. --- Toolkit/Page.php | 31 ++++++++++++++++++++++++++++++- setup.phtml | 2 ++ templates/template.html | 17 ++--------------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/Toolkit/Page.php b/Toolkit/Page.php index 20f3b32..84e0ea7 100755 --- a/Toolkit/Page.php +++ b/Toolkit/Page.php @@ -513,8 +513,12 @@ class Toolkit_Page $this->pageId = $this->_catid; } $this->_navigationFactory->setGateway($this->_pageGateway); + // mainNav is the mobile navigation output $this->mainNav = $this->_getMainNav($this->_catid); + // sideNav output $this->sideNav = $this->_getSideNav($this->_catid); + // main Navigation output + $this->mainNavigationUl = $this->_getMainNavigation(); $this->newsletterAction = Toolkit_Template_Page::getSeoUrl( $this->_pageGateway, 10 @@ -620,7 +624,7 @@ class Toolkit_Page * * @param type $catid page catid * - * @return type + * @return string */ private function _getMainNav($catid) { @@ -632,6 +636,31 @@ class Toolkit_Page return ($html) ? $html : ''; } + /** + * Returns the main level navigation and all the subs + * Locked down to a few top levels + * + * @return string + */ + private function _getMainNavigation() + { + if (defined('MAIN_LEVEL_NAV_ARRAY') && MAIN_LEVEL_NAV_ARRAY) { + $mainNavArray = unserialize(MAIN_LEVEL_NAV_ARRAY); + } + $sideNav = new Toolkit_Template_Navigation_AllInOneSideNav( + $this->_pageGateway + ); + $nav = $sideNav->getNavigation(); + $newNav = array(); + foreach ($nav as $key => $item) { + if (in_array($item['id'], $mainNavArray)) { + $newNav[] = $item; + } + } + $html = $this->_arrayToListHTML($newNav, 0, 'clearfix'); + return ($html) ? $html : ''; + } + /** * _arrayToListHTML * diff --git a/setup.phtml b/setup.phtml index 927ef48..3cd8f9c 100644 --- a/setup.phtml +++ b/setup.phtml @@ -54,6 +54,8 @@ if (!isset($DEBUG)) { } $securePagesArray = array(); define('SECURE_PAGES', serialize($securePagesArray)); +$mainNavigationUl = array(2,7,10,11); +define('MAIN_LEVEL_NAV_ARRAY', serialize($mainNavigationUl)); $nonMobilePagesArray = array(); define('NON_MOBILE_PAGES', serialize($nonMobilePagesArray)); /** diff --git a/templates/template.html b/templates/template.html index 9ca50ff..6cd5563 100755 --- a/templates/template.html +++ b/templates/template.html @@ -58,20 +58,7 @@ @@ -191,7 +178,7 @@ Recreation Department (906) 298-0333 recdept@cityofmi.org - +
-- 2.17.1