Id() ); $otherlinks = ''; if( $exportFrames ) $otherlinks .= ''.translate('Frames').','; if( $exportImages ) $otherlinks .= ''.translate('Images').','; $otherlinks = substr($otherlinks,0,-1); ?>

: Name()) ?> ()

Id() ?>
Name()) ?>
MonitorName()) ?> (MonitorId() ?>)
Cause()) ?>
Notes()) ?>
StartTime()) ) ?>
Length() ?>
Frames() ?>
AlarmFrames() ?>
TotScore() ?>
AvgScore() ?>
MaxScore() ?>
Archived()?translate('Yes'):translate('No') ?>
Id() ) ); ob_start(); exportHeader( translate('Frames')." ".$event->Id() ); $otherlinks = ''; if( $exportDetail ) $otherlinks .= ''.translate('Event').','; if( $exportImages ) $otherlinks .= ''.translate('Images').','; $otherlinks = substr($otherlinks,0,-1); ?>

: Name()) ?> ()

Path(); foreach ( $frames as $frame ) { $imageFile = sprintf( "%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $frame['FrameId'] ); $imagePath = $eventPath."/".$imageFile; $analImage = preg_replace( "/capture/", "analyse", $imagePath ); if ( file_exists( $analImage ) ) { $imageFile = preg_replace( "/capture/", "analyse", $imageFile ); } $class = strtolower($frame['Type']); ?>
Frame <?php echo $frame['FrameId'] ?>
Id() ); $otherlinks = ''; if( $exportDetail ) $otherlinks .= ''.translate('Event').','; if( $exportFrames ) $otherlinks .= ''.translate('Frames').','; $otherlinks = substr($otherlinks,0,-1); $filelist = array_keys($myfilelist); sort($filelist,SORT_NUMERIC); $slides = '"'.implode('","',$filelist).'"'; $listcount = count($filelist); ?>

: Name()) ?> ()


 
 

Master

MonitorId(); $eventPath[$eid] = $event->Relative_Path(); } $monitors = array_values(array_flip(array_flip($eventMonitorId))); //unique monitors and reindex the array $monitorNames = array(); //* if(!empty($monitors)) { $tmp = dbFetchAll("SELECT Id,Name FROM Monitors WHERE Id IN (".implode(',', $monitors).") "); foreach ( $tmp as $row ) { $monitorNames[$row['Id']] = $row['Name']; } } //*/ //trigger_error(print_r($monitorNames,1)); ?>
"; } ?>
"; echo "

Monitor: " . $monitorNames[$monitor] . "

"; foreach ($eids as $eid) { if ($eventMonitorId[$eid] == $monitor) { ?>
'; } ?>
Path(); $files = array(); if ( $dir = opendir($eventPath) ) { while ( ($file = readdir($dir)) !== false ) { if ( is_file($eventPath.'/'.$file) ) { $files[$file] = $file; } } closedir($dir); } $exportFileList = array(); if ( $exportDetail ) { $file = 'zmEventDetail.html'; if ( !($fp = fopen( $eventPath.'/'.$file, 'w' )) ) { Fatal( "Can't open event detail export file '$file'" ); } fwrite( $fp, exportEventDetail( $event, $exportFrames, $exportImages ) ); fclose( $fp ); $exportFileList[$file] = $eventPath."/".$file; } if ( $exportFrames ) { $file = 'zmEventFrames.html'; if ( !($fp = fopen( $eventPath.'/'.$file, 'w' )) ) { Fatal( "Can't open event frames export file '$file'" ); } fwrite( $fp, exportEventFrames( $event, $exportDetail, $exportImages ) ); fclose( $fp ); $exportFileList[$file] = $eventPath."/".$file; } if ( $exportImages ) { $filesLeft = array(); $myfilelist = array(); foreach ( $files as $file ) { if ( preg_match( '/-(?:capture|analyse).jpg$/', $file ) ) { $exportFileList[$file] = $eventPath."/".$file; $myfilelist[$file] = $eventPath."/".$file; } else { $filesLeft[$file] = $file; } } $files = $filesLeft; // create an image slider if ( !empty($myfilelist) ) { $file = 'zmEventImages.html'; if ( !($fp = fopen($eventPath.'/'.$file, 'w')) ) Fatal( "Can't open event images export file '$file'" ); fwrite( $fp, exportEventImages( $event, $exportDetail, $exportFrames, $myfilelist ) ); fclose( $fp ); $exportFileList[$file] = $eventPath."/".$file; } } # end if exportImages if ( $exportVideo ) { $filesLeft = array(); foreach ( $files as $file ) { if ( preg_match( '/\.(?:mpg|mpeg|mov|swf|mp4|mkv|avi|asf|3gp)$/', $file ) ) { $exportFileList[$file] = $eventPath.'/'.$file; } else { $filesLeft[$file] = $file; } } $files = $filesLeft; } # end if exportVideo if ( $exportMisc ) { foreach ( $files as $file ) { $exportFileList[$file] = $eventPath.'/'.$file; } $files = array(); } return( array_values( $exportFileList ) ); } function exportEvents( $eids, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat, $exportStructure = false ) { if ( (!canView('Events')) || empty($eids) ) { return false; } $export_root = 'zmExport'; $export_listFile = 'zmFileList.txt'; $exportFileList = array(); $html_eventMaster = ''; if ( is_array($eids) ) { foreach ( $eids as $eid ) { $exportFileList = array_merge( $exportFileList, exportFileList( $eid , $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc ) ); } } else { $eid = $eids; $exportFileList = exportFileList( $eid, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc ); } // create an master image slider if ( $exportImages ) { if ( !is_array($eids) ) { $eids = array($eids); } $monitorPath = ZM_DIR_EVENTS.'/'; $html_eventMaster = 'zmEventImagesMaster_'.date('Ymd_His'). '.html'; if ( !($fp = fopen( $monitorPath.'/'.$html_eventMaster, 'w' )) ) Fatal( "Can't open event images export file '$html_eventMaster'" ); fwrite($fp, exportEventImagesMaster($eids)); fclose($fp); $exportFileList[] = $monitorPath.'/'.$html_eventMaster; } $listFile = ZM_DIR_EXPORTS.'/'.$export_listFile; if ( !($fp = fopen($listFile, 'w')) ) { Fatal( "Can't open event export list file '$listFile'" ); } foreach ( $exportFileList as $exportFile ) { fwrite( $fp, "$exportFile\n" ); } fclose( $fp ); $archive = ''; if ( $exportFormat == 'tar' ) { $archive = ZM_DIR_EXPORTS.'/'.$export_root.'.tar.gz'; @unlink( $archive ); if ( $exportStructure == 'flat' ) { //strip file paths if we choose $command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile)." --xform='s#^.+/##x'"; } else { $command = "nice -10 tar --create --gzip --file=".escapeshellarg($archive)." --files-from=".escapeshellarg($listFile); } exec( $command, $output, $status ); if ( $status ) { Error( "Command '$command' returned with status $status" ); if ( $output[0] ) Error( "First line of output is '".$output[0]."'" ); return( false ); } } elseif ( $exportFormat == 'zip' ) { $archive = ZM_DIR_EXPORTS.'/'.$export_root.'.zip'; @unlink( $archive ); if ($exportStructure == 'flat') { $command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q -j ".escapeshellarg($archive)." -@"; } else { $command = "cat ".escapeshellarg($listFile)." | nice -10 zip -q ".escapeshellarg($archive)." -@"; } //cat zmFileList.txt | zip -q zm_export.zip -@ //-bash: zip: command not found exec( $command, $output, $status ); if ( $status ) { Error("Command '$command' returned with status $status"); if ( $output[0] ) Error("First line of output is '".$output[0]."'"); return false; } } //clean up temporary files if ( !empty($html_eventMaster) ) { unlink($monitorPath.'/'.$html_eventMaster); } return( '?view=archive%26type='.$exportFormat ); }