ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/graphs/graphs.php
Revision: 1.9
Committed: Sat Jun 30 12:12:47 2007 UTC (17 years, 5 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +3 -3 lines
Log Message:
More short tag fixes.

File Contents

# User Rev Content
1 tdb 1.1 <?php
2    
3 tdb 1.2 #
4     # i-scream central monitoring system
5 tdb 1.4 # http://www.i-scream.org
6 tdb 1.2 # Copyright (C) 2000-2002 i-scream
7     #
8     # This program is free software; you can redistribute it and/or
9     # modify it under the terms of the GNU General Public License
10     # as published by the Free Software Foundation; either version 2
11     # of the License, or (at your option) any later version.
12     #
13     # This program is distributed in the hope that it will be useful,
14     # but WITHOUT ANY WARRANTY; without even the implied warranty of
15     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     # GNU General Public License for more details.
17     #
18     # You should have received a copy of the GNU General Public License
19     # along with this program; if not, write to the Free Software
20     # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21     #
22    
23 tdb 1.1 # Navigation for the i-scream graphs
24 tdb 1.4 # tim@i-scream.org
25 tdb 1.1 #
26     # CONFIGURABLE CONSTANTS: -
27    
28     include("graphs_config.inc.php");
29    
30     #
31     # END CONFIGURATION
32    
33    
34     include("iutils.inc.php");
35    
36 tdb 1.5 if ($formMethod == "GET") {
37 tdb 1.6 $machine_name = isset($_GET['machine_name']) ? $_GET['machine_name'] : "";
38     $graph = isset($_GET['graph']) ? $_GET['graph'] : "";
39     $submit = isset($_GET['submit']) ? $_GET['submit'] : "";
40 tdb 1.7 $PHP_SELF = isset($_GET['PHP_SELF']) ? $_GET['PHP_SELF'] : "";
41 tdb 1.5 }
42    
43 tdb 1.7 $file_array = getdirArray($imgdir,'asort');
44    
45 tdb 1.1 ?>
46    
47 tdb 1.8 <?php include($titleHTML); ?>
48 tdb 1.1
49 tdb 1.8 <hr weight="1" color="<?php echo $lineColor ?>">
50 tdb 1.1
51     <b>Graphs available for these machines:</b>
52    
53 tdb 1.8 <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
54 tdb 1.1 <select size="1" name="machine_name">
55 tdb 1.8 <?php if ($machine_name) { ?>
56     <option selected value="<?php echo $machine_name ?>"><?php echo $machine_name ?></option>
57 tdb 1.1 <option value="">----------------</option>
58 tdb 1.8 <?php } else { ?>
59 tdb 1.1 <option selected value="">[select machine]</option>
60 tdb 1.8 <?php } ?>
61     <?php
62 tdb 1.1 foreach($file_array as $file_name) {
63     if(is_dir("$imgdir/$file_name")) { ?>
64 tdb 1.8 <option value="<?php echo $file_name ?>"><?php echo $file_name ?></option>
65     <?php }
66 tdb 1.1 }
67     ?>
68     </select>
69    
70     <input type="submit" name="submit" value="Go">
71     </form>
72    
73 tdb 1.8 <hr weight="1" color="<?php echo $lineColor ?>">
74 tdb 1.1
75 tdb 1.8 <?php if ($machine_name) { ?>
76 tdb 1.1
77 tdb 1.8 <b>Available graphs for <?php echo $machine_name ?></b>
78 tdb 1.1
79 tdb 1.8 <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
80 tdb 1.1 <select size="1" name="graph">
81 tdb 1.8 <?php if ($graph) { ?>
82     <option selected value="<?php echo $graph ?>"><?php echo tidyName($machine_name, $graph) ?></option>
83 tdb 1.1 <option value="">----------------</option>
84 tdb 1.8 <?php } else { ?>
85 tdb 1.1 <option selected value="">[select graph]</option>
86 tdb 1.8 <?php } ?>
87 tdb 1.7 <option value="ALL">ALL</option>
88 tdb 1.8 <?php
89 tdb 1.1 $file_array = getdirArray("$imgdir/$machine_name",'asort');
90     foreach($file_array as $file_name) {
91     if(preg_match("/^(\S+)\-3h.png$/", $file_name, $matches)) { ?>
92 tdb 1.8 <option value="<?php echo $matches[1] ?>"><?php echo tidyName($machine_name, $matches[1]) ?></option>
93     <?php }
94 tdb 1.1 }
95     ?>
96     </select>
97    
98 tdb 1.8 <input type="hidden" name="machine_name" value="<?php echo $machine_name ?>">
99 tdb 1.1 <input type="submit" name="submit" value="Show">
100     </form>
101    
102 tdb 1.8 <hr weight="1" color="<?php echo $lineColor ?>">
103 tdb 1.1
104 tdb 1.8 <?php } ?>
105 tdb 1.1
106     </p>
107    
108    
109 tdb 1.8 <?php
110 tdb 1.1 if ($submit == "Show" && $machine_name && $graph) {
111 tdb 1.7 if ($graph == "ALL") {
112     ?>
113 tdb 1.8 <center><b>[<?php echo $machine_name; ?>] - All graphs</b></center>
114 tdb 1.7
115     <center>
116 tdb 1.8 <?php
117 tdb 1.7 foreach($file_array as $file_name) {
118     if(preg_match("/^(\S+)\-3h.png$/", $file_name, $matches)) { ?>
119 tdb 1.8 <p><b><?php echo tidyName($machine_name, $matches[1]) ?>:</b><br>
120 tdb 1.9 <a href="<?php echo $PHP_SELF.'?'.'graph='.$matches[1].'&machine_name='.$machine_name.'&submit=Show'?>">
121 tdb 1.8 <img border="0" src="<?php echo "$imgwebdir/$machine_name/$matches[1]-3h.png" ?>"></a></p>
122     <?php }
123 tdb 1.7 }
124     ?>
125     </center>
126 tdb 1.8 <?php
127 tdb 1.7 } else { // if graph== All
128 tdb 1.1 ?>
129 tdb 1.8 <center><b>[<?php echo $machine_name; ?>] - '<?php echo tidyName($machine_name, $graph) ?>' graphs</b></center>
130 tdb 1.1
131     <center>
132 tdb 1.8 <p><b>Last 3 hours :</b><br><img border="0" src="<?php echo "$imgwebdir/$machine_name/$graph-3h.png" ?>"></p>
133     <p><b>Last day :</b><br><img border="0" src="<?php echo "$imgwebdir/$machine_name/$graph-1d.png" ?>"></p>
134     <p><b>Last week :</b><br><img border="0" src="<?php echo "$imgwebdir/$machine_name/$graph-1w.png" ?>"></p>
135     <p><b>Last month :</b><br><img border="0" src="<?php echo "$imgwebdir/$machine_name/$graph-1m.png" ?>"></p>
136     <p><b>Last year :</b><br><img border="0" src="<?php echo "$imgwebdir/$machine_name/$graph-1y.png" ?>"></p>
137 tdb 1.1 </center>
138 tdb 1.8 <?php } /* if graph == All */ ?>
139     <hr weight="1" color="<?php echo $lineColor ?>">
140 tdb 1.1
141     <b>Latest data</b>
142     <p>
143     Latest set of data received from
144 tdb 1.9 <a href="<?php echo "latest.php?machine=$machine_name"; ?>"><?php echo $machine_name?></a>
145 tdb 1.1 <br>
146 tdb 1.9 Alerts for <a href="alerts.php?machine=<?php echo $machine_name?>"><?php echo $machine_name?></a>
147 tdb 1.1
148    
149 tdb 1.8 <hr weight="1" color="<?php echo $lineColor ?>">
150     <?php } // if show, machine and graph
151 tdb 1.1 ?>
152    
153 tdb 1.8 <?php include($bottomHTML); ?>