123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?php
- $tipo_resumen="Categoria";
-
-
- $sqlSelect = sprintf("SELECT SQ.* FROM `experience_questionnair` AS EQ JOIN subquestionnair AS SQ WHERE EQ.id_questionnair = SQ.id_questionnair AND EQ.id_experience = %s ORDER BY SQ.date_to_administer",
- GetSQLValueString($id_experiencia, "int")
- );
- $dbresultSel = mysqli_query($connection,$sqlSelect);
- $subQs=array();
- while($row=mysqli_fetch_array($dbresultSel))
- {
- $subQs[]=$row['id'];
- }
-
- $cant_sub_subquestionnair=count($subQs);
-
-
-
-
-
- $sqlSelect = sprintf("SELECT distinct id_category id, categoria premise FROM experience_subquestionnair eq, subquestionnair_question qq, question q, category sc WHERE eq.id_subquestionnair=qq.`id_subquestionnair` and qq.id_question=q.id and id_experience = %s and q.id_category=sc.id order by id_category",
- GetSQLValueString($id_experiencia, "int")
- );
- $dbresultSel = mysqli_query($connection,$sqlSelect);
- $preguntas=array();
- $i=1;
- while($row=mysqli_fetch_array($dbresultSel))
- {
- $preguntas[$row['id']]=array($i,$row['premise']);
-
- $i++;
- }
- $num_pregs=$i--;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if($id_student=="all")
- {
- $sqlSelect = sprintf("SELECT id_category id_question, a.id_subquestionnair , avg(a.value) value FROM answer a, question q, subquestionnair_question qq, experience_subquestionnair eq WHERE eq.id_subquestionnair=qq.id_subquestionnair and qq.id_question=q.id and a.id_question=q.id and eq.id_experience = %s group by a.id_subquestionnair,id_category ORDER BY `id_category`,`a`.`id_subquestionnair` ASC",
- GetSQLValueString($id_experiencia, "int")
- );
-
- }
- else
- {
- $sqlSelect = sprintf("SELECT id_category id_question, a.id_subquestionnair , avg(a.value) value FROM answer a, question q, subquestionnair_question qq, experience_subquestionnair eq WHERE eq.id_subquestionnair=qq.id_subquestionnair and qq.id_question=q.id and a.id_question=q.id and eq.id_experience = %s and a.id_student= %s group BY `id_category`,`a`.`id_subquestionnair` ORDER BY `id_category`,`a`.`id_subquestionnair` ASC",
- GetSQLValueString($id_experiencia, "int"),
- GetSQLValueString($id_student, "int")
- );
-
-
- }
- $dbresultSel = mysqli_query($connection,$sqlSelect);
- while($row=mysqli_fetch_array($dbresultSel))
- {
- $ema[$row['id_question']][$row['id_subquestionnair']]=$row['value'];
- }
-
- foreach($preguntas as $id => $pregs)
- {
-
- foreach($subQs as $idSq)
- {
- if($ema[$id][$idSq])$preguntas[$id][]=siDecimal2($ema[$id][$idSq]);
- else $preguntas[$id][]=" ";
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $posFinal=$cant_sub_subquestionnair;
- $i=0;
- foreach($preguntas as $id => $pregs)
- {
-
-
- $valores=$ema[$id];
- $ema_vals=array_slice($preguntas[$id],3,$posFinal-2);
-
-
- $preguntas[$id][]=siDecimal2(average($valores));
- $preguntas[$id][]=siDecimal2(stddev($valores));
- $preguntas[$id][]=siDecimal2(porcientoCambio($ema[$id][$subQs[0]],average($ema_vals)));
-
- $preguntas[$id][]=siDecimal2(porcientoCambio(average($ema_vals),$ema[$id][$subQs[$posFinal-1]]));
- $preguntas[$id][]=siDecimal2(porcientoCambio($ema[$id][$subQs[0]],$ema[$id][$subQs[$posFinal-1]]));
-
- }
-
-
- ?>
|