3 /**************************************************************************
4 ** (c) Copyright 2003, Andromeda Technology & Automation
5 ** This is free software; you can redistribute it and/or modify it under the
6 ** terms of the GNU General Public License, see the file COPYING.
7 ***************************************************************************
8 ** MODULE INFORMATION *
9 ***********************
10 ** FILE NAME : parameter.php
11 ** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
12 ** VERSION NUMBER : $Revision: 1.6 $
19 ***************************************************************************
20 ** ADMINISTRATIVE INFORMATION *
21 ********************************
22 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
23 ** CREATION DATE : Dec 04, 2002
24 ** LAST UPDATE : Aug 04, 2003
26 **************************************************************************/
28 /*****************************
29 $Log: parameter.php,v $
30 Revision 1.6 2003-08-14 10:33:01 arjen
31 Added performance measurement.
33 Revision 1.5 2003/07/15 11:06:45 arjen
34 Removed parameters are displayed in a shaded style.
36 Revision 1.4 2003/02/21 08:50:12 arjen
37 Database optimizations.
39 Revision 1.3 2003/02/13 09:01:29 arjen
40 All web interface pages use the page class.
42 Revision 1.2 2003/02/05 09:47:39 arjen
43 Display the difference of all package class parameters for two objects
45 ******************************/
47 // RCSID = "$Id: parameter.php,v 1.6 2003-08-14 10:33:01 arjen Exp $";
50 ini_set('include_path', '.:./classes:../phpclasses');
52 require_once('page.class.php');
57 function getmicrotime()
59 list ($usec, $sec) = explode(" ", microtime());
60 return (float)$sec + (float)$usec;
63 function object_selection($db, $skip_oid)
65 /* Create and print an HTML option list of objects */
67 $res = pg_exec("SELECT objectid, objectname FROM object WHERE objectid != "
68 . $skip_oid . "ORDER BY objectname");
69 for ($row = 0; $row < pg_numrows($res); $row++)
71 $obj = pg_fetch_object($res, $row);
72 echo "<option value='" . $obj->objectid . "'>";
73 echo $obj->objectname;
78 class param_page extends page
84 if (!empty($_GET['oid']))
86 $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=CAST('" . $_GET['oid']."' AS BIGINT)");
87 $obj = pg_fetch_object($res, 0);
88 echo "<h1>Parameters for " . $obj->objectname . "</h1>";
90 $res = pg_exec($this->database, "SELECT paramid, class, name, description FROM parameter "
91 ."WHERE objectid= CAST('" . $_GET['oid'] . "' AS BIGINT) order by class, name");
94 <form action='parameter_compare.php' method='post'>
95 <input type='hidden' name='oid' value='<?php echo $_GET['oid'] ?>'>
97 <select name='compare_to'>
98 <?php object_selection($this->database, $_GET['oid']); ?>
100 <input type='hidden' name='class' value='package'>
101 <input type='submit' value=' Show Difference'>
107 $start_time = getmicrotime();
108 while ($row < pg_numrows($res))
110 $par = pg_fetch_object($res, $row);
111 $qry ="select change_nature from history where paramid= CAST('";
112 $qry .= $par->paramid . "' AS BIGINT) order by modified desc";
113 $rhist = pg_exec($this->database, $qry);
114 $hist = pg_fetch_object($rhist, 0);
115 if ($hist->change_nature != "REMOVED")
118 <tr><td align='center'>
119 <?php echo $par->class?>
121 <?php echo $par->name?>
123 <?php echo $par->description?>
126 $r = pg_exec($this->database, "SELECT name, value FROM property
127 WHERE paramid=CAST('" . $par->paramid . "' AS BIGINT)");
128 for ($p = 0; $p < pg_numrows($r); $p++)
130 $prop = pg_fetch_object($r, $p);
131 echo $prop->name . "=" . $prop->value . " ";
140 $duration = getmicrotime() - $start_time;
142 echo "$row parameters in " . round($duration, 3) . " seconds (";
143 echo round($duration / $row * 1000, 3) . " milliseconds per parameter).<br>";
148 $page = new param_page("Gnucomo Parameters");