--- nfo/php/libs/com.newsblob.phphtmllib/widgets/TreeNav.inc 2003/01/30 03:29:44 1.1
+++ nfo/php/libs/com.newsblob.phphtmllib/widgets/TreeNav.inc 2003/01/31 08:48:45 1.2
@@ -2,7 +2,7 @@
/**
* This contains the TreeNav widget
*
- * $Id: TreeNav.inc,v 1.1 2003/01/30 03:29:44 jonen Exp $
+ * $Id: TreeNav.inc,v 1.2 2003/01/31 08:48:45 jonen Exp $
*
* @author Walter A. Boring IV
* @package phpHtmlLib
@@ -49,8 +49,15 @@
}
function push_text( $text, $selected=FALSE ) {
+ if (is_array($text)) {
+ foreach($text as $value) {
+ $this->push_text($value);
+ }
+ }
+ else {
array_push($this->data, array( "type"=>"text", "text"=>$text,
"selected" => $selected ));
+ }
}
/**
@@ -71,7 +78,7 @@
$td = new TDtag;
$td->newline_after_opentag = FALSE;
- $img = html_img("/phphtmllib/widgets/images/arrow.gif", 9, 9);
+ $img = html_img("img/widgets/arrow.gif", 9, 9);
$img->set_tag_attributes( array("vspace"=>5, "hspace"=>3));
$img->indent_flag = FALSE;
$img->newline_after_opentag = FALSE;
@@ -106,7 +113,7 @@
"class" => "treenavspacer");
$td = new TDtag( $attributes );
$td->newline_after_opentag = FALSE;
- $img = html_img("/phphtmllib/widgets/images/spacer.gif", 1, 1);
+ $img = html_img("img/widgets/spacer.gif", 1, 1);
$img->indent_flag = FALSE;
$img->newline_after_opentag = FALSE;
$td->push( $img );
@@ -127,7 +134,19 @@
"class" => "treenavinnertable");
$table = new TABLEtag( $attributes );
- foreach( $this->data as $nav) {
+ $this->build_entries($this->data, $table);
+
+ return $table;
+ }
+
+ function build_entries($entries = '', &$table) {
+ if(!is_array($entries)) { $entries = $this->data; }
+ foreach( $entries as $nav) {
+ if(is_array($nav)) {
+ $this->build_entries($nav, $table);
+ }
+ else {
+ print $nav;
$img_td = $this->build_img_td();
$link_td = $this->build_link_td( $nav );
@@ -135,13 +154,11 @@
$spacer_td = $this->build_spacer_td();
$table->push_row( $spacer_td );
+ }
}
-
- return $table;
}
-
/**
* function that will render the widget.
*