$maxSequence ) { $maxSequence = $monitors[$i]['Sequence']; } $monitors[$i]['zmc'] = zmcStatus( $monitors[$i] ); $monitors[$i]['zma'] = zmaStatus( $monitors[$i] ); $monitors[$i]['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitors[$i]['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" => $monitors[$i]['Id'] ) ); parseFilter( $filter ); $counts[] = "count(if(1".$filter['sql'].",1,NULL)) as EventCount$j"; $monitors[$i]['eventCounts'][$j]['filter'] = $filter; } $sql = "select ".join($counts,", ")." from Events as E where MonitorId = ?"; $counts = dbFetchOne( $sql, NULL, array($monitors[$i]['Id']) ); if ( $monitors[$i]['Function'] != 'None' ) { $cycleCount++; $scaleWidth = reScale( $monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); $scaleHeight = reScale( $monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth; if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight; } if ( $counts ) $monitors[$i] = array_merge( $monitors[$i], $counts ); $displayMonitors[] = $monitors[$i]; } $cycleWidth = $maxWidth; $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':''; ?>