Title = 'Seznam počítačů'; $this->Description = 'Seznam registrovaných počítačů'; $this->ParentClass = 'PageNetwork'; } function Show(): string { if (!ModuleUser::Cast($this->System->GetModule('User'))->User->CheckPermission('Network', 'ShowHostList')) return 'Nemáte oprávnění'; if (array_key_exists('admin', $_GET)) $Where = 'AND NetworkDevice.Type IN (1,4,5) '; else $Where = ''; $Output = '
'; $Output .= ''; $DbResult = $this->Database->query('SELECT NetworkDevice.*, User.Name as UserName, NetworkDeviceType.Name AS HostType FROM NetworkDevice '. 'LEFT JOIN Member ON Member.Id = NetworkDevice.Member '. 'LEFT JOIN User ON Member.ResponsibleUser = User.Id '. 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDevice.Used = 1 '.$Where.'ORDER BY NetworkDevice.Name'); while ($Device = $DbResult->fetch_assoc()) { if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = ''; $DbResult2 = $this->Database->query('SELECT COUNT(*) FROM NetworkInterface WHERE Device = '.$Device['Id']); $DbRow = $DbResult2->fetch_row(); if ($DbRow[0] == 1) { $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']); $Interface = $DbResult2->fetch_assoc(); if ($Interface['ExternalIP'] == '') $Interface['ExternalIP'] = ' '; if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' '; if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; $InterfaceName = $Device['Name']; if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name']; $Output .= ''; } else { $Output .= ''; $DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']); while ($Interface = $DbResult2->fetch_assoc()) { if ($Interface['LocalIP'] == '') $Interface['LocalIP'] = ' '; if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = ''; $InterfaceName = $Device['Name']; if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name']; $Output .= ''; } } } $Output .= '
Jméno počítačeIP adresaVeřejná IPTypNaposledy onlineSprávce
'.$InterfaceName.''.$Interface['LocalIP'].''.$Interface['ExternalIP'].''.$Device['HostType'].''.HumanDate($Device['LastOnline']).''.$Device['UserName'].'
'.$Device['Name'].''.$Device['HostType'].''.HumanDate($Device['LastOnline']).''.$Device['UserName'].'
  '.$InterfaceName.''.$Interface['LocalIP'].'    
'; return $Output; } }