addTerm(array('attr' => 'Monitor', 'op' => 'IN', 'val' => implode(',', $_REQUEST['MonitorId']), 'cnj' => 'and')); } if (isset($_REQUEST['GroupId'])) { $monitor_ids = []; foreach ($_REQUEST['GroupId'] as $group_id) { $group = ZM\Group::find_one(['Id'=>$group_id]); if ($group) { $monitor_ids += $group->MonitorIds(); $exportFileName .= ' '.$group->Name(); } } $filter->addTerm(array('attr' => 'Monitor', 'op' => 'IN', 'val' => implode(',', $monitor_ids), 'cnj' => 'and')); } if (isset($_REQUEST['minTimeSecs'])) { } if (isset($_REQUEST['maxTimeSecs'])) { } if (isset($_REQUEST['minTime'])) { $filter->addTerm(array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'cnj' => 'and')); $exportFileName .= ' '.$_REQUEST['minTime']; } if (isset($_REQUEST['maxTime'])) { $filter->addTerm(array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and')); $exportFileName .= ' '.$_REQUEST['maxTime']; } } $total_size = 0; if ($filter and !$eids) { # Handles montageReview filter $eventsSql = 'SELECT E.Id, E.DiskSpace FROM Events AS E WHERE '; $eventsSql .= $filter->sql(); $results = dbQuery($eventsSql); while ($event_row = dbFetchNext($results)) { array_push($eids, $event_row['Id']); $total_size += $event_row['DiskSpace']; } if (!count($eids)) { ZM\Error("No events found for download using $eventsSql"); } } $exportFormat = ''; if ( isset($_REQUEST['exportFormat']) ) { if ( !in_array($_REQUEST['exportFormat'], array('zip', 'tar')) ) { ZM\Error('Invalid exportFormat: '.$_REQUEST['exportFormat']); } else { $exportFormat = $_REQUEST['exportFormat']; } } $focusWindow = true; $connkey = isset($_REQUEST['connkey']) ? validInt($_REQUEST['connkey']) : generateConnKey(); if ($exportFileName == 'zmDownload') $exportFileName .= '-'.$connkey; ?>