Açıklama Yok

respuestas.php 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. require_once 'processes/config.php';
  3. require_once 'processes/dbh.inc.php';
  4. require_once 'processes/checkLogin.php';
  5. include_once 'header.php';
  6. //include("conection.php");
  7. include("funciones.php");
  8. //SELECT a.id_question, q.premise, a.id_subquestionnair , q.id_category,q.id_subcategory FROM `answer` a, question q WHERE a.`id_student` = 1860 and a.id_question=q.id ORDER BY `a`.`id_question` ASC
  9. $id_experiencia = mysqli_real_escape_string($connection, trim($_GET['exp']));
  10. //$id_student = 1860;
  11. ///////Busca cantidad de sub cuestionarios - Empieza////////////////
  12. $sqlSelect = sprintf("SELECT count(*) FROM experience_questionnair eq, subquestionnair qs where eq.id_questionnair=qs.id_questionnair and eq.id_experience = %s",
  13. GetSQLValueString($id_experiencia, "int")
  14. );
  15. $dbresultSel = mysqli_query($connection, $sqlSelect);
  16. $row = mysqli_fetch_array($dbresultSel);
  17. $cant_sub_subquestionnair = $row[0];
  18. //print($cant_sub_subquestionnair);
  19. ///////Termina - Busca cantidad de sub cuestionarios - ////////////////
  20. ///////Busca Preguntas - Empieza////////////////
  21. $sqlSelect = sprintf("SELECT distinct q.* FROM `experience_questionnair` eq, questionnair_question qq, question q WHERE eq.id_questionnair=qq.`id_questionnair` and qq.id_question=q.id and id_experience = %s order by q.id",
  22. GetSQLValueString($id_experiencia, "int")
  23. );
  24. $dbresultSel = mysqli_query($connection, $sqlSelect);
  25. $resultados = array();
  26. $j = 1;
  27. while($row = mysqli_fetch_array($dbresultSel)) {
  28. //$preguntas[] = array($i, $row['premise']);
  29. $emas = array();
  30. $emas[] = $j;
  31. $emas[] = $row['premise'];
  32. $emas[] = " "; // PRE test
  33. // SUBQUESTIONNAIRES
  34. for($i = 1; $i <= $cant_sub_subquestionnair-2; $i++) {
  35. $emas[] = " ";
  36. }
  37. $emas[] = " "; // POST test
  38. $emas[] = " "; // Average
  39. $emas[] = " "; // Standard Deviation
  40. $emas[] = " "; // Percent Change between EMA and PRE
  41. $emas[] = " "; // Percent Change between POST and EMA
  42. $emas[] = " "; // Percent Change between POST and PRE
  43. $resultados[] = $emas;
  44. $j++;
  45. }
  46. ///////Termina - Busca Preguntas - ////////////////
  47. ///////Busca Estudiantes - Empieza////////////////
  48. $sqlSelectEst = sprintf("SELECT s.id id_stu FROM student s, student_participate_experience se WHERE s.id=se.id_student and se.id_experience = %s order by id_stu",
  49. GetSQLValueString($id_experiencia, "int")
  50. );
  51. $dbresultEst = mysqli_query($connection,$sqlSelectEst);
  52. ///////Termina - Busca Estudiantes - ////////////////
  53. ?>
  54. <!--START OF respuestas.php-->
  55. <body>
  56. <header id="main-header">
  57. <a id="logo" href=".">
  58. TANIA
  59. <img src="./img/pen_800x800.png" alt="tania logo pen" width="25" height="25">
  60. </a>
  61. <div id="account">
  62. <a class="nav-link" href="./questionnaires.php">Questionnaire Collection</a>
  63. <a class="sign-out" href="./processes/logout.php">Sign Out</a>
  64. </div>
  65. </header>
  66. <?php if($id_experiencia == 1): ?>
  67. <div class="container" style="margin-top: 12vh;"><div class="row"><div class="col"><h4>Warning: Este script no funciona para esta experiencia en particular (la parte de escoger los resultados por cada estudiante).</h4></div></div></div>
  68. <?php endif; ?>
  69. <div class="container" style="margin-top: 12vh;">
  70. <div class="row">
  71. <div class="col">
  72. <table class="table table-bordered">
  73. <thead>
  74. <tr>
  75. <th scope="col" style="vertical-align: middle; text-align: center;" rowspan="2" style="width:30px">#</th>
  76. <th scope="col">
  77. <form>
  78. <select class="form-control" id="id_student" style="text-align-last: center;">
  79. <option disabled selected>Select Student</option>
  80. <option selected value="all">All Students</option>
  81. <?php while($rowEst = mysqli_fetch_array($dbresultEst)): ?>
  82. <option value='<?php echo $rowEst['id_stu']; ?>'><?php echo $rowEst['id_stu']; ?></option>
  83. <?php endwhile; ?>
  84. </select>
  85. <input type="hidden" value="<?php echo $id_experiencia;?>" id="id_experiencia">
  86. </form>
  87. </th>
  88. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">Pre</th>
  89. <th colspan="<?php echo $cant_sub_subquestionnair - 2;?>" style="vertical-align: middle; text-align: center;">Moments</th>
  90. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">Post</th>
  91. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">x&#772</th>
  92. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">&sigma;</th>
  93. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% &Delta;<br><small>Ema - Pre</small></th>
  94. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% &Delta;<br><small>Post - Ema</small></th>
  95. <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% &Delta;<br><small>Post - Pre</small></th>
  96. </tr>
  97. <tr>
  98. <th>
  99. <form>
  100. <select class="form-control" id="tipo_resumen" style="text-align-last: center;">
  101. <option value="0" selected>Questions</option>
  102. <option value="1">Subcategories</option>
  103. <option value="2">Categories</option>
  104. </select>
  105. <input type="hidden" value="<?php echo $id_experiencia;?>" id="id_experiencia">
  106. </form>
  107. </th>
  108. <?php for($i = 1; $i <= $cant_sub_subquestionnair-2; $i++): ?>
  109. <th scope="col" style="width:30px vertical-align: middle; text-align: center;""><?php echo $i; ?></th>
  110. <?php endfor; ?>
  111. </tr>
  112. </thead>
  113. <tbody id="loqueseve">
  114. <?php foreach($resultados as $pregunta): ?>
  115. <tr>
  116. <?php foreach($pregunta as $item): ?>
  117. <td style="vertical-align: middle; text-align: center;"><?php echo $item ?></td>
  118. <?php endforeach; ?>
  119. </tr>
  120. <?php endforeach; ?>
  121. </tbody>
  122. </table>
  123. </div><!--col-->
  124. </div><!--row-->
  125. <div class="row">
  126. <div class="col">
  127. <form id="exportForm" method="POST" action="processes/export.php">
  128. <input type="hidden" name="id_student" value="all">
  129. <input type="hidden" name="id_exp" value="<?php echo $id_experiencia; ?>">
  130. <input type="hidden" name="res_type" value="0">
  131. <button type="submit" name="export" class="btn btn-info">Export</button>
  132. </form>
  133. </div><!--col-->
  134. </div><!--row-->
  135. </div><!--container-->
  136. <script>
  137. window.onload = function() {
  138. $("#tipo_resumen").change(function() {
  139. let inputs = document.querySelector('#exportForm').children;
  140. inputs[2].value = $("#tipo_resumen").val();
  141. $.post("respuestasData.php",
  142. {
  143. id_student: $("#id_student").val(),
  144. id_exp: $("#id_experiencia").val(),
  145. res_type: $("#tipo_resumen").val()
  146. },
  147. function(data, status) {
  148. $("#loqueseve").html(data);
  149. }
  150. );
  151. });
  152. $("#id_student").change(function() {
  153. let inputs = document.querySelector('#exportForm').children;
  154. inputs[0].value = $("#id_student").val();
  155. $.post("respuestasData.php",
  156. {
  157. id_student: $("#id_student").val(),
  158. id_exp: $("#id_experiencia").val(),
  159. res_type: $("#tipo_resumen").val()
  160. },
  161. function(data, status) {
  162. $("#loqueseve").html(data);
  163. }
  164. );
  165. });
  166. }
  167. </script>
  168. </body>
  169. </html>