test_form.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. /**
  3. * @controller test.php
  4. *
  5. * @var Test $test
  6. * @var Location $location
  7. * @var Project $project
  8. * @var Template $template
  9. */
  10. ?>
  11. <div class="container mt-3 py-4">
  12. <?php
  13. if($test->isConfirmed()) {
  14. $template->renderBeforeTestForm();
  15. }
  16. else if($test->hasStarted()) {
  17. $template->renderDuringTestForm();
  18. }
  19. else if($test->isPendingVerification()) {
  20. $json = json_decode($template->getJSON());
  21. $fields = $json->duringTest;
  22. $values = $test->getValues(true);
  23. ?>
  24. <div class="alert alert-info">
  25. <i class="fal fa-fw fa-info-circle"></i>
  26. <?=htmlspecialchars(__("Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes."))?>
  27. </div>
  28. <form method="post" id="test-form">
  29. <?php
  30. foreach($fields as $field) {
  31. $name = $field->name ?? false;
  32. if($name) {
  33. if(isset($test->$name)) $field->value = $test->$name;
  34. if(isset($values[$name])) $field->value = $values[$name];
  35. }
  36. $field->template = $template;
  37. Form::renderField($field);
  38. }
  39. ?>
  40. <input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
  41. <input type="hidden" name="void" id="void" value="0" />
  42. <div class="form-group">
  43. <button class="btn btn-block btn-success" type="submit" id="test-submit-button">
  44. <?=htmlspecialchars(__("Submit Test Results"))?>
  45. </button>
  46. </div>
  47. <p><?=htmlspecialchars(__("If the venue was closed, please enter notes and then click the button below."))?></p>
  48. <div class="form-group">
  49. <label for="void-notes"><?=htmlspecialchars(__("Venue Closed Notes"))?></label>
  50. <textarea class="form-control" type="text" name="void_notes" id="void-notes" rows="4" placeholder="<?=htmlspecialchars(__("Enter venue closed notes"))?>"></textarea>
  51. </div>
  52. <div class="form-group">
  53. <button class="btn btn-block btn-secondary" type="submit" id="test-void-button">
  54. <?=htmlspecialchars(__("Venue Was Closed"))?>
  55. </button>
  56. </div>
  57. <div class="text-center">
  58. <small class="form-text text-muted d-none" id="test-no-internet-text">
  59. <span class="text-danger"><?=htmlspecialchars(__("No Internet Connectivity"))?></span><br />
  60. <?=htmlspecialchars(__("Please check your Internet connectivity and try again."))?>
  61. </small>
  62. <small id="test-submit-status">
  63. </small>
  64. </div>
  65. </form>
  66. <?php
  67. }
  68. else {
  69. ?>
  70. <h2><?=htmlspecialchars(__("Test Completed"))?></h2>
  71. <div class="alert alert-success">
  72. <?=sprintf(htmlspecialchars(__("This test is now completed. %sClick here%s to return to the Account page.")), '<a href="/account">', '</a>')?>
  73. </div>
  74. <?php
  75. }
  76. ?>
  77. </div>