Title = 'Seznam uživatelů'; $this->Description = 'Seznam registrovaných uživatelů'; $this->ParentClass = 'PagePortal'; } function Show(): string { if (!Core::Cast($this->System)->User->CheckPermission('User', 'ShowList')) return 'Nemáte oprávnění'; $DbResult = $this->Database->query('SELECT COUNT(*) FROM `User`'); $DbRow = $DbResult->fetch_row(); $PageList = GetPageList('Users', $DbRow[0]); $Output = $PageList['Output']; $Output .= ''; $TableColumns = array( array('Name' => 'Name', 'Title' => 'Jméno'), array('Name' => 'Email', 'Title' => 'E-mail'), array('Name' => '', 'Title' => 'Počítače'), ); $Order = GetOrderTableHeader('Users', $TableColumns, 'Name', 0); $Output .= $Order['Output']; $Query = 'SELECT * FROM `User` '.$Order['SQL'].$PageList['SQLLimit']; $DbResult = $this->Database->query($Query); while ($User = $DbResult->fetch_assoc()) { $Devices = array(); $DbResult2 = $this->Database->query('SELECT `Id` FROM `Member` WHERE `Member`.`ResponsibleUser` = '.$User['Id']); while ($Member = $DbResult2->fetch_assoc()) { $DbResult3 = $this->Database->query('SELECT `Name`, `Id` FROM `NetworkDevice` '. 'WHERE `Member` = '.$Member['Id'].' AND `Used`=1 ORDER BY `Name`'); while ($Device = $DbResult3->fetch_assoc()) { $Devices[] = $Device['Name']; } } $User['Devices'] = implode(', ', $Devices); $Output .= ''. ''. ''; } $Output .= '
'.$User['Name'].''.$User['Email'].''.$User['Devices'].'
'; $Output .= $PageList['Output']; return $Output; } }