test_form.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <div class="container mt-3 py-4">
  2. <?php
  3. if($test->status == Test::STATUS_CONFIRMED) {
  4. $template->renderBeforeTestForm();
  5. }
  6. else if($test->status == Test::STATUS_STARTED) {
  7. $template->renderDuringTestForm();
  8. }
  9. else if($test->status == Test::STATUS_PENDING_VERIFICATION) {
  10. $json = json_decode($template->getJSON());
  11. $fields = $json->duringTest;
  12. $values = $test->getValues(true);
  13. ?>
  14. <div class="alert alert-info">
  15. <i class="fal fa-fw fa-info-circle"></i>
  16. <?=htmlspecialchars(__("Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes."))?>
  17. </div>
  18. <form method="post" id="test-form">
  19. <?php
  20. foreach($fields as $field) {
  21. $name = $field->name ?? false;
  22. if($name) {
  23. if(isset($test->$name)) $field->value = $test->$name;
  24. if(isset($values[$name])) $field->value = $values[$name];
  25. }
  26. Form::renderField($field);
  27. }
  28. ?>
  29. <div class="bg-light text-center p-3 mt-3">
  30. <input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
  31. <button class="btn btn-block btn-primary" type="submit" id="test-submit-button"><?=htmlspecialchars(__("Submit Test Results"))?></button>
  32. <small class="form-text text-muted d-none" id="test-no-internet-text">
  33. <span class="text-danger"><?=htmlspecialchars(__("No Internet Connectivity"))?></span><br />
  34. <?=htmlspecialchars(__("Please check your Internet connectivity and try again."))?>
  35. </small>
  36. <small id="test-submit-status">
  37. </small>
  38. </div>
  39. </form>
  40. <?php
  41. }
  42. else {
  43. ?>
  44. <h2><?=htmlspecialchars(__("Test Completed"))?></h2>
  45. <div class="alert alert-success">
  46. <?=sprintf(htmlspecialchars(__("This test is now completed. %sClick here%s to return to the Account page.")), '<a href="/account">', '</a>')?>
  47. </div>
  48. <?php
  49. }
  50. ?>
  51. </div>