.
[corvix.git] / var / deb-package / cluster_raw_old / opt / cluster / lib / www / ganglia / grid_tree.php
blob7cc557a73f2062595cc256259abf4c4cb97ccd45
1 <?php
2 /* $Id: grid_tree.php 589 2005-10-10 07:42:26Z knobi1 $ */
3 $tpl = new TemplatePower( template("grid_tree.tpl") );
4 $tpl->prepare();
6 $tpl->assign("self", "$self");
8 # Not as complicated as before. No depth-first-search, and
9 # we only show our immediate children.
11 # Publish past grids in our stack.
12 $ancestors = $gridstack;
13 # Take ourself off the end of the stack.
14 array_pop($ancestors);
16 if (count($ancestors)) {
17 $tpl->newBlock("parentgrid");
18 $parentgridtable = "";
20 $parentgridstack = array();
21 foreach ($ancestors as $g) {
22 list($name, $link) = explode("@", $g);
23 $parentgridstack[] = $g;
24 $parentgridstack_url = rawurlencode(join(">", $parentgridstack));
25 $parentgridtable .= "<tr><td align=center class=grid>".
26 "<a href=\"$link?t=yes&amp;gw=back&amp;gs=$parentgridstack_url\">$name</a></td></tr>\n";
29 $tpl->assign("parents", $parentgridtable);
30 $tpl->gotoBlock("_ROOT");
33 $gridtable="";
35 # Publish our children.
36 if ($n = count($grid))
38 $tpl->assign("n", $n);
39 foreach ($grid as $source => $attrs)
41 if ($source == $self) continue;
43 if (isset($grid[$source]['GRID']) and $grid[$source]['GRID'])
45 # This child is a grid.
46 $url = $grid[$source]['AUTHORITY'] . "?t=yes&amp;gw=fwd&amp;gs=$gridstack_url";
47 $gridtable .= "<td class=grid><a href=\"$url\">$source</a></td>";
49 else
51 # A cluster.
52 $url = "./?c=". rawurlencode($source) ."&amp;$get_metric_string";
53 $gridtable .= "<td><a href=\"$url\">$source</a></td>";
56 $gridtable .= "</tr></table>";
59 $tpl->assign("children", $gridtable);
62 $tpl->printToScreen();