'.PHP_EOL;
$Event = new ZM\Event($eid);
if ( !$Event->Id() ) {
ZM\Error('Invalid event id');
$result .= '
Invalid event id
'.PHP_EOL;
} else {
$result .= 'Downloading event ' . $Event->Id . '. Resulting file should be approximately ' . human_filesize( $Event->DiskSpace() ).PHP_EOL;
}
} else if ( !empty($eids) ) {
$total_size = 0;
foreach ( $eids as $eid ) {
if ( !validInt($eid) ) {
ZM\Warning("Invalid event id in eids[] $eid");
continue;
}
$Event = new ZM\Event($eid);
$total_size += $Event->DiskSpace();
$result .= ''.PHP_EOL;
}
unset($eid);
$result .= 'Downloading ' . count($eids) . ' events. Resulting file should be approximately ' . human_filesize($total_size).PHP_EOL;
} else {
$result .= 'There are no events found. Resulting download will be empty.
';
}
return $result;
}
if ( !canView('Events') ) {
$view = 'error';
return;
}
$eid = isset($_REQUEST['eid']) ? $_REQUEST['eid'] : '';
$eids = isset($_REQUEST['eids']) ? $_REQUEST['eids'] : array();
$generated = isset($_REQUEST['generated']) ? $_REQUEST['generated'] : '';
$total_size = 0;
if ( isset($_SESSION['montageReviewFilter']) and !$eids ) {
# Handles montageReview filter
$eventsSql = 'SELECT E.Id, E.DiskSpace FROM Events AS E WHERE 1';
$eventsSql .= $_SESSION['montageReviewFilter']['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");
}
#session_start();
#unset($_SESSION['montageReviewFilter']);
#session_write_close();
#} else {
#Debug("NO montageReviewFilter");
}
$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();
?>