require Event.php and clean up use of object vs db row array. Use newer way of using views/image.php by passing eid and frameid instead of a path.

pull/1729/head
Isaac Connor 2017-01-02 10:35:51 -05:00
parent 30674919c4
commit 0a90dbac9f
1 changed files with 9 additions and 7 deletions

View File

@ -24,6 +24,8 @@ if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')
return; return;
} }
require_once( 'includes/Event.php' );
if ( !empty($_REQUEST['execute']) ) if ( !empty($_REQUEST['execute']) )
{ {
executeFilter( $tempFilterName ); executeFilter( $tempFilterName );
@ -93,17 +95,17 @@ $maxHeight = 0;
$archived = false; $archived = false;
$unarchived = false; $unarchived = false;
$events = array(); $events = array();
foreach ( dbFetchAll( $eventsSql ) as $event ) foreach ( dbFetchAll( $eventsSql ) as $event_row )
{ {
$events[] = new Event( $event ); $events[] = $event = new Event( $event_row );
# Doesn this code do anything? # Doesn this code do anything?
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); $scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
$eventWidth = reScale( $event['Width'], $scale ); $eventWidth = reScale( $event_row['Width'], $scale );
$eventHeight = reScale( $event['Height'], $scale ); $eventHeight = reScale( $event_row['Height'], $scale );
if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth; if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth;
if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight; if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight;
if ( $event['Archived'] ) if ( $event_row['Archived'] )
$archived = true; $archived = true;
else else
$unarchived = true; $unarchived = true;
@ -220,10 +222,10 @@ foreach ( $events as $event )
} }
if ( ZM_WEB_LIST_THUMBS ) if ( ZM_WEB_LIST_THUMBS )
{ {
if ( $thumbData = createListThumbnail( $event ) ) if ( $thumbData = $event->createListThumbnail() )
{ {
?> ?>
<td class="colThumbnail"><?php echo makePopupLink( '?view=frame&amp;eid='.$event->Id().'&amp;fid='.$thumbData['FrameId'], 'zmImage', array( 'image', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), '<img src="'.viewImagePath( $thumbData['Path'] ).'" width="'.$thumbData['Width'].'" height="'.$thumbData['Height'].'" alt="'.$thumbData['FrameId'].'/'.$event->MaxScore().'"/>' ) ?></td> <td class="colThumbnail"><?php echo makePopupLink( '?view=frame&amp;eid='.$event->Id().'&amp;fid='.$thumbData['FrameId'], 'zmImage', array( 'image', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), '<img src="?view=image&amp;eid='.$event->Id().'&amp;fid='.$thumbData['FrameId'].'&amp;width='.$thumbData['Width'].'&amp;height='.$thumbData['Height'].'" width="'.$thumbData['Width'].'" height="'.$thumbData['Height'].'" alt="'.$thumbData['FrameId'].'/'.$event->MaxScore().'"/>' ) ?></td>
<?php <?php
} }
else else