Ignore:
Timestamp:
Apr 9, 2011, 8:15:31 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Stránka zobrazující dostupnost nyní používá společný systém řazení sloupců a stránkování.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/network/dostupnost.php

    r284 r311  
    77  var $FullTitle = 'Dostupnost aktivních prvků sítě';
    88  var $ShortTitle = 'Dostupnost sítě';
    9   var $PeriodCount = 12;
     9  var $PeriodCount = 24;
    1010  var $Period = array(
    1111    array('Column' => 'Hour', 'Title' => 'Hodina', 'Period' => 1, 'MinPercent' => 100),
     
    3737      $HostTypeList[$DbRow['Id']] = $DbRow;
    3838   
    39     // Zařízení
    40     $Output .= '<br /><table class="WideTable" style="font-size: small;">';
    41     $Output .= '<tr><th>Jméno</th>';
     39   
     40    $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1');
     41    $DbRow = $DbResult->fetch_row();
     42    $PageList = GetPageList($DbRow[0]);   
     43
     44    $Output .= '<br />';
     45
     46    $Output .= $PageList['Output'];
     47    $Output .= '<table class="WideTable" style="font-size: small;">';
     48   
     49    $TableColumns = array(
     50      array('Name' => 'DeviceName', 'Title' => 'Jméno'),
     51    );   
     52   
    4253   
    4354    $Join = '';
     
    4556    if(!array_key_exists('Period', $_GET))
    4657    {
    47       foreach($this->Period as $Period)
     58      foreach($this->Period as $Index => $Period)
    4859      {
    49         $Output .= '<th>'.$Period['Title'].' [%]</th>';
     60        $TableColumns[] = array('Name' => $Period['Column'], 'Title' => $Period['Title'].' [%]');
    5061        $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB(NOW(), INTERVAL '.($Period['Period'] + 1).' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL 1 HOUR)) GROUP BY NetworkInterface) AS Period'.$Period['Column'].' ON Period'.$Period['Column'].'.NetworkInterface = NetworkInterface.Id';
    5162        $Columns .= ', Period'.$Period['Column'].'.Percent AS '.$Period['Column'];
     
    5869        {
    5970          $Period = $this->Period[$_GET['Period']];
    60           $Output .= '<th>-'.$I.' [%]</th>';
     71          $TableColumns[] = array('Name' => 'Period'.$I.'Column', 'Title' => $I.' [%]');
    6172          $Join .= ' LEFT JOIN (SELECT NetworkInterfaceStat.NetworkInterface, (SUM(NetworkInterfaceStat. PingCount) / '.$Period['Period'].' / 60 * 100) AS Percent FROM NetworkInterfaceStat WHERE (Time > DATE_SUB(NOW(), INTERVAL '.($Period['Period'] * ($I + 1) + 1).' HOUR)) AND (Time < DATE_SUB(NOW(), INTERVAL '.($Period['Period'] * $I + 1).' HOUR)) GROUP BY NetworkInterface) AS Period'.$I.' ON Period'.$I.'.NetworkInterface = NetworkInterface.Id';
    6273          $Columns .= ', Period'.$I.'.Percent AS Period'.$I.'Column';
     
    6576    }
    6677
    67     $Output .= '</tr>';
     78    $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
     79    $Output .= $Order['Output'];
    6880     
    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');
     81    $DbResult2 = $this->Database->query('SELECT NetworkInterface.Name AS InterfaceName'.$Columns.', CONCAT(NetworkDevice.Name, "-", NetworkInterface.Name) AS Name, NetworkDevice.Name AS DeviceName FROM NetworkInterface '.$Join.' JOIN NetworkDevice ON NetworkInterface.Device = NetworkDevice.Id WHERE NetworkDevice.Used = 1 AND NetworkDevice.PermanentOnline=1'.$Order['SQL'].$PageList['SQLLimit']);
    7082    while($Interface = $DbResult2->fetch_assoc())
    7183    {
    7284      $Name = $Interface['DeviceName'];
    73       if($Interface['Name'] != '') $Name .= '-'.$Interface['Name'];
     85      if($Interface['InterfaceName'] != '') $Name .= '-'.$Interface['InterfaceName'];
    7486      $Output .= '<tr><td>'.$Name.'</td>';
    7587      if(!array_key_exists('Period', $_GET))
     
    96108    }
    97109    $Output .= '</table></div>';
     110    $Output .= $PageList['Output'];
    98111    return($Output);
    99112  }
Note: See TracChangeset for help on using the changeset viewer.