| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <?php
- class Template extends Model {
- protected static $table = "template";
- protected static $id_field = "id";
- protected static $fillable_fields = ["customer_id", "name", "json"];
- protected static $field_map = [
- ];
- // Object methods
- public function getCustomer() {
- return Customer::get($this->customer_id);
- }
- public function renderBeforeTestForm() {
- $json = json_decode($this->json);
- $fields = $json->beforeTest;
- ?>
- <form method="post" enctype="multipart/form-data" id="before-test-form">
- <div class="alert alert-info">
- <i class="fal fa-fw fa-info-circle"></i>
- Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
- </div>
- <?php
- foreach($fields as $field) {
- Form::renderField($field);
- }
- ?>
- <button class="btn btn-primary" type="submit" name="submit" value="<?=$_SESSION["csrf_token"]?>">Start Test</button><br />
- <div class="d-none mt-3" data-submitting-div>
- <i class="fal fa-fw fa-pulse fa-spinner"></i> Please wait a moment while the form submits.
- </div>
- </form>
- <?php
- }
- public function renderDuringTestForm() {
- $json = json_decode($this->json);
- $fields = $json->duringTest;
- ?>
- <form method="post" id="test-form">
- <input type="hidden" name="duration" id="duration" value="" required />
- <div class="bg-light text-center p-3 mb-3" style="position: sticky; top: 104px; z-index: 1000;" id="test-stop-button-container">
- <div>
- <button class="btn btn-block btn-success" type="button" id="test-start-button">
- Start Test
- </button>
- <button class="btn btn-block btn-danger" type="button" id="test-stop-button" style="display: none;">
- Stop Test
- </button>
- <small><span id="test-duration-span">0 min. 0 sec.</span></small>
- </div>
- </div>
- <div class="alert alert-info">
- <i class="fal fa-fw fa-info-circle"></i>
- Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
- </div>
- <?php
- foreach($fields as $field) {
- Form::renderField($field);
- }
- ?>
- <div class="bg-light text-center p-3 mt-3 d-none" id="test-submit-button-container">
- <input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
- <button class="btn btn-block btn-primary" type="submit" id="test-submit-button">Submit Test Results</button>
- <small class="form-text text-muted d-none" id="test-no-internet-text">
- <span class="text-danger">No Internet Connectivity</span><br />
- Please check your Internet connectivity and try again.
- </small>
- <small id="test-submit-status">
- </small>
- </div>
- </form>
- <?php
- }
- }
- ?>
|