Show the total number of Log entries, parameters and notifications
[gnucomo.git] / src / web / objects.php
index 27cd03c..e322a04 100644 (file)
@@ -1,16 +1,43 @@
 <?php 
 
 /**************************************************************************
+**  (c) Copyright 2003, Andromeda Technology & Automation
 ** This is free software; you can redistribute it and/or modify it under the
 ** terms of the GNU General Public License, see the file COPYING.
-***************************************************************************/
-
-/*
- *
- * Objects Administration page.
- * Input parameters: action (POST) : empty, 'Create'
- *                   objname (POST) : name of the object to create or remove
- */
+***************************************************************************
+** MODULE INFORMATION *
+***********************
+**      FILE NAME      : objects.php
+**      SYSTEM NAME    : Gnucomo - Gnu Computer Monitoring
+**      VERSION NUMBER : $Revision: 1.3 $
+**
+**  DESCRIPTION      : Objects Administration page.
+**                     Input parameters: action (POST) : empty, 'Create'
+**                                      objname (POST) : name of the object to create or remove
+**
+**  EXPORTED OBJECTS : 
+**  LOCAL    OBJECTS : 
+**  MODULES  USED    :
+***************************************************************************
+**  ADMINISTRATIVE INFORMATION *
+********************************
+**      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
+**      CREATION DATE   : Dec 04, 2002
+**      LAST UPDATE     : Feb 03, 2003
+**      MODIFICATIONS   : 
+**************************************************************************/
+
+/*****************************
+   $Log: objects.php,v $
+   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.3 2003-02-10 15:42:24 arjen Exp $";
 
 session_start();
 require_once('classes/gnucomo_config.php');
@@ -79,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);
@@ -87,12 +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>
@@ -101,6 +143,8 @@ else
       </td><td>
           <?php echo $nr_params?> <a href='parameter.php?oid=<?php echo $u->objectid?>'>Parameters</a>
       </td><td>
+          <?php echo $nr_notifications?> <a href='notification.php?oid=<?php echo $u->objectid?>'>Notifications</a>
+      </td><td>
           <form action='objects.php' method='post' onSubmit='return CheckRemove(this)'>
               <input type='hidden' name='objectname' value='<?php echo $u->objectname ?>'>
               <input type='submit' name='action' value='Remove'>
@@ -109,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>";
 
 }