Show the total number of Log entries, parameters and notifications
authorarjen <arjen>
Mon, 10 Feb 2003 15:42:24 +0000 (15:42 +0000)
committerarjen <arjen>
Mon, 10 Feb 2003 15:42:24 +0000 (15:42 +0000)
src/web/objects.php

index 33a90e0..e322a04 100644 (file)
@@ -9,7 +9,7 @@
 ***********************
 **      FILE NAME      : objects.php
 **      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
-**      VERSION NUMBER : $Revision: 1.2 $
+**      VERSION NUMBER : $Revision: 1.3 $
 **
 **  DESCRIPTION      : Objects Administration page.
 **                     Input parameters: action (POST) : empty, 'Create'
 
 /*****************************
    $Log: objects.php,v $
-   Revision 1.2  2003-02-05 09:48:14  arjen
+   Revision 1.3  2003-02-10 15:42:24  arjen
+   Show the total number of Log entries, parameters and notifications
+
+   Revision 1.2  2003/02/05 09:48:14  arjen
    Added display and handling of notifications
 
 ******************************/
 
-// RCSID = "$Id: objects.php,v 1.2 2003-02-05 09:48:14 arjen Exp $";
+// RCSID = "$Id: objects.php,v 1.3 2003-02-10 15:42:24 arjen Exp $";
 
 session_start();
 require_once('classes/gnucomo_config.php');
@@ -103,6 +106,12 @@ else
 
    echo "<table>";
    $obj = 0;
+
+   //The counters are set to zero
+   $count_logs = 0;
+   $count_notifications = 0;
+   $count_parameters = 0;
+
    while ($obj < pg_numrows($res))
    {
       $u = pg_fetch_object($res, $obj);
@@ -111,18 +120,21 @@ else
       $r = pg_fetch_object($r, 0);
 
       $nr_logs = $r->count;
+      $count_logs = $count_logs + $nr_logs; 
 
       $r = pg_exec ($conn, "SELECT count(paramid) FROM parameter WHERE objectid='"
                            . $u->objectid . "'");
       $r = pg_fetch_object($r, 0);
 
       $nr_params = $r->count;
+      $count_parameters = $count_parameters + $nr_params;
 
       $r = pg_exec ($conn, "SELECT count(notificationid) FROM notification WHERE objectid='"
                            . $u->objectid . "'");
       $r = pg_fetch_object($r, 0);
 
       $nr_notifications = $r->count;
+      $count_notifications = $count_notifications + $nr_notifications;
       ?>
       <tr><td align='center'><img src='server.png'><br>
              <b><?php echo $u->objectname ?></b>
@@ -141,6 +153,12 @@ else
       <?php
       $obj++;
    }
+   
+   //Show the totals
+   echo "<tr><td><strong><br><br>TOTALS</strong></td>";
+   echo "<td>$count_logs Log entries</td>";
+   echo "<td>$count_parameters Parameters</td>";
+   echo "<td>$count_notifications Notifications</td></tr>";
    echo "</table>";
 
 }