0) left join settings_tree on (graph_tree_items.id=settings_tree.graph_tree_item_id and settings_tree.user_id=$user_id) $sql_join where graph_tree_items.graph_tree_id=$tree_id and graph_tree_items.order_key like '$search_key%' $sql_where order by graph_tree_items.order_key"); print "\n"; print ""; print ""; $i = 0; /* loop through each tree item */ if (sizeof($heirarchy) > 0) { foreach ($heirarchy as $leaf) { /* find out how 'deep' this item is */ $tier = tree_tier($leaf["order_key"], 2); /* find the type of the current and next branch */ $current_leaf_type = $leaf["title"] ? "heading" : "graph"; $next_leaf_type = (isset($heirarchy{$i+1})) ? ($heirarchy{$i+1}["title"] ? "heading" : "graph") : ""; if (($current_leaf_type == 'heading') && (($tier <= $hide_until_tier) || ($hide_until_tier == false))) { /* start the nested table for the heading */ print "\n"; $graph_ct = 0; }elseif (($current_leaf_type == 'graph') && (($tier <= $hide_until_tier) || ($hide_until_tier == false))) { $graph_ct++; /* start the nested table for the graph group */ if ($already_open == false) { print "\n"; $already_open = false; } } /* if we have come back to the tier that was origionally flagged, then take away the flag */ if (($tier <= $hide_until_tier) && ($hide_until_tier != false)) { $hide_until_tier = false; } /* if we are supposed to hide this branch, flag it */ if ($leaf["status"] == "1") { $hide_until_tier = $tier; } $i++; } } print "
[root] - " . db_fetch_cell("select name from graph_tree where id=" . $_SESSION["sess_view_tree_id"]) . "
\n"; /* draw one vbar for each tier */ for ($j=0;($j<($tier-1));$j++) { print "\n"; } /* draw the '+' or '-' icons if configured to do so */ if (($options["use_expand_contract"]) && (!empty($leaf["title"]))) { if ($leaf["status"] == "1") { $other_status = '0'; $ec_icon = 'show'; }else{ $other_status = '1'; $ec_icon = 'hide'; } print "\n"; }elseif (!($options["use_expand_contract"]) && (!empty($leaf["title"]))) { print "\n"; } /* draw the actual cell containing the header */ if (!empty($leaf["title"])) { print "\n"; } /* end the nested table for the heading */ print "
$indent " . $leaf["title"] . " 
\n"; /* draw one vbar for each tier */ for ($j=0;($j<($tier-1));$j++) { print "\n"; } print ""; print "
\n"; $already_open = true; } /* print out the actual graph html */ print "\n"; /* if we are at the end of a row, start a new one */ if ($graph_ct % read_graph_config_option("num_columns") == 0) { print "\n"; } /* if we are at the end of the graph group, end the nested table */ if ($next_leaf_type != "graph") { print "
" . $leaf["graph_title"] . "
"; } function grow_edit_graph_tree($tree_id, $user_id, $options) { global $config, $colors; include_once($config["include_path"] . "/form.php"); include_once($config["include_path"] . "/tree_functions.php"); $tree = db_fetch_assoc("select graph_tree_items.id, graph_tree_items.title, graph_tree_items.local_graph_id, graph_tree_items.order_key, graph_templates_graph.title_cache as graph_title from graph_tree_items left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0) where graph_tree_items.graph_tree_id=$tree_id order by graph_tree_items.order_key"); print "\n"; ## Here we go. Starting the main tree drawing loop. $i = 0; if (sizeof($tree) > 0) { foreach ($tree as $leaf) { $tier = tree_tier($leaf["order_key"], 2); $transparent_indent = " "; if ($i % 2 == 0) { $row_color = $colors["form_alternate1"]; }else{ $row_color = $colors["form_alternate2"]; } $i++; if ($leaf["title"] == "") { print "$transparent_indent" . $leaf["graph_title"] . "\n"; print "Graph"; }else{ print "$transparent_indent" . $leaf["title"] . " (Add)\n"; print "Heading"; } print "\n Move Down\n Move Up\n \n"; print "\n Delete \n \n"; } } } function grow_dropdown_tree($tree_id, $form_name, $selected_tree_item_id) { global $colors, $config; include_once ($config["include_path"] . "/tree_functions.php"); $tree = db_fetch_assoc("select graph_tree_items.id, graph_tree_items.title, graph_tree_items.order_key from graph_tree_items where graph_tree_items.graph_tree_id=$tree_id and graph_tree_items.title != '' order by graph_tree_items.order_key"); print "\n"; } ?>