Title = 'Podsítě'; $this->Description = 'Informace o podsítích'; $this->ParentClass = 'PageNetwork'; } function Show(): string { $DbResult = $this->Database->query('SELECT COUNT(*) FROM `NetworkSubnet`'); $DbRow = $DbResult->fetch_row(); $PageList = GetPageList('Subnets', $DbRow[0]); $Output = $PageList['Output']; $Output .= ''; $TableColumns = array( array('Name' => 'Name', 'Title' => 'Název'), array('Name' => 'AddressRange', 'Title' => 'IP rozsah'), array('Name' => 'DHCP', 'Title' => 'Adresa DHCP'), array('Name' => 'Gateway', 'Title' => 'Výchozí brána'), array('Name' => '', 'Title' => 'Max. adres'), array('Name' => '', 'Title' => 'Registrovaných adres'), array('Name' => '', 'Title' => 'Využití'), array('Name' => 'SubjectName', 'Title' => 'Účastník'), ); $Order = GetOrderTableHeader('Subnets', $TableColumns, 'AddressRange', 0); $Output .= $Order['Output']; $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']; $DbResult = $this->Database->query($Query); while ($Subnet = $DbResult->fetch_assoc()) { $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE CompareNetworkPrefix(INET_ATON("'.$Subnet['AddressRange'].'"), INET_ATON(LocalIP), '.$Subnet['Mask'].')'); $DbRow = $DbResult2->fetch_row(); $AddressCount = $DbRow[0]; $MaxAddressCount = $SubnetMask = pow(2, 32 - $Subnet['Mask']) - 2; $Output .= ''. ''. ''. ''. ''. ''. ''. ''; } $Output .= '
'.$Subnet['Name'].''.$Subnet['AddressRange'].'/'.$Subnet['Mask'].''.$Subnet['DHCP'].''.$Subnet['Gateway'].''.$MaxAddressCount.''.$AddressCount.''.round($AddressCount / $MaxAddressCount * 100).''.$Subnet['SubjectName'].'
'; $Output .= $PageList['Output']; return $Output; } }