54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php
|
|
|
|
use CodeIgniter\Router\Router;
|
|
?>
|
|
<?= $this->extend('templates/base') ?>
|
|
|
|
<!-- title -->
|
|
<?= $this->section('title') ?>Prestador<?= $this->endSection() ?>
|
|
|
|
<!-- content -->
|
|
<?= $this->section('content') ?>
|
|
|
|
<h1><?= $title ?></h1>
|
|
|
|
<form method="POST" action="<?= route_to('encuesta_submit', $id) ?>">
|
|
<?= csrf_field() ?>
|
|
|
|
<!-- PREGUNTAS -->
|
|
<?php foreach ($preguntas as $pregunta) : ?>
|
|
<div class="mb-3">
|
|
<label for="<?= $pregunta['id'] ?>" class="form-label"><?= $pregunta['question'] ?></label>
|
|
<!-- Pregunta texto -->
|
|
<?php if ($pregunta['type'] === '1') : ?>
|
|
<textarea name="<?= $pregunta['id'] ?>" id="<?= $pregunta['id'] ?>" cols="30" rows="1" class="form-control" required></textarea>
|
|
|
|
<!-- Pregunta selección única -->
|
|
<?php elseif ($pregunta['type'] === '2') : ?>
|
|
<select class="form-control" name="<?= $pregunta['id'] ?>" id="<?= $pregunta['id'] ?>" required>
|
|
<?php foreach (preg_split("/\r\n|\n|\r/", $pregunta['frm_option']) as $opcion) : ?>
|
|
<option value="<?= $opcion ?>">
|
|
<?= $opcion ?>
|
|
</option>
|
|
<?php endforeach ?>
|
|
</select>
|
|
|
|
<!-- Pregunta selección múltiple -->
|
|
<?php elseif ($pregunta['type'] === '3') : ?>
|
|
<?php foreach (preg_split("/\r\n|\n|\r/", $pregunta['frm_option']) as $opcion) : ?>
|
|
<div class="form-check">
|
|
|
|
<input class="form-check-input" type="checkbox" name="<?= $pregunta['id'] ?>[<?= $opcion ?>]" value="<?= $opcion ?>" id="<?= $opcion ?>">
|
|
<label class="form-check-label" for="<?= $opcion ?>">
|
|
<?= $opcion ?>
|
|
</label>
|
|
</div>
|
|
<?php endforeach ?>
|
|
<?php endif ?>
|
|
</div>
|
|
<?php endforeach ?>
|
|
|
|
<a href="<?= route_to('home') ?>" class="btn btn-danger">Cancelar</a>
|
|
<input type="submit" class="btn btn-dark" value="Enviar">
|
|
</form>
|
|
<?= $this->endSection() ?>
|