Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

54 řádky
2.1KB

  1. <?php
  2. use CodeIgniter\Router\Router;
  3. ?>
  4. <?= $this->extend('templates/base') ?>
  5. <!-- title -->
  6. <?= $this->section('title') ?>Prestador<?= $this->endSection() ?>
  7. <!-- content -->
  8. <?= $this->section('content') ?>
  9. <h1><?= $title ?></h1>
  10. <form method="POST" action="<?= route_to('encuesta_submit', $id) ?>">
  11. <?= csrf_field() ?>
  12. <!-- PREGUNTAS -->
  13. <?php foreach ($preguntas as $pregunta) : ?>
  14. <div class="mb-3">
  15. <label for="<?= $pregunta['id'] ?>" class="form-label"><?= $pregunta['question'] ?></label>
  16. <!-- Pregunta texto -->
  17. <?php if ($pregunta['type'] === '1') : ?>
  18. <textarea name="<?= $pregunta['id'] ?>" id="<?= $pregunta['id'] ?>" cols="30" rows="1" class="form-control" required></textarea>
  19. <!-- Pregunta selección única -->
  20. <?php elseif ($pregunta['type'] === '2') : ?>
  21. <select class="form-control" name="<?= $pregunta['id'] ?>" id="<?= $pregunta['id'] ?>" required>
  22. <?php foreach (preg_split("/\r\n|\n|\r/", $pregunta['frm_option']) as $opcion) : ?>
  23. <option value="<?= $opcion ?>">
  24. <?= $opcion ?>
  25. </option>
  26. <?php endforeach ?>
  27. </select>
  28. <!-- Pregunta selección múltiple -->
  29. <?php elseif ($pregunta['type'] === '3') : ?>
  30. <?php foreach (preg_split("/\r\n|\n|\r/", $pregunta['frm_option']) as $opcion) : ?>
  31. <div class="form-check">
  32. <input class="form-check-input" type="checkbox" name="<?= $pregunta['id'] ?>[<?= $opcion ?>]" value="<?= $opcion ?>" id="<?= $opcion ?>">
  33. <label class="form-check-label" for="<?= $opcion ?>">
  34. <?= $opcion ?>
  35. </label>
  36. </div>
  37. <?php endforeach ?>
  38. <?php endif ?>
  39. </div>
  40. <?php endforeach ?>
  41. <a href="<?= route_to('home') ?>" class="btn btn-danger">Cancelar</a>
  42. <input type="submit" class="btn btn-dark" value="Enviar">
  43. </form>
  44. <?= $this->endSection() ?>