index.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php use App\Utils\Url, App\Utils\Html, App\Utils\Date ?>
  2. <?php $app->render('layouts/header', ['title' => 'Users']) ?>
  3. <?php $app->render('layouts/navbar', ['app' => $app]) ?>
  4. <h1>Users</h1>
  5. <?php $app->render('layouts/alerts/error', ['error' => $error]) ?>
  6. <?php $app->render('layouts/alerts/success', ['success' => $success]) ?>
  7. <a href="<?= Url::build('users/new') ?>" class="btn btn-default btn-ghost">
  8. Create user
  9. </a>
  10. <table>
  11. <caption>Registered users</caption>
  12. <thead>
  13. <tr>
  14. <th>Username</th>
  15. <th>Email</th>
  16. <th>Status</th>
  17. <th>Role</th>
  18. <th>Num. notes</th>
  19. <th>Num. tags</th>
  20. <th>Created</th>
  21. <th>Updated</th>
  22. <th>Actions</th>
  23. </tr>
  24. </thead>
  25. <tbody>
  26. <?php foreach ($users as $user): ?>
  27. <tr>
  28. <td><?= Html::escape($user['username']) ?></td>
  29. <td><?= Html::escape($user['email']) ?></td>
  30. <td><?= $user['active'] ? 'Active' : 'Inactive' ?></td>
  31. <td><?= $user['is_admin'] ? 'Admin' : 'User' ?></td>
  32. <td><?= Html::escape($user['number_notes']) ?></td>
  33. <td><?= Html::escape($user['number_tags']) ?></td>
  34. <td><?= Html::escape(Date::humanize($user['created_at'])) ?></td>
  35. <td><?= Html::escape(Date::humanize($user['updated_at'])) ?></td>
  36. <td>
  37. <a href="<?= Url::build(['users', 'edit', $user['id']]) ?>">
  38. Edit
  39. </a>
  40. <a href="<?= Url::build(['users', 'delete', $user['id']]) ?>">
  41. Delete
  42. </a>
  43. </td>
  44. </tr>
  45. <?php endforeach ?>
  46. </tbody>
  47. </table>
  48. <?php $app->render('layouts/footer') ?>