UsersAdminDashboard.class.php 848 B

1234567891011121314151617181920
  1. <?php
  2. class UsersAdminDashboard {
  3. public function display() {
  4. $database = SqliteDatabase::getSingleton();
  5. $users = $database->queryArray("SELECT rowid AS user_id, display_name, username, email FROM users;");
  6. foreach($users as $index => $user) {
  7. $domains = $database->queryArray("SELECT accounts.rowid AS client_id, subdomain, display_name FROM user_accounts JOIN accounts ON accounts.rowid = user_accounts.account_id WHERE user_id = " . $user['user_id']. ";");
  8. $users[$index]['domains'] = array();
  9. foreach($domains as $domain) {
  10. $users[$index]['domains'][] = $domain;
  11. }
  12. }
  13. $data = array();
  14. $data['sectionName'] = "Users";
  15. $data['displayName'] = $_SESSION['display_name'];
  16. $data['users'] = $users;
  17. $data['superadmin'] = $_SESSION['superadmin'] ?? false;
  18. return (new View())->render("admin/users.php", $data);
  19. }
  20. }