[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/media/includes/classes
From:       Christoph Cullmann <crossfire () babylon2k ! de>
Date:       2004-02-28 22:26:30
Message-ID: 20040228222630.A02C2996F () office ! kde ! org
[Download RAW message or body]

CVS commit by cullmann: 

keep track which section is active, this will make it possible to show only the menu \
part of this section later if wanted (for example interesting for developer.kde.org)


  M +30 -0     class_menu.inc   1.11


--- www/media/includes/classes/class_menu.inc  #1.10:1.11
@@ -48,4 +48,25 @@
     }
   }
+  
+  /**
+   * Return the current active section of the menu
+   * default to the first section in the menu if no other marked active
+   * this is the case for the index.php for example !
+   */
+  function activeSection ()
+  {
+    for($i=0; $i < count($this->items); $i++)
+    {
+      if ($this->items[$i]->active)
+        return $i;
+    }
+    
+    return 0;
+  }
+  
+  function activeSectionName ()
+  {
+    return $this->items[$this->activeSection()]->name;
+  }
 
   function showLocation ()
@@ -72,4 +93,5 @@
   var $items = array();
   var $current_relativeurl;
+  var $active = false;
 
   function MenuSection ($menu_root, $menu_baseurl, $current_relativeurl, $name, $id \
= "") @@ -88,4 +110,8 @@
   {
     $item = new MenuItem ($this->menu_root, $this->menu_baseurl, \
$this->current_relativeurl, $name, $file, $relative_link); +    
+    if ($item->active)
+      $this->active = true;
+    
     array_push($this->items,$item);
 
@@ -96,4 +122,8 @@
   {
     $menu = new Menu ($this->menu_root, $this->menu_baseurl, \
$this->current_relativeurl, $name, $dir); +    
+    if ($menu->active)
+      $this->active = true;
+    
     array_push($this->items,$menu);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic