add formatting to stats table

pull/3019/head
Andrew Bauer 2020-08-22 14:12:11 -05:00
parent afc3d2c548
commit ad67f74ba4
2 changed files with 22 additions and 22 deletions

View File

@ -30,19 +30,19 @@ $sql = 'SELECT S.*,E.*,Z.Name AS ZoneName,Z.Units,Z.Area,M.Name AS MonitorName F
$stats = dbFetchAll( $sql, NULL, array( $eid, $fid ) );
?>
<table id="contentStatsTable<?php echo $row ?>" class="major contentStatsTable" cellspacing="0">
<table id="contentStatsTable<?php echo $row ?>" class="table-sm contentStatsTable" cellspacing="0">
<thead>
<tr>
<th class="colZone"><?php echo translate('Zone') ?></th>
<th class="colPixelDiff"><?php echo translate('PixelDiff') ?></th>
<th class="colAlarmPx"><?php echo translate('AlarmPx') ?></th>
<th class="colFilterPx"><?php echo translate('FilterPx') ?></th>
<th class="colBlobPx"><?php echo translate('BlobPx') ?></th>
<th class="colBlobs"><?php echo translate('Blobs') ?></th>
<th class="colBlobSizes"><?php echo translate('BlobSizes') ?></th>
<th class="colAlarmLimits"><?php echo translate('AlarmLimits') ?></th>
<th class="colScore"><?php echo translate('Score') ?></th>
<th class="colZone font-weight-bold text-center"><?php echo translate('Zone') ?></th>
<th class="colPixelDiff font-weight-bold text-center"><?php echo translate('PixelDiff') ?></th>
<th class="colAlarmPx font-weight-bold text-center"><?php echo translate('AlarmPx') ?></th>
<th class="colFilterPx font-weight-bold text-center"><?php echo translate('FilterPx') ?></th>
<th class="colBlobPx font-weight-bold text-center"><?php echo translate('BlobPx') ?></th>
<th class="colBlobs font-weight-bold text-center"><?php echo translate('Blobs') ?></th>
<th class="colBlobSizes font-weight-bold text-center"><?php echo translate('BlobSizes') ?></th>
<th class="colAlarmLimits font-weight-bold text-center"><?php echo translate('AlarmLimits') ?></th>
<th class="colScore font-weight-bold text-center"><?php echo translate('Score') ?></th>
</tr>
</thead>
@ -54,32 +54,32 @@ if ( count($stats) )
{
?>
<tr>
<td class="colZone"><?php echo validHtmlStr($stat['ZoneName']) ?></td>
<td class="colPixelDiff"><?php echo validHtmlStr($stat['PixelDiff']) ?></td>
<td class="colAlarmPx"><?php echo sprintf( "%d (%d%%)", $stat['AlarmPixels'], (100*$stat['AlarmPixels']/$stat['Area']) ) ?></td>
<td class="colFilterPx"><?php echo sprintf( "%d (%d%%)", $stat['FilterPixels'], (100*$stat['FilterPixels']/$stat['Area']) ) ?></td>
<td class="colBlobPx"><?php echo sprintf( "%d (%d%%)", $stat['BlobPixels'], (100*$stat['BlobPixels']/$stat['Area']) ) ?></td>
<td class="colBlobs"><?php echo validHtmlStr($stat['Blobs']) ?></td>
<td class="colZone text-center"><?php echo validHtmlStr($stat['ZoneName']) ?></td>
<td class="colPixelDiff text-center"><?php echo validHtmlStr($stat['PixelDiff']) ?></td>
<td class="colAlarmPx text-center"><?php echo sprintf( "%d (%d%%)", $stat['AlarmPixels'], (100*$stat['AlarmPixels']/$stat['Area']) ) ?></td>
<td class="colFilterPx text-center"><?php echo sprintf( "%d (%d%%)", $stat['FilterPixels'], (100*$stat['FilterPixels']/$stat['Area']) ) ?></td>
<td class="colBlobPx text-center"><?php echo sprintf( "%d (%d%%)", $stat['BlobPixels'], (100*$stat['BlobPixels']/$stat['Area']) ) ?></td>
<td class="colBlobs text-center"><?php echo validHtmlStr($stat['Blobs']) ?></td>
<?php
if ( $stat['Blobs'] > 1 ) {
?>
<td class="colBlobSizes"><?php echo sprintf( "%d-%d (%d%%-%d%%)", $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']) ) ?></td>
<td class="colBlobSizes text-center"><?php echo sprintf( "%d-%d (%d%%-%d%%)", $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']) ) ?></td>
<?php
} else {
?>
<td class="colBlobSizes"><?php echo sprintf( "%d (%d%%)", $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area'] ) ?></td>
<td class="colBlobSizes text-center"><?php echo sprintf( "%d (%d%%)", $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area'] ) ?></td>
<?php
}
?>
<td class="colAlarmLimits"><?php echo validHtmlStr($stat['MinX'].",".$stat['MinY']."-".$stat['MaxX'].",".$stat['MaxY']) ?></td>
<td class="colScore"><?php echo $stat['Score'] ?></td>
<td class="colAlarmLimits text-center"><?php echo validHtmlStr($stat['MinX'].",".$stat['MinY']."-".$stat['MaxX'].",".$stat['MaxY']) ?></td>
<td class="colScore text-center"><?php echo $stat['Score'] ?></td>
</tr>
<?php
}
} else {
?>
<tr>
<td class="rowNoStats" colspan="9"><?php echo translate('NoStatisticsRecorded') ?></td>
<td class="rowNoStats text-center" colspan="9"><?php echo translate('NoStatisticsRecorded') ?></td>
</tr>
<?php
}

View File

@ -204,7 +204,7 @@ if ( count($frames) ) {
<!-- Load the statistics for each frame -->
<!-- This content gets hidden on init and only revailed on detail view -->
<?php
$row=0;
$row = 0;
if ( count($frames) ) foreach ( $frames as $frame ) {
$eid = $frame['EventId'];
$fid = $frame['FrameId'];