public function get($id) { if ($id) { $user = new User($id); if (!$user->exists()) { $this->message = "User not found"; $this->status = 404; } $this->response[$this->slug][] = $user->apiData(); return; } $userIDs = User::listAll($this->get['offset'], $this->get['num']); if (!count($userIDs)) { $this->message = "No users found"; $this->status = 204; } foreach ($userIDs as $userID) { $user = new User($userID); $this->response[$this->slug][] = $user->apiData(); } }
<table border="1"> <tr> <td>Username</td> <td>Name</td> <td>Email</td> <td>Create Date</td> <td>Rank</td> <td></td> <td>Delete</td> <td>Change Rank</td> </tr> <?php $User = new User(); $list = $User->listAll(); foreach ($list as $item) { echo '<tr>'; echo '<td>' . $item[0]['username'] . '</td>'; if (isset($item[1])) { echo '<td>' . $item[1]['first'] . ' ' . $item[1]['middle'] . ' ' . $item[1]['last'] . '</td>'; } else { echo '<td><i>not set</i></td>'; } echo '<td>' . $item[0]['email'] . '</td>'; echo '<td>' . $item[0]['create_date'] . '</td>'; echo '<td>'; switch ($item[0]['rank']) { case 0: echo 'Subscriber'; break;