zoneminder/web/skins/classic/views/eventdetail.php

118 lines
3.6 KiB
PHP
Raw Normal View History

<?php
//
// ZoneMinder web event detail view file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// 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
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canEdit('Events') ) {
2017-07-06 22:49:36 +08:00
$view = 'error';
return;
}
2013-12-18 01:53:15 +08:00
if ( isset($_REQUEST['eid']) ) {
2017-07-06 22:49:36 +08:00
$mode = 'single';
$eid = validInt($_REQUEST['eid']);
$newEvent = dbFetchOne('SELECT E.* FROM Events AS E WHERE E.Id = ?', NULL, array($eid));
2013-12-18 01:53:15 +08:00
} elseif ( isset($_REQUEST['eids']) ) {
2017-07-06 22:49:36 +08:00
$mode = 'multi';
$sql = 'SELECT E.* FROM Events AS E WHERE ';
$sqlWhere = array();
$sqlValues = array();
foreach ( $_REQUEST['eids'] as $eid ) {
$sqlWhere[] = 'E.Id = ?';
2019-01-05 05:29:16 +08:00
$sqlValues[] = validInt($eid);
2017-07-06 22:49:36 +08:00
}
unset($eid);
$sql .= join(' OR ', $sqlWhere);
2017-07-06 22:49:36 +08:00
foreach( dbFetchAll( $sql, NULL, $sqlValues ) as $row ) {
if ( !isset($newEvent) ) {
$newEvent = $row;
} else {
if ( $newEvent['Cause'] && $newEvent['Cause'] != $row['Cause'] )
$newEvent['Cause'] = '';
if ( $newEvent['Notes'] && $newEvent['Notes'] != $row['Notes'] )
$newEvent['Notes'] = '';
}
2017-07-06 22:49:36 +08:00
}
} else {
$mode = '';
}
$focusWindow = true;
if ( $mode == 'single' )
2017-07-06 22:49:36 +08:00
xhtmlHeaders(__FILE__, translate('Event').' - '.$eid );
else
2015-05-10 21:10:30 +08:00
xhtmlHeaders(__FILE__, translate('Events') );
?>
<body>
<div id="page">
<div id="header">
<?php
2017-07-06 22:49:36 +08:00
if ( $mode == 'single' ) {
?>
2015-05-10 21:10:30 +08:00
<h2><?php echo translate('Event') ?> <?php echo $eid ?></h2>
<?php
2017-07-06 22:49:36 +08:00
} else {
?>
2015-05-10 21:10:30 +08:00
<h2><?php echo translate('Events') ?></h2>
<?php
}
?>
</div>
<div id="content">
<form name="contentForm" id="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="action" value="eventdetail"/>
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<?php
2017-07-06 22:49:36 +08:00
if ( $mode == 'single' ) {
?>
2019-01-05 05:29:16 +08:00
<input type="hidden" name="markEids[]" value="<?php echo validInt($eid) ?>"/>
<?php
} else if ( $mode = 'multi' ) {
?>
<?php
2017-07-06 22:49:36 +08:00
foreach ( $_REQUEST['eids'] as $eid ) {
?>
2019-01-05 05:29:16 +08:00
<input type="hidden" name="markEids[]" value="<?php echo validInt($eid) ?>"/>
<?php
}
}
?>
<table id="contentTable" class="major">
<tbody>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Cause') ?></th>
<td><input type="text" name="newEvent[Cause]" value="<?php echo validHtmlStr($newEvent['Cause']) ?>" size="32"/></td>
</tr>
<tr>
2015-05-10 21:10:30 +08:00
<th scope="row"><?php echo translate('Notes') ?></th>
<td><textarea name="newEvent[Notes]" rows="6" cols="50"><?php echo validHtmlStr($newEvent['Notes']) ?></textarea></td>
</tr>
</tbody>
</table>
<div id="contentButtons">
<button type="submit" value="Save" <?php echo !canEdit('Events') ? ' disabled="disabled"' : '' ?>>
<?php echo translate('Save') ?>
</button>
<button type="button" onclick="closeWindow()"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>
</div>
</body>
</html>