template.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. class Template extends Model {
  3. protected static $table = "template";
  4. protected static $id_field = "id";
  5. protected static $fillable_fields = ["customer_id", "name", "json", "practice"];
  6. // Object methods
  7. public function getCustomer() {
  8. return Customer::get($this->customer_id);
  9. }
  10. public function renderBeforeTestForm() {
  11. $json = json_decode($this->json);
  12. $fields = $json->beforeTest;
  13. ?>
  14. <form method="post" enctype="multipart/form-data" id="before-test-form">
  15. <div class="alert alert-info">
  16. <i class="fal fa-fw fa-info-circle"></i>
  17. Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
  18. </div>
  19. <?php
  20. foreach($fields as $field) {
  21. Form::renderField($field);
  22. }
  23. ?>
  24. <input type="hidden" name="submit" value="<?=$_SESSION["csrf_token"]?>" />
  25. <span class="text-danger">Please note that it may take a while for photos to upload. Please do not refresh the page when it is uploading.</span><br />
  26. <button class="btn btn-primary mt-3" type="submit">
  27. Submit Info &amp; Photos
  28. </button>
  29. </form>
  30. <?php
  31. }
  32. public function renderDuringTestForm() {
  33. $json = json_decode($this->json);
  34. $fields = $json->duringTest;
  35. ?>
  36. <form method="post" id="test-form">
  37. <input type="hidden" name="duration" id="duration" value="" required />
  38. <div class="bg-light text-center p-3 mb-3" style="position: sticky; top: 104px; z-index: 1000;" id="test-stop-button-container">
  39. <div>
  40. <button class="btn btn-block btn-success mb-3" type="button" id="test-start-button">
  41. Start Timer
  42. </button>
  43. <button class="btn btn-block btn-danger mb-3" type="button" id="test-stop-button" style="display: none;">
  44. Stop Timer
  45. </button>
  46. <small><span id="test-duration-span">Photos uploaded successfully.<br />Please use the timer to record the duration that you were in the venue.<br /> Alternatively press <span class="text-danger">Stop Timer</span> immediately to skip the timer and note the duration in Additional Notes.</span></small>
  47. </div>
  48. </div>
  49. <div class="collapse" id="test-main-form-container">
  50. <div class="alert alert-info">
  51. <i class="fal fa-fw fa-info-circle"></i>
  52. Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
  53. </div>
  54. <?php
  55. foreach($fields as $field) {
  56. Form::renderField($field);
  57. }
  58. ?>
  59. <div class="bg-light text-center p-3 mt-3">
  60. <input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
  61. <button class="btn btn-block btn-primary" type="submit" id="test-submit-button">Submit Test Results</button>
  62. <small class="form-text text-muted d-none" id="test-no-internet-text">
  63. <span class="text-danger">No Internet Connectivity</span><br />
  64. Please check your Internet connectivity and try again.
  65. </small>
  66. <small id="test-submit-status">
  67. </small>
  68. </div>
  69. </div>
  70. </form>
  71. <?php
  72. }
  73. }
  74. ?>