[PHPLIB-DEV] cvs commit From: ssilk (phplib-dev <email protected>)
Date: 03/06/00

From: ssilk
Date: Tue Mar 7 00:49:10 2000
Modified files:
      php-lib/php/menu.inc

Log message:
This is a patch for displaying subtrees of a menu without a link. I introduced
it, cause I need it.
The same patch should now be in menu2.inc - perhaps we should use it in
the future.

Index: php-lib/php/menu.inc
diff -u php-lib/php/menu.inc:1.8 php-lib/php/menu.inc:1.9
--- php-lib/php/menu.inc:1.8 Sun Dec 12 17:29:53 1999
+++ php-lib/php/menu.inc Tue Mar 7 00:48:39 2000
@@ -5,7 +5,7 @@
  * Copyright (c) 1999 NetUSE GmbH
  * Kristian Koehntopp
  *
- * $Id: menu.inc,v 1.8 1999/12/12 16:29:53 padraic Exp $
+ * $Id: menu.inc,v 1.9 2000/03/06 23:48:39 ssilk Exp $
  *
  */
 class Menu {
@@ -89,17 +89,23 @@
   function get_cell($n, $level, $class = "") {
     $bold = ($this->visible[$n] == $this->map);
     for ($i=1; $i<$level; $i++)
- $dent .= "&nbsp;";
-
- $str = sprintf("%s<a href=\"%s\"%s>%s%s%s</a><br>\n",
- $dent,
- $this->item[$this->visible[$n]]["url"],
- $class?" class=$class":"",
- $bold?"<b>":"",
- $this->item[$this->visible[$n]]["title"],
- $bold?"</b>":""
- );
-
+ $dent .= "&nbsp;&nbsp;";
+
+ if ($this->item[$this->visible[$n]]["pseudo"]) {
+ $str=sprintf("%s%s<br>\n",
+ $dent,
+ $this->item[$this->visible[$n]]["title"]
+ );
+ } else {
+ $str = sprintf("%s<a href=\"%s\"%s>%s%s%s</a><br>\n",
+ $dent,
+ $this->item[$this->visible[$n]]["url"],
+ $class?" class=$class":"",
+ $bold? '<B><FONT COLOR="#990000">[':"",
+ $this->item[$this->visible[$n]]["title"],
+ $bold? "]</FONT></B>":""
+ );
+ }
     return $str;
   }
 
@@ -168,13 +174,20 @@
     # at each level, add current children to visible
     $len = count($r);
     $this->visible= array();
-
+
+
     for ($i=0; $i<$len; $i++) {
       # if current level has children, add them...
- if (is_array($this->children[$r[$i]])) {
+ if (is_array($this->children[$r[$i]]) ) {
         reset($this->children[$r[$i]]);
- while(list($k, $v) = each($this->children[$r[$i]]))
+ while(list($k, $v) = each($this->children[$r[$i]])) {
           $this->visible[] = $v;
+ if (isset($this->item[$v][pseudo]) &&
+ !ereg("^$v",$this->map))
+ while (list(,$w) = each($this->item[$v][pseudo])) {
+ $this->visible[]=$w;
+ }
+ }
       }
     }
     

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.