-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
collapsible-stats.php
52 lines (47 loc) · 1.55 KB
/
collapsible-stats.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<div data-role="collapsible" data-collapsed="false">
<h3>Statistics</h3>
<?php
function print_item($it)
{
// must be re-inizialized because $node IS NOT local variabile?!!?! a sort of static or global
$node = true;
$node = split(': ', $it, 3);
echo '<tr><td>' . $node[0] . '</td><th>' . $node[1] . $node[2] . '</th></tr>';
}
function print_folder($key, &$arr)
{
echo '<div data-role="collapsible">';
echo "<h3>" . $key . "</h3>";
// child of folder (first sub-level)
foreach ($arr as $k => $v) {
if (count(&$v)) print_folder($k, $v);
else {
echo '<table class="last-column-right">';
print_item($k);
echo '</table>';
}
}
echo '</div>';
}
function recursiveViewOnStatsTree(&$tree, $nodeName)
{
foreach ($tree as $k => $v) {
if (count(&$v)) print_folder($k, $v);
else {
echo '<table class="last-column-right">';
print_item($k);
echo '</table>';
}
}
}
$statsTree = amule_load_vars("stats_tree");
recursiveViewOnStatsTree($statsTree, $HTTP_GET_VARS['statsnode']);
?>
</div>
<br/>
<div style="text-align:center;">
<div data-role="controlgroup" data-type="horizontal">
<a href="#page-collapsible-stats" class="hash-link" data-role="button">collapsible</a>
<a href="#page-listed-stats" class="hash-link" data-role="button">listed</a>
</div>
</div>