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.7 $
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.7 2003-12-03 08:03:28 arjen
31 Optionally show or hide removed parameters from the parameter
34 Revision 1.6 2003/08/14 10:33:01 arjen
35 Added performance measurement.
37 Revision 1.5 2003/07/15 11:06:45 arjen
38 Removed parameters are displayed in a shaded style.
40 Revision 1.4 2003/02/21 08:50:12 arjen
41 Database optimizations.
43 Revision 1.3 2003/02/13 09:01:29 arjen
44 All web interface pages use the page class.
46 Revision 1.2 2003/02/05 09:47:39 arjen
47 Display the difference of all package class parameters for two objects
49 ******************************/
51 // RCSID = "$Id: parameter.php,v 1.7 2003-12-03 08:03:28 arjen Exp $";
54 ini_set('include_path', '.:./classes:../phpclasses');
56 require_once('page.class.php');
61 function getmicrotime()
63 list ($usec, $sec) = explode(" ", microtime());
64 return (float)$sec + (float)$usec;
67 function object_selection($db, $skip_oid)
69 /* Create and print an HTML option list of objects */
71 $res = pg_exec("SELECT objectid, objectname FROM object WHERE objectid != "
72 . $skip_oid . "ORDER BY objectname");
73 for ($row = 0; $row < pg_numrows($res); $row++)
75 $obj = pg_fetch_object($res, $row);
76 echo "<option value='" . $obj->objectid . "'>";
77 echo $obj->objectname;
82 class param_page extends page
88 if (!empty($_GET['oid']))
90 $res = pg_exec($this->database, "SELECT objectname FROM object WHERE objectid=CAST('" . $_GET['oid']."' AS BIGINT)");
91 $obj = pg_fetch_object($res, 0);
92 echo "<h1>Parameters for " . $obj->objectname . "</h1>";
94 $res = pg_exec($this->database, "SELECT paramid, class, name, description FROM parameter "
95 ."WHERE objectid= CAST('" . $_GET['oid'] . "' AS BIGINT) order by class, name");
98 <form action='parameter_compare.php' method='post'>
99 <input type='hidden' name='oid' value='<?php echo $_GET['oid'] ?>'>
101 <select name='compare_to'>
102 <?php object_selection($this->database, $_GET['oid']); ?>
104 <input type='hidden' name='class' value='package'>
105 <input type='checkbox' name='show_removed' value='on'>Show removed parameters
106 <input type='submit' value=' Show Difference'>
112 $start_time = getmicrotime();
113 while ($row < pg_numrows($res))
115 $par = pg_fetch_object($res, $row);
116 $qry ="select change_nature from history where paramid= CAST('";
117 $qry .= $par->paramid . "' AS BIGINT) order by modified desc";
118 $rhist = pg_exec($this->database, $qry);
119 $hist = pg_fetch_object($rhist, 0);
120 if ($hist->change_nature != "REMOVED")
123 <tr><td align='center'>
124 <?php echo $par->class?>
126 <?php echo $par->name?>
128 <?php echo $par->description?>
131 $r = pg_exec($this->database, "SELECT name, value FROM property
132 WHERE paramid=CAST('" . $par->paramid . "' AS BIGINT)");
133 for ($p = 0; $p < pg_numrows($r); $p++)
135 $prop = pg_fetch_object($r, $p);
136 echo $prop->name . "=" . $prop->value . " ";
145 $duration = getmicrotime() - $start_time;
147 echo "$row parameters in " . round($duration, 3) . " seconds (";
148 echo round($duration / $row * 1000, 3) . " milliseconds per parameter).<br>";
153 $page = new param_page("Gnucomo Parameters");