for main nav
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 8 Feb 2010 18:06:13 +0000 (18:06 +0000)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 8 Feb 2010 18:06:13 +0000 (18:06 +0000)
classes/class_template.inc

index 4458341..a2a4d4f 100644 (file)
@@ -999,18 +999,22 @@ class GLM_TEMPLATE
        //      }}}
        //      {{{ get_main_nav()
 
-       function get_main_nav()
+       function get_main_nav($topParent)
        {
                $query = "select id,category
                        from bus_category
                        where parent = 0
-                       and id not in (".HOME_ID.",".MEMBERS_CATEGORY.",7,8,9)
+                       and id not in (".HOME_ID.",".MEMBERS_CATEGORY.")
                        and active = 't'
                        order by pos";
                if ($data = $this->DB->pgsql_select( $query ) ){
-                       $out = '<ul id="nav">';
+                       $out = '<ul>';
                        foreach( $data as $row ){
-                               $out .= '<li><a href="'.$this->get_seo_url( $row['id'] ).'">'.$row['category'].'</a></li>';
+                $out .= '<li><a ';
+                if ($row['id'] == $topParent) {
+                    $out .= ' class="active"';
+                }
+                $out .= 'href="'.$this->get_seo_url( $row['id'] ).'">'.$row['category'].'</a></li>';
                        }
                        $out .= '</ul>';
                }
@@ -1665,20 +1669,24 @@ class GLM_TEMPLATE
                     $isPage  = $this->catid == $row['id'];
 
                     if ($hasSubs && ($isSubId || $isPage)) {
-                        $ret2 = $this->make_ul_menu($row['id']);
+                        $ret2 = $this->get_side_nav($row['id']);
                         $return .= $ret2;
                     }
                     $return .= '</li>';
                 }
                 $main_cats = $this->get_main_cats();
-                if ($main_cats[$parent]) {
-                    $return = '<h2>'.$this->get_catheader($parent, &$this->DB).'</h2>
-                    <ul>'.$return.'</ul>';
-                    $this->cache->save($return, $this->catid, 'Nav');
-                    return $return;
+                if ($return) {
+                    if ($main_cats[$parent]) {
+                        $return = '
+                        <ul id="sublevel">'.$return.'</ul>';
+                        $this->cache->save($return, $this->catid, 'Nav');
+                        return $return;
+                    } else {
+                        $return = "\n<ul>$return</ul>\n";
+                        return $return;
+                    }
                 } else {
-                    $return = "\n<ul>$return</ul>\n";
-                    return $return;
+                    return false;
                 }
             }
         }