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');
|
2020-08-20 02:07:51 +08:00
|
|
|
require_once('includes/Filter.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 ';
|
2020-08-20 02:07:51 +08:00
|
|
|
$frameSql = 'SELECT *, unix_timestamp(TimeStamp) AS UnixTimeStamp FROM Frames AS F WHERE 1 ';
|
2019-06-17 00:02:00 +08:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
2020-09-10 23:05:22 +08:00
|
|
|
if ( !isset($_REQUEST['filter']) ) {
|
2019-06-17 00:02:00 +08:00
|
|
|
// generate a dummy filter from the eid for pagination
|
2020-09-10 23:05:22 +08:00
|
|
|
$_REQUEST['filter'] = array('Query' => array('terms' => array()));
|
2019-06-17 00:02:00 +08:00
|
|
|
$_REQUEST['filter'] = addFilterTerm(
|
|
|
|
$_REQUEST['filter'],
|
|
|
|
0,
|
|
|
|
array( 'cnj' => 'and', 'attr' => 'FramesEventId', 'op' => '=', 'val' => $eid )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
parseSort();
|
2020-08-20 02:07:51 +08:00
|
|
|
$filter = ZM\Filter::parse($_REQUEST['filter']);
|
|
|
|
$filterQuery = $filter->querystring();
|
2019-06-17 00:02:00 +08:00
|
|
|
|
2020-08-20 02:07:51 +08:00
|
|
|
if ( $filter->sql() ) {
|
|
|
|
$countSql .= ' AND ('.$filter->sql().')';
|
|
|
|
$frameSql .= ' AND ('.$filter->sql().')';
|
2019-06-17 00:02:00 +08:00
|
|
|
}
|
|
|
|
|
2020-09-10 23:05:22 +08:00
|
|
|
$frameSql .= " ORDER BY $sortColumn $sortOrder";
|
|
|
|
if ( $sortColumn != 'Id' )
|
|
|
|
$frameSql .= ',Id '.$sortOrder;
|
2019-06-17 00:02:00 +08:00
|
|
|
|
2020-09-10 23:05:22 +08:00
|
|
|
if ( isset($_REQUEST['scale']) ) {
|
2019-05-25 03:06:37 +08:00
|
|
|
$scale = validNum($_REQUEST['scale']);
|
2020-09-10 23:05:22 +08:00
|
|
|
} else if ( isset($_COOKIE['zmWatchScale'.$Monitor->Id()]) ) {
|
2019-05-25 03:06:37 +08:00
|
|
|
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
|
2020-09-10 23:05:22 +08:00
|
|
|
} else if ( isset($_COOKIE['zmWatchScale']) ) {
|
2019-05-25 03:06:37 +08:00
|
|
|
$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;
|
|
|
|
}
|
2020-08-20 02:07:51 +08:00
|
|
|
$frameSql .= " LIMIT $limitStart, $limitAmount";
|
|
|
|
} else if ( !empty($limit) ) {
|
|
|
|
$frameSql .= ' LIMIT 0, '.$limit;
|
2019-06-17 00:02:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$maxShortcuts = 5;
|
2019-12-03 04:33:58 +08:00
|
|
|
$totalQuery = $sortQuery.'&eid='.$eid.$limitQuery.$filterQuery;
|
2019-09-25 22:35:41 +08:00
|
|
|
$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>
|
2020-08-23 01:56:31 +08:00
|
|
|
<?php echo getNavBarHTML() ?>
|
|
|
|
<div id="page" class="container-fluid p-3">
|
2020-08-20 01:04:08 +08:00
|
|
|
<!-- Toolbar button placement and styling handled by bootstrap-tables -->
|
|
|
|
<div id="toolbar">
|
2020-08-24 21:23:24 +08:00
|
|
|
<button type="button" id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
|
|
|
<button type="button" id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2020-08-20 01:04:08 +08:00
|
|
|
|
|
|
|
<!-- Table styling handled by bootstrap-tables -->
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
<table
|
|
|
|
id="framesTable"
|
|
|
|
data-pagination="true"
|
|
|
|
data-show-pagination-switch="true"
|
|
|
|
data-page-list="[10, 25, 50, 100, 200, All]"
|
|
|
|
data-search="true"
|
|
|
|
data-cookie="true"
|
|
|
|
data-cookie-id-table="zmFramesTable"
|
|
|
|
data-cookie-expire="2y"
|
|
|
|
data-remember-order="true"
|
|
|
|
data-show-columns="true"
|
2020-08-21 20:11:57 +08:00
|
|
|
data-show-export="true"
|
2020-08-20 01:04:08 +08:00
|
|
|
data-toolbar="#toolbar"
|
|
|
|
data-show-fullscreen="true"
|
|
|
|
data-maintain-meta-data="true"
|
|
|
|
data-mobile-responsive="true"
|
|
|
|
data-buttons-class="btn btn-normal"
|
2020-08-23 01:45:19 +08:00
|
|
|
data-detail-view="true"
|
|
|
|
data-detail-formatter="detailFormatter"
|
|
|
|
data-show-toggle="true"
|
2020-08-28 03:58:21 +08:00
|
|
|
data-show-jump-to="true"
|
2020-08-20 01:04:08 +08:00
|
|
|
class="table-sm table-borderless">
|
|
|
|
|
|
|
|
<thead>
|
|
|
|
<!-- Row styling is handled by bootstrap-tables -->
|
2020-08-27 20:42:39 +08:00
|
|
|
<tr>
|
|
|
|
<th class="px-3" data-align="center" data-sortable="false" data-field="EventId"><?php echo translate('EventId') ?></th>
|
2020-09-10 23:05:22 +08:00
|
|
|
<th class="px-3" data-align="center" data-sortable="true" data-field="FrameId"><?php echo translate('FrameId') ?></th>
|
|
|
|
<th class="px-3" data-align="center" data-sortable="true" data-field="FrameType"><?php echo translate('Type') ?></th>
|
|
|
|
<th class="px-3" data-align="center" data-sortable="true" data-field="FrameTimeStamp"><?php echo translate('TimeStamp') ?></th>
|
|
|
|
<th class="px-3" data-align="center" data-sortable="true" data-field="FrameDelta"><?php echo translate('TimeDelta') ?></th>
|
|
|
|
<th class="px-3" data-align="center" data-sortable="true" data-field="FrameScore"><?php echo translate('Score') ?></th>
|
2016-11-22 01:28:15 +08:00
|
|
|
<?php
|
|
|
|
if ( ZM_WEB_LIST_THUMBS ) {
|
|
|
|
?>
|
2020-08-27 20:42:39 +08:00
|
|
|
<th class="px-3" data-align="center" data-sortable="false" data-field="Thumbnail"><?php echo translate('Thumbnail') ?></th>
|
2016-11-22 01:28:15 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2020-08-27 20:42:39 +08:00
|
|
|
</tr>
|
2020-08-20 01:04:08 +08:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?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);
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2020-08-24 21:23:24 +08:00
|
|
|
<tr class="<?php echo strtolower($frame['Type']) ?>">
|
2020-08-20 06:54:39 +08:00
|
|
|
<td><?php echo $frame['EventId'] ?></td>
|
|
|
|
<td><?php echo $frame['FrameId'] ?></td>
|
2020-08-20 01:04:08 +08:00
|
|
|
<td><?php echo $frame['Type'] ?></td>
|
|
|
|
<td><?php echo strftime(STRF_FMT_TIME, $frame['UnixTimeStamp']) ?></td>
|
|
|
|
<td><?php echo number_format( $frame['Delta'], 2 ) ?></td>
|
|
|
|
<td><?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 ) {
|
2020-08-20 04:42:35 +08:00
|
|
|
$base_img_src = '?view=image&fid=' .$Frame->Id();
|
|
|
|
$thmb_width = ZM_WEB_LIST_THUMB_WIDTH ? 'width='.ZM_WEB_LIST_THUMB_WIDTH : '';
|
|
|
|
$thmb_height = ZM_WEB_LIST_THUMB_HEIGHT ? 'height='.ZM_WEB_LIST_THUMB_HEIGHT : '';
|
|
|
|
$thmb_fn = 'filename=' .$Event->MonitorId(). '_' .$frame['EventId']. '_' .$frame['FrameId']. '.jpg';
|
|
|
|
$img_src = join('&', array_filter(array($base_img_src, $thmb_width, $thmb_height, $thmb_fn)));
|
|
|
|
$full_img_src = join('&', array_filter(array($base_img_src, $thmb_fn)));
|
|
|
|
$frame_src = '?view=frame&eid=' .$Event->Id(). '&fid=' .$frame['FrameId'];
|
|
|
|
|
2020-08-20 06:54:39 +08:00
|
|
|
echo '<td class="colThumbnail zoom"><img src="' .$img_src. '" '.$thmb_width. ' ' .$thmb_height. 'img_src="' .$img_src. '" full_img_src="' .$full_img_src. '"></td>'.PHP_EOL;
|
2020-09-10 23:05:22 +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>
|
2020-08-20 01:04:08 +08:00
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2020-09-03 05:33:56 +08:00
|
|
|
<?php xhtmlFooter() ?>
|