From f8d7f9906d7cf05feb83f52f9a781aa7bfe9d96a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 May 2016 15:44:23 -0400 Subject: [PATCH 1/2] fixup merging of Event data into the monitor array --- web/skins/classic/views/console.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index 9a8f1c085..e4fe736d2 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -82,7 +82,8 @@ $displayMonitors = NULL; $navbar = getNavBarHTML(); $zoneCount = 0; -foreach( $displayMonitors as $monitor ) { +for( $i = 0; $i < count($displayMonitors); $i += 1 ) { { + $monitor = $displayMonitors[$i]; $monitor['zmc'] = zmcStatus( $monitor ); $monitor['zma'] = zmaStatus( $monitor ); $monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) ); @@ -95,9 +96,9 @@ 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]; + if ( $counts ) $displayMonitors[$i] = array_merge( $monitor, $counts ); + for ( $i = 0; $j < count($eventCounts); $j++ ) { + $eventCounts[$j]['total'] += $monitor['EventCount'.$j]; } $zoneCount += $monitor['ZoneCount']; } @@ -167,9 +168,7 @@ for ( $i = 0; $i < count($eventCounts); $i++ ) From daf10c1b848601dc3c12f0f57564619720c3c230 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 May 2016 15:44:35 -0400 Subject: [PATCH 2/2] make displayMonitors global --- web/skins/classic/includes/functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 236714f20..242f9a6dd 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -152,6 +152,7 @@ function getNavBarHTML() { # Used to determine if the Cycle button should be made available $cycleCount = 0; $monitors = dbFetchAll( "select * from Monitors order by Sequence asc" ); + global $displayMonitors; $displayMonitors = array(); for ( $i = 0; $i < count($monitors); $i++ ) { if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {