X-Git-Url: http://www.andromeda.nl/gitweb/?a=blobdiff_plain;f=src%2Fweb%2Fobjects.php;h=7222e7b2f489a19b182836019df3d82064ebc56b;hb=8a1c181490f98b6697f6d589935413af64f118cb;hp=e322a04d50c221ce07a1b0ed79dfe67195fc7080;hpb=5093910be5d37164158f5ce7cf62b36ca4f38866;p=gnucomo.git diff --git a/src/web/objects.php b/src/web/objects.php index e322a04..7222e7b 100644 --- a/src/web/objects.php +++ b/src/web/objects.php @@ -1,4 +1,4 @@ - +ini_set('include_path', '.:./classes:../phpclasses'); - - - - - -GNUCoMo login +require_once('page.class.php'); + +function clientscripts() +{ +?> - - Objects Administration
"; - $config = new gnucomo_config; + var $nr_parameters, $removed_parameters; + var $nr_notifications, $closed_notifications; + var $nr_logs; + + function GatherStatistics($objectid) + { + // Gather statistics on parameters + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='parameters'"); + $stat = pg_fetch_object($r, 0); + $this->nr_parameters = $stat->statvalue; + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='removed_parameters'"); + $stat = pg_fetch_object($r, 0); + $this->removed_parameters = $stat->statvalue; + + // Gather statistics on notifications + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='notifications'"); + $stat = pg_fetch_object($r, 0); + $this->nr_notifications = $stat->statvalue; + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='closed_notifications'"); + $stat = pg_fetch_object($r, 0); + $this->closed_notifications = $stat->statvalue; + + // Gather statistics on log entries + + $r = pg_exec ($this->database, "SELECT statvalue FROM object_statistics WHERE objectid=CAST('" + . $objectid . "' AS BIGINT) AND statname='logs'"); + $stat = pg_fetch_object($r, 0); + $this->nr_logs = $stat->statvalue; - $config->read("gnucomo"); + } - // Connect to the database - $conn = pg_connect($config->Database($_SESSION['username'], $_SESSION['password'])); + function Body() + { + clientscripts(); + echo "

Objects Administration


"; if (isset($_POST['action']) && $_POST['action'] == 'Create' && !empty($_POST['objectname'])) { - pg_exec($conn, "INSERT INTO object (objectname) VALUES ('" - . $_POST['objectname'] . "')"); + pg_exec($this->database, "INSERT INTO object (objectname, log_count, parameter_count, notification_count) + VALUES ('" . $_POST['objectname'] . "', '0', '0', '0')"); } if (isset($_POST['action']) && $_POST['action'] == 'Remove' && !empty($_POST['objectname'])) { - pg_exec($conn, "DELETE FROM object WHERE objectname='" . $_POST['objectname'] . "'"); + pg_exec($this->database, "DELETE FROM object WHERE objectname='" . $_POST['objectname'] . "'"); } - $res = pg_exec($conn, "SELECT objectid,objectname FROM object"); + $res = pg_exec($this->database, "SELECT objectid,objectname, log_count, notification_count + FROM object ORDER BY objectname"); +?> + + + + + - echo "
ObjectLog entriesParametersNotifications
"; +objectid . "'"); - $r = pg_fetch_object($r, 0); - $nr_logs = $r->count; - $count_logs = $count_logs + $nr_logs; + $this->GatherStatistics($u->objectid); - $r = pg_exec ($conn, "SELECT count(paramid) FROM parameter WHERE objectid='" - . $u->objectid . "'"); - $r = pg_fetch_object($r, 0); + $count_parameters += $this->nr_parameters; + $removed_parameters += $this->removed_parameters; + $count_logs = $count_logs + $this->nr_logs; - $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; + //$nr_notifications = $u->notification_count; + $count_notifications += $this->nr_notifications; + $closed_notifications += $this->closed_notifications; ?> - "; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo "

- objectname ?> -
- Log entries - - Parameters - - Notifications +

+ objectname ?>
+
+ objectid'> $this->nr_logs " ?> + + objectid'>" . $this->nr_parameters + . " (" . $this->removed_parameters . " removed)" ?> + + objectid'>" . $this->nr_notifications . " (" . $this->closed_notifications . " closed)" ?>
@@ -153,25 +198,33 @@ else


TOTALS
$count_logs Log entries$count_parameters Parameters$count_notifications Notifications


TOTALS
$count_logs$count_parameters ($removed_parameters removed)$count_notifications ($closed_notifications closed)
"; -} ?>

Create new object:

-Objects name (FQDN): +Object's name (FQDN):

- - +Showpage(); + +?> +