2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web frames view file, $Date$, $Revision$
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2016-12-26 23:23:16 +08:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
|
2018-11-15 04:54:45 +08:00
|
|
|
if ( !canView('Events') ) {
|
2017-07-06 22:50:07 +08:00
|
|
|
$view = 'error';
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2019-06-17 00:02:00 +08:00
|
|
|
|
2018-11-15 04:54:45 +08:00
|
|
|
require_once('includes/Frame.php');
|
2019-07-08 04:10:53 +08:00
|
|
|
$eid = validInt($_REQUEST['eid']);
|
|
|
|
$Event = new ZM\Event($eid);
|
|
|
|
$Monitor = $Event->Monitor();
|
2019-06-17 00:02:00 +08:00
|
|
|
|
|
|
|
$countSql = 'SELECT COUNT(*) AS FrameCount FROM Frames AS F WHERE 1 ';
|
|
|
|
$frameSql = 'SELECT *, unix_timestamp( TimeStamp ) AS UnixTimeStamp FROM Frames AS F WHERE 1 ';
|
|
|
|
|
|
|
|
// override the sort_field handling in parseSort for frames
|
|
|
|
if ( empty($_REQUEST['sort_field']) )
|
|
|
|
$_REQUEST['sort_field'] = 'FramesTimeStamp';
|
|
|
|
|
|
|
|
if ( !isset($_REQUEST['sort_asc']) )
|
|
|
|
$_REQUEST['sort_asc'] = true;
|
|
|
|
|
2019-08-09 01:34:28 +08:00
|
|
|
if ( ! isset($_REQUEST['filter'])){
|
2019-06-17 00:02:00 +08:00
|
|
|
// generate a dummy filter from the eid for pagination
|
|
|
|
$_REQUEST['filter'] = array('Query' => array( 'terms' => array( ) ) );
|
|
|
|
$_REQUEST['filter'] = addFilterTerm(
|
|
|
|
$_REQUEST['filter'],
|
|
|
|
0,
|
|
|
|
array( 'cnj' => 'and', 'attr' => 'FramesEventId', 'op' => '=', 'val' => $eid )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
parseSort();
|
|
|
|
parseFilter($_REQUEST['filter']);
|
|
|
|
$filterQuery = $_REQUEST['filter']['query'];
|
|
|
|
|
|
|
|
if ( $_REQUEST['filter']['sql'] ) {
|
|
|
|
$countSql .= $_REQUEST['filter']['sql'];
|
|
|
|
$frameSql .= $_REQUEST['filter']['sql'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$frameSql .= " ORDER BY $sortColumn $sortOrder,Id $sortOrder";
|
|
|
|
|
2019-05-25 03:06:37 +08:00
|
|
|
if ( isset( $_REQUEST['scale'] ) ) {
|
|
|
|
$scale = validNum($_REQUEST['scale']);
|
|
|
|
} else if ( isset( $_COOKIE['zmWatchScale'.$Monitor->Id()] ) ) {
|
|
|
|
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
|
|
|
|
} else if ( isset( $_COOKIE['zmWatchScale'] ) ) {
|
|
|
|
$scale = validNum($_COOKIE['zmWatchScale']);
|
|
|
|
} else {
|
2019-06-07 01:49:24 +08:00
|
|
|
$scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
|
2019-05-25 03:06:37 +08:00
|
|
|
}
|
2019-06-17 00:02:00 +08:00
|
|
|
|
|
|
|
$page = isset($_REQUEST['page']) ? validInt($_REQUEST['page']) : 1;
|
|
|
|
$limit = isset($_REQUEST['limit']) ? validInt($_REQUEST['limit']) : 0;
|
|
|
|
|
2019-08-09 01:34:28 +08:00
|
|
|
$nFrames = dbFetchOne($countSql, 'FrameCount');
|
2019-06-17 00:02:00 +08:00
|
|
|
|
2019-07-08 04:03:54 +08:00
|
|
|
if ( !empty($limit) && ($nFrames > $limit) ) {
|
|
|
|
$nFrames = $limit;
|
2019-06-17 00:02:00 +08:00
|
|
|
}
|
|
|
|
|
2019-07-08 04:03:54 +08:00
|
|
|
$pages = (int)ceil($nFrames/ZM_WEB_EVENTS_PER_PAGE);
|
2019-06-17 00:02:00 +08:00
|
|
|
|
|
|
|
if ( !empty($page) ) {
|
2019-07-08 04:03:54 +08:00
|
|
|
if ( $page <= 0 )
|
2019-06-17 00:02:00 +08:00
|
|
|
$page = 1;
|
|
|
|
else if ( $pages and ( $page > $pages ) )
|
|
|
|
$page = $pages;
|
|
|
|
|
|
|
|
$limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE);
|
2019-07-08 04:03:54 +08:00
|
|
|
if ( empty($limit) ) {
|
2019-06-17 00:02:00 +08:00
|
|
|
$limitAmount = ZM_WEB_EVENTS_PER_PAGE;
|
|
|
|
} else {
|
|
|
|
$limitLeft = $limit - $limitStart;
|
|
|
|
$limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft;
|
|
|
|
}
|
|
|
|
$frameSql .= " limit $limitStart, $limitAmount";
|
|
|
|
} elseif ( !empty($limit) ) {
|
|
|
|
$frameSql .= ' limit 0, '.$limit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$maxShortcuts = 5;
|
2019-09-25 22:35:41 +08:00
|
|
|
$totalQuery = $sortQuery.'&eid='.$eid.$limitQuery.$filterQuery;
|
|
|
|
$pagination = getPagination($pages, $page, $maxShortcuts, $totalQuery);
|
2019-06-17 00:02:00 +08:00
|
|
|
|
2019-07-08 04:03:54 +08:00
|
|
|
$frames = dbFetchAll($frameSql);
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2019-06-07 01:49:24 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id());
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
2019-01-16 22:59:58 +08:00
|
|
|
<div id="headerButtons"><a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a></div>
|
2016-11-22 01:28:15 +08:00
|
|
|
<h2><?php echo translate('Frames') ?> - <?php echo $Event->Id() ?></h2>
|
2019-06-17 00:02:00 +08:00
|
|
|
<div id="pagination">
|
|
|
|
<?php
|
|
|
|
if ( $pagination ) {
|
|
|
|
?>
|
|
|
|
<h2 class="pagination"><?php echo $pagination ?></h2>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php
|
|
|
|
if ( $pages > 1 ) {
|
|
|
|
if ( !empty($page) ) {
|
|
|
|
?>
|
2019-09-25 22:35:41 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&page=0<?php echo $totalQuery ?>"><?php echo translate('ViewAll') ?></a>
|
2019-06-17 00:02:00 +08:00
|
|
|
<?php
|
|
|
|
} else {
|
|
|
|
?>
|
2019-09-25 22:35:41 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&page=1<?php echo $totalQuery ?>"><?php echo translate('ViewPaged') ?></a>
|
2019-06-17 00:02:00 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
2019-02-10 13:39:19 +08:00
|
|
|
<form name="contentForm" id="contentForm" method="get" action="?">
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="view" value="none"/>
|
|
|
|
<table id="contentTable" class="major" cellspacing="0">
|
2019-06-17 00:02:00 +08:00
|
|
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
|
|
|
<input type="hidden" name="action" value=""/>
|
|
|
|
<input type="hidden" name="page" value="<?php echo $page ?>"/>
|
|
|
|
<input type="hidden" name="eid" value="<?php echo $eid ?>"/>
|
|
|
|
<?php echo $_REQUEST['filter']['fields'] ?>
|
|
|
|
<input type="hidden" name="sort_field" value="<?php echo validHtmlStr($_REQUEST['sort_field']) ?>"/>
|
|
|
|
<input type="hidden" name="sort_asc" value="<?php echo validHtmlStr($_REQUEST['sort_asc']) ?>"/>
|
|
|
|
<input type="hidden" name="limit" value="<?php echo $limit ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2019-06-17 00:02:00 +08:00
|
|
|
<th class="colId"><a href="<?php echo sortHeader('FramesFrameId') ?>"><?php echo translate('Frame Id') ?><?php echo sortTag('FramesFrameId') ?></a></th>
|
|
|
|
<th class="colType"><a href="<?php echo sortHeader('FramesType') ?>"><?php echo translate('Type') ?><?php echo sortTag('FramesType') ?></a></th>
|
|
|
|
<th class="colTimeStamp"><a href="<?php echo sortHeader('FramesTimeStamp') ?>"><?php echo translate('TimeStamp') ?><?php echo sortTag('FramesTimeStamp') ?></a></th>
|
|
|
|
<th class="colTimeDelta"><a href="<?php echo sortHeader('FramesDelta') ?>"><?php echo translate('TimeDelta') ?><?php echo sortTag('FramesDelta') ?></a></th>
|
|
|
|
<th class="colScore"><a href="<?php echo sortHeader('FramesScore') ?>"><?php echo translate('Score') ?><?php echo sortTag('FramesScore') ?></a></th>
|
2016-11-22 01:28:15 +08:00
|
|
|
<?php
|
|
|
|
if ( ZM_WEB_LIST_THUMBS ) {
|
|
|
|
?>
|
|
|
|
<th class="colThumbnail"><?php echo translate('Thumbnail') ?></th>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
2016-11-22 01:28:15 +08:00
|
|
|
if ( count($frames) ) {
|
2017-07-06 22:50:07 +08:00
|
|
|
foreach ( $frames as $frame ) {
|
2019-05-25 03:06:37 +08:00
|
|
|
$Frame = new ZM\Frame($frame);
|
2016-11-22 01:28:15 +08:00
|
|
|
|
2017-07-06 22:50:07 +08:00
|
|
|
$class = strtolower($frame['Type']);
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<tr class="<?php echo $class ?>">
|
2019-05-25 03:06:37 +08:00
|
|
|
<td class="colId"><?php echo makePopupLink(
|
|
|
|
'?view=frame&eid='.$Event->Id().'&fid='.$frame['FrameId'], 'zmImage',
|
|
|
|
array(
|
|
|
|
'frame',
|
|
|
|
($scale ? $Event->Width()*$scale/100 : $Event->Width()),
|
|
|
|
($scale ? $Event->Height()*$scale/100 : $Event->Height())
|
|
|
|
),
|
|
|
|
$frame['FrameId'])
|
|
|
|
?></td>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td class="colType"><?php echo $frame['Type'] ?></td>
|
2019-06-07 01:49:24 +08:00
|
|
|
<td class="colTimeStamp"><?php echo strftime(STRF_FMT_TIME, $frame['UnixTimeStamp']) ?></td>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td class="colTimeDelta"><?php echo number_format( $frame['Delta'], 2 ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-07-06 22:50:07 +08:00
|
|
|
if ( ZM_RECORD_EVENT_STATS && ($frame['Type'] == 'Alarm') ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-06-07 01:49:24 +08:00
|
|
|
<td class="colScore"><?php echo makePopupLink('?view=stats&eid='.$Event->Id().'&fid='.$frame['FrameId'], 'zmStats', 'stats', $frame['Score']) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-07-06 22:50:07 +08:00
|
|
|
} else {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td class="colScore"><?php echo $frame['Score'] ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2017-07-06 22:50:07 +08:00
|
|
|
}
|
|
|
|
if ( ZM_WEB_LIST_THUMBS ) {
|
2016-11-22 01:28:15 +08:00
|
|
|
?>
|
2019-06-07 01:49:24 +08:00
|
|
|
<td class="colThumbnail"><?php echo makePopupLink( '?view=frame&eid='.$Event->Id().'&fid='.$frame['FrameId'], 'zmImage', array('image', $Event->Width(), $Event->Height()), '<img src="?view=image&fid='.$Frame->Id().'&'.
|
2016-11-22 01:28:15 +08:00
|
|
|
(ZM_WEB_LIST_THUMB_WIDTH?'width='.ZM_WEB_LIST_THUMB_WIDTH.'&':'').
|
|
|
|
(ZM_WEB_LIST_THUMB_HEIGHT?'height='.ZM_WEB_LIST_THUMB_HEIGHT.'&':'').'filename='.$Event->MonitorId().'_'.$frame['EventId'].'_'.$frame['FrameId'].'.jpg" '.
|
|
|
|
(ZM_WEB_LIST_THUMB_WIDTH?'width="'.ZM_WEB_LIST_THUMB_WIDTH.'" ':'').
|
2017-04-13 04:16:56 +08:00
|
|
|
(ZM_WEB_LIST_THUMB_HEIGHT?'height="'.ZM_WEB_LIST_THUMB_HEIGHT.'" ':'').' alt="'.$frame['FrameId'].'"/>' ) ?></td>
|
2016-11-22 01:28:15 +08:00
|
|
|
<?php
|
2017-07-06 22:50:07 +08:00
|
|
|
}
|
2016-11-22 01:28:15 +08:00
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2017-07-06 22:50:07 +08:00
|
|
|
} // end foreach frame
|
2017-04-13 04:16:56 +08:00
|
|
|
} else {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<td colspan="5"><?php echo translate('NoFramesRecorded') ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2019-06-17 00:02:00 +08:00
|
|
|
|
|
|
|
<?php
|
|
|
|
if ( $pagination ) {
|
|
|
|
?>
|
|
|
|
<h3 class="pagination"><?php echo $pagination ?></h3>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="contentButtons">
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|