Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

99 wiersze
4.0KB

  1. <?= $this->extend('templates/baseAdmin') ?>
  2. <?= $this->section('content') ?>
  3. <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
  4. <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
  5. <h1><?= $tituloEncuesta ?></h1>
  6. <div class="card">
  7. <div class="card-body">
  8. <table id="table-respuestas" class="table table-bordered table-striped">
  9. <thead>
  10. <th>ID Prestador</th>
  11. <th>Nombre</th>
  12. <th>Fecha</th>
  13. <?php foreach ($preguntas as $pregunta) : ?>
  14. <th><?= $pregunta['question'] ?></th>
  15. <?php endforeach ?>
  16. </thead>
  17. <tbody>
  18. <?php foreach ($respuestas as $user) : ?>
  19. <tr>
  20. <td><?= $user[0][0]['idprestador'] ?></td>
  21. <td><?= $user[0][0]['nombre'] . ' ' . $user[0][0]['apaterno'] . ' ' . $user[0][0]['amaterno'] ?></td>
  22. <td><?= $user[0][0]['created_at'] ?></td>
  23. <?php foreach ($user as $respuesta) : ?>
  24. <!-- Respuestas de opción múltiple -->
  25. <?php if ($respuesta[0]['type'] === '3') : ?>
  26. <td>
  27. <?php foreach ($respuesta as $opcion) : ?>
  28. <?= $opcion['answer'] ?>
  29. <br>
  30. <?php endforeach ?>
  31. </td>
  32. <?php else : ?>
  33. <td><?= $respuesta[0]['answer'] ?></td>
  34. <?php endif ?>
  35. <?php endforeach ?>
  36. </tr>
  37. <?php endforeach ?>
  38. </tbody>
  39. </table>
  40. </div>
  41. </div>
  42. <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
  43. <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
  44. <script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
  45. <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
  46. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
  47. <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
  48. <script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
  49. <script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
  50. <script>
  51. $(document).ready(function() {
  52. $('#table-respuestas').DataTable({
  53. dom: 'Bfrtip',
  54. buttons: [
  55. 'copy', 'csv', 'excel', 'pdf', 'print'
  56. ]
  57. });
  58. });
  59. // document.addEventListener('DOMContentLoaded', function() {
  60. // let table = new DataTable('#table-respuestas', {
  61. // 'buttons': ['excel'],
  62. // 'searching': true,
  63. // 'ordering': true,
  64. // 'language': {
  65. // "decimal": "",
  66. // "emptyTable": "No hay información",
  67. // "info": "Mostrando _START_ a _END_ de _TOTAL_ registros",
  68. // "infoEmpty": "Mostrando 0 to 0 of 0 registros",
  69. // "infoFiltered": "(Filtrado de _MAX_ total registros)",
  70. // "infoPostFix": "",
  71. // "thousands": ",",
  72. // "lengthMenu": "Mostrar _MENU_ registros",
  73. // "loadingRecords": "Cargando...",
  74. // "processing": "Procesando...",
  75. // "search": "Buscar:",
  76. // "zeroRecords": "No se encontraron resultados",
  77. // "paginate": {
  78. // "first": "Primero",
  79. // "last": "Ultimo",
  80. // "next": "Siguiente",
  81. // "previous": "Anterior"
  82. // }
  83. // },
  84. // 'order': [],
  85. // });
  86. // });
  87. </script>
  88. <?= $this->endSection() ?>