function reset_session_variables($pre_tree) { /* get the current settings */ $i = 0; if (sizeof($pre_tree)) { foreach ($pre_tree as $leaf) { $tier = tree_tier($leaf["order_key"]); $tier_string = tree_tier_string($leaf["order_key"]); $variable = "sess_tree_leaf_expand_" . $leaf["graph_tree_id"] . "_" . $tier_string; if (isset($_SESSION[$variable])) { $pre_tree[$i]["visibility"] = $_SESSION[$variable]; unset($_SESSION[$variable]); } else { $pre_tree[$i]["visibility"] = true; } $i++; } foreach ($pre_tree as $leaf) { $new_leaf = db_fetch_row("SELECT * FROM graph_tree_items WHERE id='" . $leaf['id'] . "'"); $tier = tree_tier($new_leaf["order_key"]); $tier_string = tree_tier_string($new_leaf["order_key"]); $variable = "sess_tree_leaf_expand_" . $new_leaf["graph_tree_id"] . "_" . $tier_string; $_SESSION[$variable] = $leaf["visibility"]; } } }
function get_icon($graph_tree_id, $order_key) { $variable = "sess_tree_leaf_expand_" . $graph_tree_id . "_" . tree_tier_string($order_key); if (isset($_SESSION[$variable])) { if ($_SESSION[$variable]) { $icon = "images/hide.gif"; } else { $icon = "images/show.gif"; } } else { $icon = "images/hide.gif"; } return $icon; }