= ?".$_REQUEST['filter']['sql'].$midSql." order by $sortColumn asc"; } $result = dbQuery( $sql, array( $event[$_REQUEST['sort_field']] ) ); while ( $row = dbFetchNext( $result ) ) { if ( $row['Id'] == $_REQUEST['eid'] ) { $prevEvent = dbFetchNext( $result ); break; } } $sql = "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sortColumn ".($sortOrder=='asc'?'>=':'<=').' ?'.$_REQUEST['filter']['sql'].$midSql." order by $sortColumn $sortOrder"; $result = dbQuery( $sql, array($event[$_REQUEST['sort_field']]) ); while ( $row = dbFetchNext( $result ) ) { if ( $row['Id'] == $_REQUEST['eid'] ) { $nextEvent = dbFetchNext( $result ); break; } } $framesPerPage = 15; $framesPerLine = 3; $maxShortcuts = 3; $paged = $event['Frames'] > $framesPerPage; if ( $paged && !empty($_REQUEST['page']) ) { $loFrameId = (($_REQUEST['page']-1)*$framesPerPage)+1; $hiFrameId = min( $_REQUEST['page']*$framesPerPage, $event['Frames'] ); } else { $loFrameId = 1; $hiFrameId = $event['Frames']; } $sql = 'SELECT * FROM Frames WHERE EventID = ?'; if ( $paged && !empty($_REQUEST['page']) ) $sql .= " and FrameId between $loFrameId and $hiFrameId"; $sql .= " order by FrameId"; $frames = dbFetchAll( $sql, NULL, array( $_REQUEST['eid'] ) ); $scale = getDeviceScale( $event['Width'], $event['Height'], $framesPerLine+0.3 ); $pages = (int)ceil($event['Frames']/$framesPerPage); if ( !empty($_REQUEST['fid']) ) $_REQUEST['page'] = ($_REQUEST['fid']/$framesPerPage)+1; $pagination = getPagination( $pages, $_REQUEST['page'], $maxShortcuts, '&eid='.$_REQUEST['eid'].$filterQuery.$sortQuery, '&' ); xhtmlHeaders( __FILE__, $SLANG['Event'].' - '.$event['Name'] ); ?>