Alter code style, spacing

This commit is contained in:
Isaac Connor 2018-07-12 14:05:23 -04:00
parent ce22f207e3
commit e05604e4b3
1 changed files with 36 additions and 28 deletions

View File

@ -16,9 +16,9 @@ if ( canView('Events') ) {
ajaxError('Video Generation Failure, no scale given'); ajaxError('Video Generation Failure, no scale given');
} else { } 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(); $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'] ) )) ) if ( !($event = dbFetchOne($sql, NULL, array( $_REQUEST['id']))) ) {
ajaxError('Video Generation Failure, Unable to load event'); ajaxError('Video Generation Failure, Unable to load event');
else { } else {
if ( $videoFile = createVideo($event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite'])) ) if ( $videoFile = createVideo($event, $_REQUEST['videoFormat'], $_REQUEST['rate'], $_REQUEST['scale'], !empty($_REQUEST['overwrite'])) )
ajaxResponse(array('response'=>$videoFile)); ajaxResponse(array('response'=>$videoFile));
else else
@ -97,14 +97,17 @@ if ( canView('Events') ) {
$exportFormat = $_REQUEST['exportFormat']; $exportFormat = $_REQUEST['exportFormat'];
$exportStructure = 'flat'; $exportStructure = 'flat';
$exportIds = !empty($_REQUEST['eids'])?$_REQUEST['eids']:$_REQUEST['id']; $exportIds = !empty($_REQUEST['eids'])?$_REQUEST['eids']:$_REQUEST['id'];
if ( $exportFile = exportEvents( $exportIds, false, false, false, $exportVideo, false, $exportFormat, $exportStructure ) ) if ( $exportFile = exportEvents(
$exportIds,
(isset($_REQUEST['connkey'])?$_REQUEST['connkey']:''),
false,false, false, $exportVideo, false, $exportFormat, $exportStructure ) )
ajaxResponse(array('exportFile'=>$exportFile)); ajaxResponse(array('exportFile'=>$exportFile));
else else
ajaxError('Export Failed'); ajaxError('Export Failed');
break; break;
} }
} }
} } // end if canView('Events')
if ( canEdit('Events') ) { if ( canEdit('Events') ) {
switch ( $_REQUEST['action'] ) { switch ( $_REQUEST['action'] ) {
@ -119,7 +122,10 @@ if ( canEdit( 'Events' ) ) {
} }
case 'eventdetail' : case 'eventdetail' :
{ {
dbQuery( 'UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?', array( $_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'] ) ); dbQuery(
'UPDATE Events SET Cause = ?, Notes = ? WHERE Id = ?',
array($_REQUEST['newEvent']['Cause'], $_REQUEST['newEvent']['Notes'], $_REQUEST['id'])
);
ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>true)); ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>true));
break; break;
} }
@ -127,7 +133,10 @@ if ( canEdit( 'Events' ) ) {
case 'unarchive' : case 'unarchive' :
{ {
$archiveVal = ($_REQUEST['action'] == 'archive')?1:0; $archiveVal = ($_REQUEST['action'] == 'archive')?1:0;
dbQuery( 'UPDATE Events SET Archived = ? WHERE Id = ?', array( $archiveVal, $_REQUEST['id']) ); dbQuery(
'UPDATE Events SET Archived = ? WHERE Id = ?',
array($archiveVal, $_REQUEST['id'])
);
ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>false)); ajaxResponse(array('refreshEvent'=>true, 'refreshParent'=>false));
break; break;
} }
@ -143,8 +152,7 @@ if ( canEdit( 'Events' ) ) {
break; break;
} }
} }
} } // end if canEdit('Events')
ajaxError('Unrecognised action or insufficient permissions'); ajaxError('Unrecognised action or insufficient permissions');
?> ?>