<?php require_once 'processes/config.php'; require_once 'processes/dbh.inc.php'; require_once 'processes/checkLogin.php'; include_once 'header.php'; //include("conection.php"); include("funciones.php"); //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 $id_experiencia = mysqli_real_escape_string($connection, trim($_GET['exp'])); //$id_student = 1860; ///////Busca cantidad de sub cuestionarios - Empieza//////////////// $sqlSelect = sprintf("SELECT count(*) FROM experience_questionnair eq, subquestionnair qs where eq.id_questionnair=qs.id_questionnair and eq.id_experience = %s", GetSQLValueString($id_experiencia, "int") ); $dbresultSel = mysqli_query($connection, $sqlSelect); $row = mysqli_fetch_array($dbresultSel); $cant_sub_subquestionnair = $row[0]; //print($cant_sub_subquestionnair); ///////Termina - Busca cantidad de sub cuestionarios - //////////////// ///////Busca Preguntas - Empieza//////////////// $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", GetSQLValueString($id_experiencia, "int") ); $dbresultSel = mysqli_query($connection, $sqlSelect); $resultados = array(); $j = 1; while($row = mysqli_fetch_array($dbresultSel)) { //$preguntas[] = array($i, $row['premise']); $emas = array(); $emas[] = $j; $emas[] = $row['premise']; $emas[] = " "; // PRE test // SUBQUESTIONNAIRES for($i = 1; $i <= $cant_sub_subquestionnair-2; $i++) { $emas[] = " "; } $emas[] = " "; // POST test $emas[] = " "; // Average $emas[] = " "; // Standard Deviation $emas[] = " "; // Percent Change between EMA and PRE $emas[] = " "; // Percent Change between POST and EMA $emas[] = " "; // Percent Change between POST and PRE $resultados[] = $emas; $j++; } ///////Termina - Busca Preguntas - //////////////// ///////Busca Estudiantes - Empieza//////////////// $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", GetSQLValueString($id_experiencia, "int") ); $dbresultEst = mysqli_query($connection,$sqlSelectEst); ///////Termina - Busca Estudiantes - //////////////// ?> <!--START OF respuestas.php--> <body> <header id="main-header"> <a id="logo" href="."> TANIA <img src="./img/pen_800x800.png" alt="tania logo pen" width="25" height="25"> </a> <div id="account"> <a class="sign-out" href="./processes/logout.php">Sign Out</a> </div> </header> <?php if($id_experiencia == 1): ?> <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> <?php endif; ?> <div class="container" style="margin-top: 12vh;"> <div class="row"> <div class="col"> <table class="table table-bordered"> <thead> <tr> <th scope="col" style="vertical-align: middle; text-align: center;" rowspan="2" style="width:30px">#</th> <th scope="col"> <form> <select class="form-control" id="id_student" style="text-align-last: center;"> <option disabled selected>Select Student</option> <option selected value="all">All Students</option> <?php while($rowEst = mysqli_fetch_array($dbresultEst)): ?> <option value='<?php echo $rowEst['id_stu']; ?>'><?php echo $rowEst['id_stu']; ?></option> <?php endwhile; ?> </select> <input type="hidden" value="<?php echo $id_experiencia;?>" id="id_experiencia"> </form> </th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">Pre</th> <th colspan="<?php echo $cant_sub_subquestionnair - 2;?>" style="vertical-align: middle; text-align: center;">Moments</th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">Post</th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">x̄</th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">σ</th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% Δ<br><small>Ema - Pre</small></th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% Δ<br><small>Post - Ema</small></th> <th scope="col" rowspan="2" style="width:30px; vertical-align: middle; text-align: center;">% Δ<br><small>Post - Pre</small></th> </tr> <tr> <th> <form> <select class="form-control" id="tipo_resumen" style="text-align-last: center;"> <option value="0" selected>Questions</option> <option value="1">Subcategories</option> <option value="2">Categories</option> </select> <input type="hidden" value="<?php echo $id_experiencia;?>" id="id_experiencia"> </form> </th> <?php for($i = 1; $i <= $cant_sub_subquestionnair-2; $i++): ?> <th scope="col" style="width:30px vertical-align: middle; text-align: center;""><?php echo $i; ?></th> <?php endfor; ?> </tr> </thead> <tbody id="loqueseve"> <?php foreach($resultados as $pregunta): ?> <tr> <?php foreach($pregunta as $item): ?> <td style="vertical-align: middle; text-align: center;"><?php echo $item ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> </div><!--col--> </div><!--row--> <div class="row"> <div class="col"> <form id="exportForm" method="POST" action="processes/export.php"> <input type="hidden" name="id_student" value="all"> <input type="hidden" name="id_exp" value="<?php echo $id_experiencia; ?>"> <input type="hidden" name="res_type" value="0"> <button type="submit" name="export" class="btn btn-info">Export</button> </form> </div><!--col--> </div><!--row--> </div><!--container--> <script> window.onload = function() { $("#tipo_resumen").change(function() { let inputs = document.querySelector('#exportForm').children; inputs[2].value = $("#tipo_resumen").val(); $.post("respuestasData.php", { id_student: $("#id_student").val(), id_exp: $("#id_experiencia").val(), res_type: $("#tipo_resumen").val() }, function(data, status) { $("#loqueseve").html(data); } ); }); $("#id_student").change(function() { let inputs = document.querySelector('#exportForm').children; inputs[0].value = $("#id_student").val(); $.post("respuestasData.php", { id_student: $("#id_student").val(), id_exp: $("#id_experiencia").val(), res_type: $("#tipo_resumen").val() }, function(data, status) { $("#loqueseve").html(data); } ); }); } </script> </body> </html>