Changeset 6 for index.php


Ignore:
Timestamp:
Oct 16, 2007, 10:12:26 PM (17 years ago)
Author:
george
Message:

Přepracovaná vývojová verze s oddělenými datovými tabulkami a různými datovými typy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • index.php

    r3 r6  
    9898);
    9999
    100 $Variables = array(
    101   'TimeStart' => time() - 3600*24,
    102   'TimeEnd' => time(),
    103   'Measure' => 1,
    104   'Period' => 'day',
    105   'TimeSpecify' => 0,
    106 );
    107 
    108 foreach($Variables as $Index => $Variable)
     100foreach($Config['DefaultVariables'] as $Index => $Variable)
    109101{
    110102  if(!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable;
     
    182174
    183175$Output .= '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small;">';
    184 $Output .= '<tr><th>Mìøená velièina</th><th>Èas posledního mìøení</th><th>Poslední hodnota</th><th>Interpolace</th><th>Poznámky</th></tr>';
     176$Output .= '<tr><th>Mìøená velièina</th><th>Èas posledního mìøení</th><th>Poslední hodnota</th><th>Interpolace</th><th>Poznámky</th>';
     177if(array_key_exists('Debug', $_GET)) $Output .= '<th>Poèet polo¾ek</th><th>Èas vykonání</th>';
     178$Output .= '</tr>';
    185179$Database->select_db('measure');
    186180$Result = $Database->select('measure', '*', 'Enabled=1 AND PermissionView="all" OR PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'" ORDER BY Description');
     
    190184{
    191185  $StopWatchStart = GetMicrotime();
    192 //  DB_Select('stat_data', 'COUNT(*)', 'measure='.$Measure['id']);
    193 //  $RowCount = DB_Row();
    194 //  $RowCount = $RowCount[0];
    195 //  $RowCount = 0;
    196   $Result2 = $Database->select('stat_data', 'time, avg', 'measure='.$Measure['id'].' ORDER BY time DESC LIMIT 1');
     186  if(array_key_exists('Debug', $_GET))
     187  { 
     188    $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'measure='.$Measure['Id']);
     189    $RowCount = $DbResult->fetch_array();
     190    $RowCount = $RowCount[0];
     191  }
     192  $Result2 = $Database->select($Measure['DataTable'], 'time, avg', 'measure='.$Measure['Id'].' ORDER BY time DESC LIMIT 1');
    197193  if($Result2->num_rows > 0)
    198194  {
    199195    $Row = $Result2->fetch_array();
    200196    $LastMeasureTime = date('j.n.Y G:i:s', MysqlDateTimeToTime($Row['time']));
    201     $LastMeasureValue = round($Row['avg'] / $Measure['display_divider']);
     197    $LastMeasureValue = round($Row['avg'] / $Measure['Divider']);
    202198  } else {
    203199    $LastMeasureTime = '&nbsp;';
    204200    $LastMeasureValue = '&nbsp;';
    205201  }
    206   if($Measure['continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne';
    207   if($Measure['info'] == '') $Measure['info'] = '&nbsp;';
     202  if($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne';
     203  if($Measure['Info'] == '') $Measure['Info'] = '&nbsp;';
    208204  $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000  ) / 1000;
    209   $Output .= '<tr><td><a href="?Measure='.$Measure['id'].'">'.$Measure['description'].'</a></td><td align="center">'.$LastMeasureValue.' '.$Measure['display_unit'].'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['info'].'</td>';
    210   //<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td></tr>');
    211   flush();
     205  $Output .= '<tr><td><a href="?Measure='.$Measure['Id'].'">'.$Measure['Description'].'</a></td><td align="center">'.$LastMeasureValue.' '.$Measure['Unit'].'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Info'].'</td>';
     206  if(array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>';
     207  $Output .= '</tr>';
    212208}
    213209$Output .= '</table>';
Note: See TracChangeset for help on using the changeset viewer.