Changeset 284


Ignore:
Timestamp:
Sep 1, 2010, 5:23:18 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Zobrazení dostupnosti zařízení filtrováno podle sloupce v databází PermanentOnline. * Upraveno: Zelené zobrazení při dobré dostupnosti, červené při špatné.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/network/dostupnost.php

    r271 r284  
    99  var $PeriodCount = 12;
    1010  var $Period = array(
    11     array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1),
    12     array('Column' => 'Day', 'Title' => 'Den', 'Period' => 24),
    13     array('Column' => 'Week', 'Title' => 'Týden', 'Period' => 168), // 24 * 7 
    14     array('Column' => 'Month', 'Title' => 'Měsíc', 'Period' => 720), // 24 * 30
    15     array('Column' => 'Year', 'Title' => 'Rok', 'Period' => 8760), // 365 * 24
     11    array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1, 'MinPercent' => 100),
     12    array('Column' => 'Day', 'Title' => 'Den', 'Period' => 24, 'MinPercent' => 98),
     13    array('Column' => 'Week', 'Title' => 'Týden', 'Period' => 168, 'MinPercent' => 96), // 24 * 7 
     14    array('Column' => 'Month', 'Title' => 'Měsíc', 'Period' => 720, 'MinPercent' => 93), // 24 * 30
     15    array('Column' => 'Year', 'Title' => 'Rok', 'Period' => 8760, 'MinPercent' => 92), // 365 * 24
    1616    //array('Column' => 'TenYear', 'Title' => 'Desetiletí', 'Period' => 87600), // 365 * 24 * 10
    1717  );
     
    6767    $Output .= '</tr>';
    6868     
    69     $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name'.$Columns.', NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.Type IN (1, 4, 5) ORDER BY DeviceName, Name');
     69    $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name'.$Columns.', NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1 ORDER BY DeviceName, Name');
    7070    while($Interface = $DbResult2->fetch_assoc())
    7171    {
     
    7676      {
    7777        foreach($this->Period as $Period)
    78           $Output .= '<td style="text-align: right;">'.sprintf('%01.2f', $Interface[$Period['Column']]).'</td>';
     78        {
     79          if($Interface[$Period['Column']] >= $Period['MinPercent']) $Color = ' color: green;';
     80            else $Color = 'color: red';
     81          $Output .= '<td style="text-align: right;'.$Color.'">'.sprintf('%01.2f', $Interface[$Period['Column']]).'</td>';
     82        }
    7983      } else
    8084      {
     
    8387          for($I = 0; $I < $this->PeriodCount; $I++)
    8488          {
    85             $Output .= '<td style="text-align: center;">'.sprintf('%01.2f', $Interface['Period'.$I.'Column']).'</td>';
     89            if($Interface['Period'.$I.'Column'] >= $Period['MinPercent']) $Color = ' color: green;';
     90              else $Color = 'color: red';
     91            $Output .= '<td style="text-align: center;'.$Color.'">'.sprintf('%01.2f', $Interface['Period'.$I.'Column']).'</td>';
    8692          }
    8793        } else die('Neznámé id');
Note: See TracChangeset for help on using the changeset viewer.