test_list_assigned.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <div class="container mt-3 py-4">
  2. <h2>Your Tests</h2>
  3. <?php
  4. if(empty($tests)) {
  5. ?>
  6. <div class="alert alert-info">
  7. There are no tests assigned to you at this time.
  8. </div>
  9. <?php
  10. }
  11. else {
  12. ?>
  13. <table class="table table-sm table-hover">
  14. <thead>
  15. <th>ID</th>
  16. <th>Location</th>
  17. <th>Date Due</th>
  18. <th>Status</th>
  19. <th></th>
  20. </thead>
  21. <?php
  22. foreach($tests as $test) {
  23. $location = $test->getLocation();
  24. $project = $test->getProject();
  25. $dts_due = $test->dts_due ?? $project->dts_deadline;
  26. $date_due = explode(" ", $dts_due)[0];
  27. $date_due = date("d/m/Y", strtotime($date_due));
  28. $is_assigned = $test->status == Test::STATUS_ASSIGNED;
  29. $is_confirmed = $test->status == Test::STATUS_CONFIRMED;
  30. $is_unverified = $test->status == Test::STATUS_PENDING_VERIFICATION;
  31. $status_text = $test->getStatusText();
  32. if($is_unverified) $status_text = "Unverified";
  33. ?>
  34. <tr>
  35. <td>
  36. <?=$test->id?>
  37. </td>
  38. <td>
  39. <?=htmlspecialchars($location->name)?><br />
  40. <small><?=htmlspecialchars($location->getDisplayAddress())?></small>
  41. </td>
  42. <td class="align-middle">
  43. <?=$date_due?>
  44. </td>
  45. <td class="text-center align-middle">
  46. <span class="badge badge-lg badge-<?=$test->getStatusClass()?>">
  47. <?=$status_text?>
  48. </span>
  49. </td>
  50. <td class="text-right align-middle">
  51. <?php
  52. if($is_assigned) {
  53. ?>
  54. <a class="btn btn-outline-success" href="/account/tests/<?=$test->id?>/accept">Accept</a>
  55. <a class="btn btn-outline-danger" href="/account/tests/<?=$test->id?>/decline">Decline</a>
  56. <?php
  57. }
  58. else if($is_confirmed) {
  59. ?>
  60. <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>">Begin</a>
  61. <?php
  62. }
  63. else if($is_unverified) {
  64. ?>
  65. <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>">Amend</a>
  66. <?php
  67. }
  68. ?>
  69. </td>
  70. </tr>
  71. <?php
  72. }
  73. ?>
  74. </table>
  75. <?php
  76. }
  77. ?>
  78. </div>