function showtree($graph, $path = '', $ancestry = '') { $i = 0; foreach ($graph as $id => $node) { $i++; $anc = "{$ancestry}/{$id}"; $open = substr($path, 0, strlen($anc)) == $anc ? 1 : 0; print "<div class=" . ($i < sizeof($graph) ? "mid" : "last") . "><nobr>"; if (sizeof($node["children"])) { print "<img id=bw{$id} src='" . ($open ? "minus.gif" : "plus.gif") . "' width=18 height=9 onclick=\"treefold('{$id}')\">"; } else { print "<img src='nochildren.gif' width=18 height=9>"; } $cur = substr($path, -strlen($id) - 1) === "/{$id}"; if ($cur) { print "<b"; } else { print "<a href='" . projurl($id) . "' target='_parent' onclick=\"return treesel('{$anc}')\""; } if ($node["status"] != 'pending') { print " class=bg{$node['status']}"; } print ">"; print htmlentities($node["name"]); if ($cur) { print "</b>"; } else { print "</a>"; } print "</nobr></div>\n"; if (sizeof($node["children"])) { print "<div id=bc{$node['id']} class=" . ($i < sizeof($graph) ? "next" : "nonext") . " style='display:" . ($open ? 'block' : 'none') . "'>\n"; showtree($node["children"], $path, $anc); print "</div>\n"; } } }
function showtree($myDoc, $tree, $depth, $idP) { global $upload; global $weights; $new_depth = $depth + 1; $offset = $new_depth * 10; $idF = 0; for ($k = 0; $k < count($tree); $k++) { $name = $tree[$k]->name; $title = $tree[$k]->title; $subtree = $tree[$k]->children; $idF++; if ($idP == '') { $id = $idF; } else { $id = $idP . "-" . $idF; } echo "<tr id='{$id}' \n class='level{$depth}' \n onmouseover=\"this.setAttribute('class','highlight')\" \n onmouseout=\"this.setAttribute('class','level{$depth}')\">\n"; if ($subtree) { echo "<td style='width: 400px; text-indent: {$offset}'>\n <span onclick=\"collapse(this);\" class='expanded'>{$title}</span></td>\n"; } else { echo "<td style='width: 400px; text-indent: {$offset}'>\n <span>{$title}</span></td>\n"; } echo "<td><div style='width: 60px; text-align: center'>\n"; //If a weighting file has been uploaded use $weights array, if not use default value 1 echo "<input type='text' \n name='{$name}' size='3' style='text-align: center' onblur='checkWeight(this)' \n value='" . (isset($weights[$name]) ? $weights[$name] : 1) . "'/>\n"; echo "</div></td>\n"; echo "</tr>\n"; if ($subtree) { showtree($myDoc, $subtree, $new_depth, $id); } } }
function showtree($myDoc, $trees, $depth, $idP, $weights) { global $id, $f; global $files; global $svg; global $is_weighted; global $skin; global $lang; $new_depth = $depth + 1; $offset = $new_depth * 10; $idF = 0; $tree = $trees[0]; for ($k = 0; $k < count($tree); $k++) { $name = $tree[$k]->name; $title = $tree[$k]->title; $subtree = $tree[$k]->children; $subtrees = array(); $idF++; if ($idP == '') { $idDOM = $idF; } else { $idDOM = $idP . "-" . $idF; } echo "<tr id='{$idDOM}' \n name='{$name}' \n class='level{$depth}' \n onmouseover=\"this.setAttribute('class','highlight')\" \n onmouseout=\"this.setAttribute('class','level{$depth}')\">\n"; if ($subtree) { echo "<td style='width: 250px; text-indent: {$offset}'>\n <span onclick=\"collapse(this);\" class='expanded'>{$title}</span>\n </td>\n"; echo "<td style='width: 30px'>"; if ($myDoc[0]->hassubelements($name) > 2) { if (!isset($s)) { echo "<a href='radar.php?lang={$lang}&" . $f . "c={$name}&svg={$svg}'><img src='skins/{$skin}/graph.png' border='' style='cursor: pointer'/></a>\n"; } } } else { echo "<td style='width: 250px; text-indent: {$offset}'>\n <span>{$title}</span>\n </td>\n"; echo "<td style='width: 30px'></td>\n"; } for ($i = 0; $i < count($trees); $i++) { $desc = addslashes($myDoc[$i]->getgeneric($name, "desc" . $trees[$i][$k]->score)); if ($desc != "") { echo "<td class='score' \n style='width: 60px; cursor:help' onmouseover=\"return escape('" . janitize($desc) . "')\">\n <div style='text-align: center'>" . $trees[$i][$k]->score . "</div></td>\n"; } else { echo "<td class='score' \n style='width: 60px; text-align: center'>\n <div style='text-align: center'>" . $trees[$i][$k]->score . "</div></td>\n"; } if (!$is_weighted) { $weights[$name] = 1; $_SESSION[$name] = $weights[$name]; } echo "<td>\n <div style='text-align: center'>" . $weights[$name] . "</div></td>\n"; echo "<td id='comment'>\n <div style='width: 300px'>" . $myDoc[$i]->getgeneric($name, "comment") . "</div></td>\n"; } echo "</tr>\n"; if ($subtree) { for ($i = 0; $i < count($trees); $i++) { $subtrees[$i] = $trees[$i][$k]->children; } showtree($myDoc, $subtrees, $new_depth, $idDOM, $weights); } } }
function showtree($parent, $depth) { global $UNTRUSTED, $mydatabase, $mypath; $query = "SELECT * \n FROM livehelp_qa \n WHERE parent=" . intval($parent) . " \n AND typeof='folder' \n ORDER by ordernum,question"; $children = $mydatabase->query($query); $spacing = $depth * 10 + 1; while ($row = $children->fetchRow(DB_FETCHMODE_ASSOC)) { if (in_array($row['recno'], $mypath)) { $opened = 1; } else { $opened = 0; } print "<tr><td NOWRAP valign=top>"; if ($UNTRUSTED['editit'] != $row['recno']) { print "<img src=images/blank.gif width={$spacing} height=2>"; if (empty($UNTRUSTED['editit'])) { print "<input type=text size=3 name=ordering__" . $row['recno'] . " value=" . $row['ordernum'] . ">"; } if ($opened == 0) { print "<img src=images/help_folder.gif width=18 height=16>"; } if ($opened == 1) { print "<img src=images/help_folder_open.gif width=18 height=16>"; } print "<A href=qa.php?current=" . $row['recno'] . ">" . $row['question'] . "</a> [<a href=qa.php?current=" . $UNTRUSTED['current'] . "&editit=" . $row['recno'] . ">Edit</a>]"; } else { print "<FORM action=qa.php method=post>"; print "<input type=hidden name=current value=" . $UNTRUSTED['current'] . ">"; print "<input type=hidden name=recno value=" . $UNTRUSTED['editit'] . ">"; print "#<input type=text name=ordernum size=4 value=\"" . $row['ordernum'] . "\"> <input type=text name=question value=\"" . $row['question'] . "\">"; print "<input type=submit name=whatdo value=UPDATE>"; print "<input type=submit name=whatdo value=REMOVE>"; print "</FORM>"; } print "</td></tr>"; if (in_array($row['recno'], $mypath)) { showtree($row['recno'], $depth + 1); } } }
function showtree($parent, $depth) { global $UNTRUSTED, $mydatabase, $mypath, $department; $query = "SELECT * \n FROM livehelp_qa \n WHERE parent=" . intval($parent) . "\n AND typeof='folder' \n ORDER by ordernum,question"; $children = $mydatabase->query($query); $spacing = $depth * 10 + 1; $children = $mydatabase->query($query); while ($row = $children->fetchRow(DB_FETCHMODE_ASSOC)) { if (in_array($row['recno'], $mypath)) { $opened = 1; } else { $opened = 0; } print "<tr><td NOWRAP valign=top>"; print "<img src=images/blank.gif width={$spacing} height=2>"; if ($opened == 0) { print "<img src=images/help_folder.gif width=18 height=16>"; } if ($opened == 1) { print "<img src=images/help_folder_open.gif width=18 height=16>"; } print "<A href=user_qa.php?department={$department}¤t=" . $row['recno'] . ">" . $row['question'] . "</a>"; print "</td></tr>"; if (in_array($row['recno'], $mypath)) { showtree($row['recno'], $depth + 1); } } }