Title = 'Registrované počítače';
$this->ParentClass = 'PageNetwork';
}
function Show(): string
{
if (ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'] == '') return $this->SystemMessage('Nepovolený přístup', 'Nemáte oprávnění pro tuto operaci');
$Output = '
';
$Output .= 'Jméno počítače | Místní adresa | Veřejná adresa | Fyzická adresa | Typ | Naposledy online |
';
$DbResult = $this->Database->query('SELECT NetworkDevice.*, NetworkDeviceType.Name AS HostType FROM NetworkDevice '.
'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
'WHERE NetworkDevice.Used = 1 AND NetworkDevice.Member = (SELECT Customer FROM UserCustomerRel WHERE User='.ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id'].') ORDER BY NetworkDevice.Name');
while ($Device = $DbResult->fetch_assoc())
{
if ($Device['Online'] == 1) $Style = 'color: blue;'; else $Style = '';
$Output .= ''.$Device['Name'].' | '.$Device['HostType'].' | '.HumanDate($Device['LastOnline']).' |
';
$DbResult2 = $this->Database->query('SELECT * FROM NetworkInterface WHERE Device = '.$Device['Id']);
while ($Interface = $DbResult2->fetch_assoc())
{
if ($Interface['Online'] == 1) $Style = 'font-weight: bold; color: blue;'; else $Style = '';
$InterfaceName = $Device['Name'];
if ($Interface['Name'] != '') $InterfaceName .= '-'.$Interface['Name'];
$Output .= ' '.
$InterfaceName.' | '.NotBlank($Interface['LocalIP']).' | '.
NotBlank($Interface['ExternalIP']).' | '.
NotBlank($Interface['MAC']).' | | |
';
}
}
$Output .= '
';
return $Output;
}
}