File:
0.02.50a/server/web/summary.test.php (
View as Code)
1: 2: /* -------------------------------------------------------------
3: This file is part of FreeNATS
4:
5: FreeNATS is (C) Copyright 2008 PurplePixie Systems
6:
7: FreeNATS is free software: you can redistribute it and/or modify
8: it under the terms of the GNU General Public License as published by
9: the Free Software Foundation, either version 3 of the License, or
10: (at your option) any later version.
11:
12: FreeNATS is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with FreeNATS. If not, see www.gnu.org/licenses
19:
20: For more information see www.purplepixie.org/freenats
21: -------------------------------------------------------------- */
22:
23: ob_start();
24: require("include.php");
25: $NATS->Start();
26: if (!$NATS_Session->Check($NATS->DB))
27: {
28: header("Location: ./?login_msg=Invalid+Or+Expired+Session");
29: exit();
30: }
31: if ($NATS_Session->userlevel<1) UL_Error("View Test Summary");
32:
33: if (isset($_REQUEST['nodeid'])) $nodeid=$_REQUEST['nodeid'];
34: else $nodeid="";
35:
36:
37: Screen_Header("Summary for ".$nodeid,1);
38: ob_end_flush();
39:
40: $td_day=date("d");
41: $td_mon=date("m");
42: $td_yr=date("Y");
43:
44: function gtinfo($testid)
45: {
46: global $NATS;
47: $o="Error fetching test";
48: if ($testid[0]=="L")
49: { // local test
50: $q="SELECT testtype,testparam FROM fnlocaltest WHERE localtestid=".ss(substr($testid,1,128));
51: $r=$NATS->DB->Query($q);
52: if ($row=$NATS->DB->Fetch_Array($r))
53: {
54: $o=lText($row['testtype']);
55: if ($row['testparam']!="") $o.=" (".$row['testparam'].")";
56: $u=lUnit($row['testtype']);
57: if ($u!="") $o.=" (".$u.")";
58: }
59: else $o="Error fetching test";
60: }
61:
62: return $o;
63: }
64:
65: if (isset($_REQUEST['startx'])) $startx=$_REQUEST['startx'];
66: else $startx=mktime(0,0,0,$td_mon,$td_day,$td_yr);
67: if (isset($_REQUEST['finishx'])) $finishx=$_REQUEST['finishx'];
68: else $finishx=mktime(23,59,59,$td_mon,$td_day,$td_yr);
69:
70: echo "
From ".nicedt($startx)." to ".nicedt($finishx)."
";
71:
72: if ($nodeid=="*")
73: {
74: //
75: $q="SELECT testid,nodeid FROM fnrecord WHERE recordx>=".ss($startx)." AND recordx<=".ss($finishx);
76: $q.=" GROUP BY testid ORDER BY nodeid";
77: }
78: else
79: {
80: $q="SELECT testid,nodeid FROM fnrecord WHERE nodeid=\"".ss($nodeid)."\" AND recordx>=".ss($startx)." AND recordx<=".ss($finishx);
81: $q.=" GROUP BY testid";
82: }
83: $r=$NATS->DB->Query($q);
84:
85:
86: $name="";
87: $first=true;
88:
89: while ($row=$NATS->DB->Fetch_Array($r))
90: {
91: if ($name!=$row['nodeid'])
92: {
93: if ($first) $first=false;
94: else echo "
";
95: echo "Node: ".$row['nodeid']."
";
96: $name=$row['nodeid'];
97: }
98: echo "".gtinfo($row['testid'])." on ".$row['nodeid']."
";
99: //echo "img src=\"test.graph.php?testid=".$row['testid']."&startx=".$startx."&finishx=".$finishx."\"
";
100: echo "";
101: echo "";
102: echo "";
103: echo "
";
104: }
105:
106: $NATS->DB->Free($r);
107:
108: Screen_Footer();
109: ?>
110: