Merge ../ZoneMinder.master.bad into disk_space_in_events
This commit is contained in:
commit
af746e2154
|
@ -148,5 +148,8 @@ public function getStreamSrc( $args, $querySep='&' ) {
|
|||
|
||||
return( $streamSrc );
|
||||
} // end function getStreamSrc
|
||||
function DiskSpace() {
|
||||
return folder_size( $this->Path() );
|
||||
}
|
||||
} # end class
|
||||
?>
|
||||
|
|
|
@ -2131,4 +2131,12 @@ function getStreamHTML( $monitor, $scale=100 ) {
|
|||
}
|
||||
} // end function getStreamHTML
|
||||
|
||||
function folder_size($dir) {
|
||||
$size = 0;
|
||||
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
|
||||
$size += is_file($each) ? filesize($each) : folderSize($each);
|
||||
}
|
||||
return $size;
|
||||
} // end fucntion folder_size
|
||||
|
||||
?>
|
||||
|
|
|
@ -30,7 +30,7 @@ if ( !empty($_REQUEST['execute']) )
|
|||
}
|
||||
|
||||
$countSql = 'SELECT count(E.Id) AS EventCount FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId) WHERE';
|
||||
$eventsSql = 'SELECT E.Id,E.MonitorId,M.Name AS MonitorName,M.DefaultScale,E.Name,E.Width,E.Height,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE';
|
||||
$eventsSql = 'SELECT E.*,M.Name AS MonitorName FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE';
|
||||
if ( $user['MonitorIds'] ) {
|
||||
$user_monitor_ids = ' M.Id in ('.$user['MonitorIds'].')';
|
||||
$countSql .= $user_monitor_ids;
|
||||
|
@ -95,8 +95,10 @@ $unarchived = false;
|
|||
$events = array();
|
||||
foreach ( dbFetchAll( $eventsSql ) as $event )
|
||||
{
|
||||
$events[] = $event;
|
||||
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
$events[] = new Event( $event );
|
||||
|
||||
# Doesn this code do anything?
|
||||
$scale = max( reScale( SCALE_BASE, $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
$eventWidth = reScale( $event['Width'], $scale );
|
||||
$eventHeight = reScale( $event['Height'], $scale );
|
||||
if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth;
|
||||
|
@ -183,6 +185,7 @@ foreach ( $events as $event )
|
|||
<th class="colTotScore"><a href="<?php echo sortHeader( 'TotScore' ) ?>"><?php echo translate('TotalBrScore') ?><?php echo sortTag( 'TotScore' ) ?></a></th>
|
||||
<th class="colAvgScore"><a href="<?php echo sortHeader( 'AvgScore' ) ?>"><?php echo translate('AvgBrScore') ?><?php echo sortTag( 'AvgScore' ) ?></a></th>
|
||||
<th class="colMaxScore"><a href="<?php echo sortHeader( 'MaxScore' ) ?>"><?php echo translate('MaxBrScore') ?><?php echo sortTag( 'MaxScore' ) ?></a></th>
|
||||
<th class="colDiskSpace"><a href="<?php echo sortHeader( 'DiskSpace' ) ?>"><?php echo translate('DiskSpace') ?><?php echo sortTag( 'DiskSpace' ) ?></a></th>
|
||||
<?php
|
||||
if ( ZM_WEB_LIST_THUMBS )
|
||||
{
|
||||
|
@ -195,27 +198,28 @@ foreach ( $events as $event )
|
|||
</tr>
|
||||
<?php
|
||||
}
|
||||
$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 );
|
||||
?>
|
||||
<tr>
|
||||
<td class="colId"><?php echo makePopupLink( '?view=event&eid='.$event['Id'].$filterQuery.$sortQuery.'&page=1', 'zmEvent', array( 'event', reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ) ), $event['Id'].($event['Archived']?'*':'') ) ?></td>
|
||||
<td class="colName"><?php echo makePopupLink( '?view=event&eid='.$event['Id'].$filterQuery.$sortQuery.'&page=1', 'zmEvent', array( 'event', reScale( $event['Width'], $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), reScale( $event['Height'], $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ) ), validHtmlStr($event['Name']).($event['Archived']?'*':'' ) ) ?></td>
|
||||
<td class="colMonitorName"><?php echo $event['MonitorName'] ?></td>
|
||||
<td class="colCause"><?php echo makePopupLink( '?view=eventdetail&eid='.$event['Id'], 'zmEventDetail', 'eventdetail', validHtmlStr($event['Cause']), canEdit( 'Events' ), 'title="'.htmlspecialchars($event['Notes']).'"' ) ?></td>
|
||||
<td class="colTime"><?php echo strftime( STRF_FMT_DATETIME_SHORTER, strtotime($event['StartTime']) ) ?></td>
|
||||
<td class="colDuration"><?php echo gmdate("H:i:s", $event['Length'] ) ?></td>
|
||||
<td class="colFrames"><?php echo makePopupLink( '?view=frames&eid='.$event['Id'], 'zmFrames', 'frames', $event['Frames'] ) ?></td>
|
||||
<td class="colAlarmFrames"><?php echo makePopupLink( '?view=frames&eid='.$event['Id'], 'zmFrames', 'frames', $event['AlarmFrames'] ) ?></td>
|
||||
<td class="colTotScore"><?php echo $event['TotScore'] ?></td>
|
||||
<td class="colAvgScore"><?php echo $event['AvgScore'] ?></td>
|
||||
<td class="colMaxScore"><?php echo makePopupLink( '?view=frame&eid='.$event['Id'].'&fid=0', 'zmImage', array( 'image', reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ) ), $event['MaxScore'] ) ?></td>
|
||||
<td class="colId"><?php echo makePopupLink( '?view=event&eid='.$event->Id().$filterQuery.$sortQuery.'&page=1', 'zmEvent', array( 'event', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), $event->Id().($event->Archived()?'*':'') ) ?></td>
|
||||
<td class="colName"><?php echo makePopupLink( '?view=event&eid='.$event->Id().$filterQuery.$sortQuery.'&page=1', 'zmEvent', array( 'event', reScale( $event->Width(), $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ), reScale( $event->Height(), $event->DefaultScale(), ZM_WEB_DEFAULT_SCALE ) ), validHtmlStr($event->Name()).($event->Archived()?'*':'' ) ) ?></td>
|
||||
<td class="colMonitorName"><?php echo $event->MonitorName() ?></td>
|
||||
<td class="colCause"><?php echo makePopupLink( '?view=eventdetail&eid='.$event->Id(), 'zmEventDetail', 'eventdetail', validHtmlStr($event->Cause()), canEdit( 'Events' ), 'title="'.htmlspecialchars($event->Notes()).'"' ) ?></td>
|
||||
<td class="colTime"><?php echo strftime( STRF_FMT_DATETIME_SHORTER, strtotime($event->StartTime()) ) ?></td>
|
||||
<td class="colDuration"><?php echo gmdate("H:i:s", $event->Length() ) ?></td>
|
||||
<td class="colFrames"><?php echo makePopupLink( '?view=frames&eid='.$event->Id(), 'zmFrames', 'frames', $event->Frames() ) ?></td>
|
||||
<td class="colAlarmFrames"><?php echo makePopupLink( '?view=frames&eid='.$event->Id(), 'zmFrames', 'frames', $event->AlarmFrames() ) ?></td>
|
||||
<td class="colTotScore"><?php echo $event->TotScore() ?></td>
|
||||
<td class="colAvgScore"><?php echo $event->AvgScore() ?></td>
|
||||
<td class="colMaxScore"><?php echo makePopupLink( '?view=frame&eid='.$event->Id().'&fid=0', 'zmImage', array( 'image', reScale( $event->Width(), $scale ), reScale( $event->Height(), $scale ) ), $event->MaxScore() ) ?></td>
|
||||
<td class="colDiskSpace"><?php echo $event->DiskSpace() ?></td>
|
||||
<?php
|
||||
if ( ZM_WEB_LIST_THUMBS )
|
||||
{
|
||||
if ( $thumbData = createListThumbnail( $event ) )
|
||||
{
|
||||
?>
|
||||
<td class="colThumbnail"><?php echo makePopupLink( '?view=frame&eid='.$event['Id'].'&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&eid='.$event->Id().'&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>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
|
@ -226,7 +230,7 @@ foreach ( $events as $event )
|
|||
}
|
||||
}
|
||||
?>
|
||||
<td class="colMark"><input type="checkbox" name="markEids[]" value="<?php echo $event['Id'] ?>" onclick="configureButton( this, 'markEids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
||||
<td class="colMark"><input type="checkbox" name="markEids[]" value="<?php echo $event->Id() ?>" onclick="configureButton( this, 'markEids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled="disabled"<?php } ?>/></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue