test_form.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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->json);
  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. 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">Submit Test Results</button>
  32. <small class="form-text text-muted d-none" id="test-no-internet-text">
  33. <span class="text-danger">No Internet Connectivity</span><br />
  34. 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>Test Completed</h2>
  45. <div class="alert alert-success">This test is now completed. <a href="/account">Click here</a> to return to the Account page.</div>
  46. <?php
  47. }
  48. ?>
  49. </div>