Add in main nav
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 12 Aug 2014 15:54:50 +0000 (11:54 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 12 Aug 2014 15:54:50 +0000 (11:54 -0400)
Setup the main nav.
For the correct links.
Need to work on the images.

Toolkit/Page.php
setup.phtml
templates/template.html

index af09afd..11e8e02 100755 (executable)
@@ -455,6 +455,8 @@ class Toolkit_Page
         $this->_navigationFactory->setGateway($this->_pageGateway);
         $this->mainNav = $this->_getMainNav($this->_catid);
         $this->sideNav = $this->_getSideNav($this->_catid);
+        // main Navigation output
+        $this->mainNavigationUl = $this->_getMainNavigation();
 
         $this->newsletterAction = Toolkit_Template_Page::getSeoUrl(
             $this->_pageGateway, 10
@@ -564,19 +566,35 @@ class Toolkit_Page
      */
     private function _getMainNav($catid)
     {
-        $nav          = $this->_navigationFactory->createMainNav();
-        $mainNavArray = $nav->getNavStructure($this->_pageGateway, $catid);
-
-        return $nav->renderPageNav($mainNavArray, 'tree');
+        $sideNav = new Toolkit_Template_Navigation_AllInOneSideNav(
+            $this->_pageGateway
+        );
+        $nav  = $sideNav->getNavigation();
+        $html = $this->_arrayToListHTML($nav);
+        return ($html) ? $html : '';
     }
 
-        private function _getArrayToListNav($catid)
+    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();
-        $html = $this->_arrayToListHTML($nav, 0, "mainNav");
+        $newNav = array();
+        foreach ($nav as $key => $item) {
+            if (in_array($item['id'], $mainNavArray)) {
+                $key = array_search($item['id'], $mainNavArray);
+                if ($key !== false) {
+                    $item['class'] = $key;
+                }
+                $newNav[] = $item;
+            }
+        }
+//        echo '<pre>'.print_r($newNav, true).'</pre>';exit;
+        $html = $this->_arrayToListHTML($newNav, 0, 'left');
         return ($html) ? $html : '';
     }
 
@@ -588,17 +606,27 @@ class Toolkit_Page
             return;
         }
         $tabs = str_repeat($tab, $level * 2);
-        $mainClass = ($level == 0 && $className) ? ' class="'.$className.'"': '';
+        $mainClass = ($level == 0 && $className)
+            ? ' class="'.$className.'"'
+            : ' class="dropdown"';
         $result = "{$tabs}<ul{$mainClass}>\n";
         foreach ($array as $i => $node) {
-            $class
-                = ($node['class'] == 'current')
-                ? ' class="'.$node['class'].'"'
-                : '';
-            $parent
-                = ($node['class'] == 'parent')
-                ? ' class="'.$node['class'].'"'
-                : '';
+            $classes = array();
+//            $class
+//                = ($node['class'] == 'current')
+//                ? ' class="'.$node['class'].'"'
+//                : '';
+            if ($node['class']) {
+                $classes[] = $node['class'];
+            }
+            if (!empty($node['pages'])) {
+                $classes[] = 'has-dropdown';
+            }
+            $parent = ' class="'.implode(' ', $classes).'"';
+//            $parent
+//                = ($node['class'] == 'parent')
+//                ? ' class="'.$node['class'].'"'
+//                : ' class="not-click"';
             $link = sprintf(
                 $format,
                 $node['uri'],
index 151b9d7..a4f7c66 100644 (file)
@@ -54,6 +54,15 @@ if (!isset($DEBUG)) {
 }
 $securePagesArray = array();
 define('SECURE_PAGES', serialize($securePagesArray));
+$mainNavigationUl = array(
+    'activities'  => 2,
+    'attractions' => 7,
+    'lodging'     => 13,
+    'restaurants' => 14,
+    'shopping'    => 15,
+    'calendar'    => 16
+);
+define('MAIN_LEVEL_NAV_ARRAY', serialize($mainNavigationUl));
 $nonMobilePagesArray = array();
 define('NON_MOBILE_PAGES', serialize($nonMobilePagesArray));
 /**
index 8826cab..8f2e941 100644 (file)
@@ -62,7 +62,8 @@
                 </li>
               </ul>
               <section class="top-bar-section">
-                <ul class="left">
+                  {mainNavigationUl:h}
+<!--                <ul class="left">
                   <li class="not-click activities">
                     <a href="/activities">Activities</a>
                   </li>
@@ -88,7 +89,7 @@
                   <li class="not-click calendar">
                     <a href="/calendar">Calendar</a>
                   </li>
-                </ul>
+                </ul>-->
               </section>
             </nav>
             <!-- Off-canvas menu -->