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'] ) ) { diff --git a/web/skins/classic/views/console.php b/web/skins/classic/views/console.php index c2f3daa9b..293f31f88 100644 --- a/web/skins/classic/views/console.php +++ b/web/skins/classic/views/console.php @@ -85,7 +85,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']) ); @@ -98,9 +99,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']; }