Changeset 304 for trunk/network/subnet.php
- Timestamp:
- Jan 30, 2011, 11:22:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/network/subnet.php
r265 r304 9 9 function Show() 10 10 { 11 $Output = '<br /><table class="WideTable"><tr><th>Název</th><th>IP rozsah</th><th>Adresa DHCP</th><th>Výchozí brána</th><th>Max. adres</th><th>Registrovaných adres</th><th>Využití [%]</th><th>Účastník</th></tr>'; 12 $DbResult = $this->Database->query('SELECT NetworkSubnet.*, Subject.Name AS SubjectName FROM NetworkSubnet LEFT JOIN Member ON Member.Id = NetworkSubnet.Member LEFT JOIN Subject ON Subject.Id = Member.Subject ORDER BY NetworkSubnet.AddressRange'); 13 while($Subnet = $DbResult->fetch_assoc()) 14 { 11 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `NetworkSubnet`'); 12 $DbRow = $DbResult->fetch_row(); 13 $PageList = GetPageList($DbRow[0]); 14 15 $Output = $PageList['Output']; 16 $Output .= '<table class="WideTable" style="font-size: small;">'; 17 18 $TableColumns = array( 19 array('Name' => 'Name', 'Title' => 'Název'), 20 array('Name' => 'AddressRange', 'Title' => 'IP rozsah'), 21 array('Name' => 'DHCP', 'Title' => 'Adresa DHCP'), 22 array('Name' => 'Gateway', 'Title' => 'Výchozí brána'), 23 array('Name' => '', 'Title' => 'Max. adres'), 24 array('Name' => '', 'Title' => 'Registrovaných adres'), 25 array('Name' => '', 'Title' => 'Využití'), 26 array('Name' => 'SubjectName', 'Title' => 'Účastník'), 27 ); 28 $Order = GetOrderTableHeader($TableColumns, 'NetworkSubnet.AddressRange', 0); 29 $Output .= $Order['Output']; 30 31 $Query = 'SELECT NetworkSubnet.*, Subject.Name AS SubjectName FROM NetworkSubnet LEFT JOIN Member ON Member.Id = NetworkSubnet.Member LEFT JOIN Subject ON Subject.Id = Member.Subject '.$Order['SQL'].$PageList['SQLLimit']; 32 33 $DbResult = $this->Database->query($Query); 34 while($Subnet = $DbResult->fetch_assoc()) 35 { 15 36 $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE CompareNetworkPrefix(INET_ATON("'.$Subnet['AddressRange'].'"), INET_ATON(LocalIP), '.$Subnet['Mask'].')'); 16 37 $DbRow = $DbResult2->fetch_row(); 17 38 $AddressCount = $DbRow[0]; 18 39 $MaxAddressCount = $SubnetMask = pow(2, 32 - $Subnet['Mask']) - 2; 19 $Output .= '<tr><td>'.$Subnet['Name'].'</td><td>'.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'</td><td>'.$Subnet['DHCP'].'</td><td>'.$Subnet['Gateway'].'</td><td>'.$MaxAddressCount.'</td><td>'.$AddressCount.'</td><td>'.round($AddressCount / $MaxAddressCount * 100).'</td><td>'.$Subnet['SubjectName'].'</td></tr>'; 40 41 $Output .= '<tr><td>'.$Subnet['Name'].'</td>'. 42 '<td>'.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'</td>'. 43 '<td>'.$Subnet['DHCP'].'</td>'. 44 '<td>'.$Subnet['Gateway'].'</td>'. 45 '<td>'.$MaxAddressCount.'</td>'. 46 '<td>'.$AddressCount.'</td>'. 47 '<td>'.round($AddressCount / $MaxAddressCount * 100).'</td>'. 48 '<td>'.$Subnet['SubjectName'].'</td></tr>'; 20 49 } 21 50 $Output .= '</table>'; 51 $Output .= $PageList['Output']; 22 52 return($Output); 23 53 }
Note:
See TracChangeset
for help on using the changeset viewer.