move more eventcounting stuff to console.php.

This commit is contained in:
Isaac Connor 2016-05-06 14:38:08 -04:00
parent 297f27af8c
commit 829202b42a
2 changed files with 11 additions and 14 deletions

View File

@ -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':'';

View File

@ -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();