From 1d673a0b8c982b44eae764baf3867156f0a03135 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 May 2016 14:30:32 -0400 Subject: [PATCH] move header into a function in functions.php. Move event population into console.php --- web/skins/classic/includes/functions.php | 118 +++++++++++++++++++++++ web/skins/classic/views/console.php | 21 ++++ 2 files changed, 139 insertions(+) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 2b8c86c65..7086b8e65 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -137,4 +137,122 @@ function xhtmlHeaders( $file, $title ) + + diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index c9fc45b11..567337cbd 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -70,6 +70,27 @@ $eventCounts = array( ), ); +$displayMonitors = NULL: + +# Also populates displayMonitors +$navbar = getNavBarHTML(); + +foreach( $displayMonitors as $monitor ) + $monitor['zmc'] = zmcStatus( $monitor ); + $monitor['zma'] = zmaStatus( $monitor ); + $monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) ); + $counts = array(); + for ( $j = 0; $j < count($eventCounts); $j++ ) + { + $filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['terms']), array( "cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitor['Id'] ) ); + parseFilter( $filter ); + $counts[] = "count(if(1".$filter['sql'].",1,NULL)) as EventCount$j"; + $monitor['eventCounts'][$j]['filter'] = $filter; + } + $sql = "select ".join($counts,", ")." from Events as E where MonitorId = ?"; + $counts = dbFetchOne( $sql, NULL, array($monitor['Id']) ); + if ( $counts ) $monitor = array_merge( $monitor, $counts ); +} noCacheHeaders();