From 829202b42a62de4a057fbec9aeef4111d535ce35 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 May 2016 14:38:08 -0400 Subject: [PATCH] move more eventcounting stuff to console.php. --- web/skins/classic/includes/functions.php | 14 -------------- web/skins/classic/views/console.php | 11 +++++++++++ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 7086b8e65..ad0e64fd5 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -177,20 +177,6 @@ $cycleHeight = $maxHeight; $eventsView = ZM_WEB_EVENTS_VIEW; $eventsWindow = 'zm'.ucfirst(ZM_WEB_EVENTS_VIEW); -$eventCount = 0; -for ( $i = 0; $i < count($eventCounts); $i++ ) -{ - $eventCounts[$i]['total'] = 0; -} -$zoneCount = 0; -foreach( $displayMonitors as $monitor ) -{ - for ( $i = 0; $i < count($eventCounts); $i++ ) - { - $eventCounts[$i]['total'] += $monitor['EventCount'.$i]; - } - $zoneCount += $monitor['ZoneCount']; -} $versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':''; diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 2d23f39a2..e7f17ee7a 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -27,6 +27,7 @@ $eventCounts = array( "terms" => array( ) ), + "total" => 0, ), array( "title" => translate('Hour'), @@ -35,6 +36,7 @@ $eventCounts = array( array( "attr" => "DateTime", "op" => ">=", "val" => "-1 hour" ), ) ), + "total" => 0, ), array( "title" => translate('Day'), @@ -43,6 +45,7 @@ $eventCounts = array( array( "attr" => "DateTime", "op" => ">=", "val" => "-1 day" ), ) ), + "total" => 0, ), array( "title" => translate('Week'), @@ -51,6 +54,7 @@ $eventCounts = array( array( "attr" => "DateTime", "op" => ">=", "val" => "-7 day" ), ) ), + "total" => 0, ), array( "title" => translate('Month'), @@ -59,6 +63,7 @@ $eventCounts = array( array( "attr" => "DateTime", "op" => ">=", "val" => "-1 month" ), ) ), + "total" => 0, ), array( "title" => translate('Archived'), @@ -67,6 +72,7 @@ $eventCounts = array( array( "attr" => "Archived", "op" => "=", "val" => "1" ), ) ), + "total" => 0, ), ); @@ -74,6 +80,7 @@ $displayMonitors = NULL; # Also populates displayMonitors $navbar = getNavBarHTML(); +$zoneCount = 0; foreach( $displayMonitors as $monitor ) { $monitor['zmc'] = zmcStatus( $monitor ); @@ -89,6 +96,10 @@ foreach( $displayMonitors as $monitor ) { $sql = "select ".join($counts,", ")." from Events as E where MonitorId = ?"; $counts = dbFetchOne( $sql, NULL, array($monitor['Id']) ); if ( $counts ) $monitor = array_merge( $monitor, $counts ); + for ( $i = 0; $i < count($eventCounts); $i++ ) { + $eventCounts[$i]['total'] += $monitor['EventCount'.$i]; + } + $zoneCount += $monitor['ZoneCount']; } noCacheHeaders();