1234567891011121314151617181920 |
- <?php
- class UsersAdminDashboard {
- public function display() {
- $database = SqliteDatabase::getSingleton();
- $users = $database->queryArray("SELECT rowid AS user_id, display_name, username, email FROM users;");
- foreach($users as $index => $user) {
- $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']. ";");
- $users[$index]['domains'] = array();
- foreach($domains as $domain) {
- $users[$index]['domains'][] = $domain;
- }
- }
- $data = array();
- $data['sectionName'] = "Users";
- $data['displayName'] = $_SESSION['display_name'];
- $data['users'] = $users;
- $data['superadmin'] = $_SESSION['superadmin'] ?? false;
- return (new View())->render("admin/users.php", $data);
- }
- }
|