Alter code style, spacing
This commit is contained in:
parent
ce22f207e3
commit
e05604e4b3
|
@ -9,20 +9,20 @@ if ( canView('Events') ) {
|
|||
case 'video' :
|
||||
{
|
||||
if ( empty($_REQUEST['videoFormat']) ) {
|
||||
ajaxError( 'Video Generation Failure, no format given' );
|
||||
ajaxError('Video Generation Failure, no format given');
|
||||
} elseif ( empty($_REQUEST['rate']) ) {
|
||||
ajaxError( 'Video Generation Failure, no rate given' );
|
||||
ajaxError('Video Generation Failure, no rate given');
|
||||
} elseif ( empty($_REQUEST['scale']) ) {
|
||||
ajaxError( 'Video Generation Failure, no scale given' );
|
||||
ajaxError('Video Generation Failure, no scale given');
|
||||
} else {
|
||||
$sql = 'SELECT E.*,M.Name AS MonitorName,M.DefaultRate,M.DefaultScale FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE E.Id = ?'.monitorLimitSql();
|
||||
if ( !($event = dbFetchOne( $sql, NULL, array( $_REQUEST['id'] ) )) )
|
||||
ajaxError( 'Video Generation Failure, Unable to load event' );
|
||||
else {
|
||||
if ( $videoFile = createVideo( $event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite']) ) )
|
||||
ajaxResponse( array( 'response'=>$videoFile ) );
|
||||
if ( !($event = dbFetchOne($sql, NULL, array( $_REQUEST['id']))) ) {
|
||||
ajaxError('Video Generation Failure, Unable to load event');
|
||||
} else {
|
||||
if ( $videoFile = createVideo($event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite'])) )
|
||||
ajaxResponse(array('response'=>$videoFile));
|
||||
else
|
||||
ajaxError( 'Video Generation Failed' );
|
||||
ajaxError('Video Generation Failed');
|
||||
}
|
||||
}
|
||||
$ok = true;
|
||||
|
@ -92,59 +92,67 @@ if ( canView('Events') ) {
|
|||
}
|
||||
case 'download' :
|
||||
{
|
||||
require_once( ZM_SKIN_PATH.'/includes/export_functions.php' );
|
||||
require_once(ZM_SKIN_PATH.'/includes/export_functions.php');
|
||||
$exportVideo = 1;
|
||||
$exportFormat = $_REQUEST['exportFormat'];
|
||||
$exportStructure = 'flat';
|
||||
$exportIds = !empty($_REQUEST['eids'])?$_REQUEST['eids']:$_REQUEST['id'];
|
||||
if ( $exportFile = exportEvents( $exportIds, false, false, false, $exportVideo, false, $exportFormat, $exportStructure ) )
|
||||
ajaxResponse( array( 'exportFile'=>$exportFile ) );
|
||||
if ( $exportFile = exportEvents(
|
||||
$exportIds,
|
||||
(isset($_REQUEST['connkey'])?$_REQUEST['connkey']:''),
|
||||
false,false, false, $exportVideo, false, $exportFormat, $exportStructure ) )
|
||||
ajaxResponse(array('exportFile'=>$exportFile));
|
||||
else
|
||||
ajaxError( 'Export Failed' );
|
||||
ajaxError('Export Failed');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end if canView('Events')
|
||||
|
||||
if ( canEdit( 'Events' ) ) {
|
||||
if ( canEdit('Events') ) {
|
||||
switch ( $_REQUEST['action'] ) {
|
||||
case 'rename' :
|
||||
{
|
||||
if ( !empty($_REQUEST['eventName']) )
|
||||
dbQuery( 'UPDATE Events SET Name = ? WHERE Id = ?', array( $_REQUEST['eventName'], $_REQUEST['id'] ) );
|
||||
dbQuery('UPDATE Events SET Name = ? WHERE Id = ?', array($_REQUEST['eventName'], $_REQUEST['id']));
|
||||
else
|
||||
ajaxError( 'No new event name supplied' );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>true ) );
|
||||
ajaxError('No new event name supplied');
|
||||
ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>true));
|
||||
break;
|
||||
}
|
||||
case 'eventdetail' :
|
||||
{
|
||||
dbQuery( 'UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?', array( $_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'] ) );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>true ) );
|
||||
dbQuery(
|
||||
'UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?',
|
||||
array($_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'])
|
||||
);
|
||||
ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>true));
|
||||
break;
|
||||
}
|
||||
case 'archive' :
|
||||
case 'unarchive' :
|
||||
{
|
||||
$archiveVal = ($_REQUEST['action'] == 'archive')?1:0;
|
||||
dbQuery( 'UPDATE Events SET Archived = ? WHERE Id = ?', array( $archiveVal, $_REQUEST['id']) );
|
||||
ajaxResponse( array( 'refreshEvent'=>true, 'refreshParent'=>false ) );
|
||||
dbQuery(
|
||||
'UPDATE Events SET Archived = ? WHERE Id = ?',
|
||||
array($archiveVal, $_REQUEST['id'])
|
||||
);
|
||||
ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>false));
|
||||
break;
|
||||
}
|
||||
case 'delete' :
|
||||
{
|
||||
$Event = new Event( $_REQUEST['id'] );
|
||||
$Event = new Event($_REQUEST['id']);
|
||||
if ( ! $Event->Id() ) {
|
||||
ajaxResponse( array( 'refreshEvent'=>false, 'refreshParent'=>true, 'message'=> 'Event not found.' ) );
|
||||
ajaxResponse(array('refreshEvent'=>false, 'refreshParent'=>true, 'message'=> 'Event not found.'));
|
||||
} else {
|
||||
$Event->delete();
|
||||
ajaxResponse( array( 'refreshEvent'=>false, 'refreshParent'=>true ) );
|
||||
ajaxResponse(array('refreshEvent'=>false, 'refreshParent'=>true));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
} // end if canEdit('Events')
|
||||
|
||||
ajaxError('Unrecognised action or insufficient permissions');
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue