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()) ?> ()

DefaultVideo() ) { // videojs zoomrotate only when direct recording $Zoom = 1; $Rotation = 0; $Monitor = $event->Monitor(); if ( $Monitor->VideoWriter() == '2' ) { # Passthrough $Rotation = $event->Orientation(); if ( in_array($event->Orientation(),array('90','270')) ) $Zoom = $event->Height()/$event->Width(); } ?>

 
 

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)); ?>

All

SaveJPEGs() ) { ?>
"; echo '

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

'; foreach ( $eids as $eid ) { if ( $eventMonitorId[$eid] == $monitor ) { ?>
'; } # end foreach monitor ?>
Path(); $eventRelativePath = $event->Relative_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] = $event->Id().'/'.$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] = $event->Id().'/'.$file; } if ( $exportImages ) { $filesLeft = array(); $myfilelist = array(); foreach ( $files as $file ) { if ( preg_match('/-(?:capture|analyse).jpg$/', $file ) ) { $myfilelist[$file] = $exportFileList[$file] = $event->Id().'/'.$file; } else { $filesLeft[$file] = $file; } } $files = $filesLeft; // create an image slider if ( !empty($myfilelist) ) { $file = $event->Id().'/zmEventImages.html'; if ( !($fp = fopen($file, 'w')) ) Fatal("Can't open event images export file '$file'"); fwrite($fp, exportEventImages($event, $exportDetail, $exportFrames, $myfilelist)); fclose($fp); $exportFileList[$file] = $event->Id().'/'.$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] = $event->Id().'/'.$file; } else { $filesLeft[$file] = $file; } } $files = $filesLeft; } # end if exportVideo if ( $exportMisc ) { foreach ( $files as $file ) { $exportFileList[$file] = $event->Id().'/'.$file; } $files = array(); } return array_values($exportFileList); } # end exportFileList() function exportEvents( $eids, $connkey, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc, $exportFormat, $exportCompressed, $exportStructure = false ) { if ( !canView('Events') ) { Error("You do not have permission to view events."); return false; } else if ( empty($eids) ) { Error("Attempt to export an empty list of events."); return false; } # Ensure that we are going to be able to do this. if ( ! file_exists(ZM_DIR_EXPORTS) ) { if ( ! mkdir(ZM_DIR_EXPORTS) ) { Fatal("Can't create exports dir at '".ZM_DIR_EXPORTS."'"); } } $export_dir = ZM_DIR_EXPORTS.'/zmExport_'.$connkey; # Ensure that we are going to be able to do this. if ( ! file_exists($export_dir) ) { if ( ! mkdir($export_dir) ) { Fatal("Can't create exports dir at '$export_dir'"); } else { Logger::Debug("Successfully created dir '$export_dir'"); } } if ( !chdir($export_dir) ) Fatal("Can't chdir to $export_dir"); $export_root = 'zmExport'; $export_listFile = 'zmFileList.txt'; $exportFileList = array(); $html_eventMaster = ''; if ( !is_array($eids) ) { $eids = array($eids); } foreach ( $eids as $eid ) { $event = new Event($eid); $event_dir = $export_dir.'/'.$event->Id(); if ( !mkdir($event_dir) ) Error("Can't mkdir $event_dir"); $event_exportFileList = exportFileList($event, $exportDetail, $exportFrames, $exportImages, $exportVideo, $exportMisc); $exportFileList = array_merge($exportFileList,$event_exportFileList); foreach ( $event_exportFileList as $file ) { if ( preg_match('/\.html$/', $file ) ) continue; Logger::Debug('cp -as '.$event->Path().'/../'.$file.' '.$export_dir.'/'.$file); exec('cp -as '.$event->Path().'/../'.$file.' '.$export_dir.'/'.$file); } } // create an master image if ( $exportImages ) { if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/jquery.js', $export_dir.'/jquery.js') ) Error("Failed linking jquery.js"); //if ( !symlink(ZM_PATH_WEB.'/'.ZM_SKIN_PATH.'/js/video.js', $export_dir.'/video.js') ) //Error("Failed linking video.js"); $html_eventMaster_file = 'zmEventImagesMaster_'.date('Ymd_His'). '.html'; $html_eventMaster_path = $export_dir.'/'.$html_eventMaster_file; if ( ($fp = fopen($html_eventMaster_path, 'w')) ) { fwrite($fp, exportEventImagesMaster($eids)); fclose($fp); $exportFileList[] = $html_eventMaster_file; } else { Error("Can't open event images export file '$html_eventMaster_path'"); } } $listFile = $export_dir.'/'.$export_listFile; if ( !($fp = fopen($listFile, 'w')) ) { Fatal("Can't open event export list file '$listFile'"); } foreach ( $exportFileList as $exportFile ) { $exportFile = 'zmExport'.$connkey.'/'.$exportFile; fwrite($fp, "$exportFile\n"); } fwrite($fp, "$listFile\n"); fclose($fp); chdir(ZM_DIR_EXPORTS); $archive = ''; if ( $exportFormat == 'tar' ) { $archive = ZM_DIR_EXPORTS.'/'.$export_root.($connkey?'_'.$connkey:'').'.tar'; $command = 'tar --create --dereference'; if ( $exportCompressed ) { $archive .= '.gz'; $command .= ' --gzip'; $exportFormat .= '.gz'; } if ( $exportStructure == 'flat' ) { //strip file paths if we $command .= " --xform='s#^.+/##x'"; } $command .= ' --file='.escapeshellarg($archive); } elseif ( $exportFormat == 'zip' ) { $archive = ZM_DIR_EXPORTS.'/'.$export_root.($connkey?'_'.$connkey:'').'.zip'; $command = 'zip '; $command = ($exportStructure == 'flat' ? ' -j ' : ' -r ' ).escapeshellarg($archive); $command .= $exportCompressed ? ' -9' : ' -0'; } else { Error("No exportFormat specified."); return false; } // if $exportFormat @unlink($archive); $command .= ' zmExport_' . $connkey.'/'; Logger::Debug("Command is $command"); exec($command, $output, $status); if ( $status ) { Error("Command '$command' returned with status $status"); if ( isset($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.'%26connkey='.$connkey; }