0) { $row_pregunta = $QIZ->get_quiz_pregunta ( $preg, "", "1" ); $title = utf8_encode($row_pregunta["qip_titol"]); $tipus_quiz = $row_pregunta["qip_tipus"]; $subtipus_quiz = $row_pregunta["qip_subtipus"]; $tau_r["pregunta"] = $preg; $tau_r["usr_ciutat"] = $_SESSION['CATS_USER_CIUTAT']; $tau_r["usr_id"] = $_SESSION['CATS_USER']; $id_resposta = $QIZ->buscar_quiz_respostes ($tau_r); if ($id_resposta) { $ha_respost = 1; } // que mostri la xuleta si es tipus=1 (que no es concurs) o si ja lha respost if ($tipus_quiz == 1 OR $ha_respost) { $mostrar_xuleta = 1; } } else { $title = "Jocs a Catalansalmon"; } if ($id_resposta) { $row = $QIZ-> get_quiz_respostes ($id_resposta, $opcio) ; $opcio1 = $row["qir_resposta1"]; $opcio2 = $row["qir_resposta2"]; $opcio3 = $row["qir_resposta3"]; $opcio4 = $row["qir_resposta4"]; $opcio5 = $row["qir_resposta5"]; $opcio6 = $row["qir_resposta6"]; $opcio7 = $row["qir_resposta7"]; $opcio8 = $row["qir_resposta8"]; $opcio9 = $row["qir_resposta9"]; $opcio10 = $row["qir_resposta10"]; } // --- llista de preguntes $t["opcio"] = 3; $t["status"] = 1; $t["orderby"] = "qip_ordre DESC"; $taula_preg = $QIZ->llistar_quiz_preguntes($t); $total_quizs = count($taula_preg); //print_r($taula_preg); $select_preguntes = ''; $prev = $preg - 1; $next = $preg + 1; $preg_prev = ($taula_preg[$prev] !="") ? '< ANTERIOR' : ""; $preg_next = ($taula_preg[$next] !="") ? 'SEGÜENT >' : ""; // llista de usuaris que han respost ------- $tu["opcio"] = 1; //$tu["tipus"] = "2,3,4"; // nomes els que tenen respostes correctes/incorrectes $tu["status"] = 1; $tu["groupby"] = "qir_usr_ciutat, qir_usr_id"; $tu["orderby"] = " total DESC"; $resu = $QIZ->llistar_quiz_respostes ($tu); $i = 0; while ($row = mysql_fetch_array($resu)) { $i++; $nom = utf8_encode($USR->get_usuari( $row["qir_usr_id"], $row["qir_usr_ciutat"], "usr_nom", "", "", 1 )); $nom_a_pel = utf8_encode($USR->get_usuari( $row["qir_usr_id"], $row["qir_usr_ciutat"], "usr_nom", "", "", 2 )); // sense colors $taula_usuaris[$i]["ciutat"] = $row["qir_usr_ciutat"]; $taula_usuaris[$i]["id"] = $row["qir_usr_id"]; $taula_usuaris[$i]["nom"] = $nom; $taula_usuaris[$i]["nom_a_pel"] = $nom_a_pel; } // ordenem la taula de dos dimensions pel nom foreach ($taula_usuaris as $clave => $fila) { $nomx[$clave] = $fila['nom']; } // Ordenar los datos con volumen descendiente, edición ascendiente array_multisort($nomx, SORT_ASC, $taula_usuaris); $select_usuaris = ''; // dades generals ----------------------- $t1["opcio"] = 2; $t1["status"] = 1; $t1["groupby"] = "qir_usr_ciutat, qir_usr_id"; $total_jugadors = $QIZ->llistar_quiz_respostes ($t1); $t2["opcio"] = 2; $t2["status"] = 1; $total_respostes_quiz = $QIZ->llistar_quiz_respostes ($t2); // mes respostes $t3["opcio"] = 4; $t3["status"] = 1; $t3["groupby"] = "qir_pregunta"; $t3["orderby"] = " total DESC "; $row3 = $QIZ->llistar_quiz_respostes ($t3); $top_quiz_n = $row3["qir_pregunta"]; $top_quiz = $QIZ->get_quiz_pregunta ( $top_quiz_n, "qip_titol", "1" ); // menyss respostes $t4["opcio"] = 4; $t4["status"] = 1; $t4["groupby"] = "qir_pregunta"; $t4["orderby"] = " total, qir_data "; $row4 = $QIZ->llistar_quiz_respostes ($t4); $bottom_quiz_n = $row4["qir_pregunta"]; $bottom_quiz = $QIZ->get_quiz_pregunta ( $bottom_quiz_n, "qip_titol", "1" ); $t5["opcio"] = 1; $t5["status"] = 1; $t5["groupby"] = "qir_usr_ciutat, qir_usr_id"; $t5["orderby"] = " total DESC"; $res = $QIZ->llistar_quiz_respostes ($t5); $row = mysql_fetch_array($res); $top_jugador = utf8_encode($USR->get_usuari( $row["qir_usr_id"], $row["qir_usr_ciutat"], "usr_nom", "", "", 1 )). " (".$row["total"].")"; // ============================================ // funcions // ============================================ // aixo anira a la classe_quiz.php. haura de ser recursiva! // ----------------------------------------------------------------------- // es pateja totes es respostes d'un usuari i mira quantes te de correctes i quantes incorrectes // ----------------------------------------------------------------------- function get_respostes_correctes_usuari ( $ok_nok, $usr_ciutat, $usr_id ) { GLOBAL $QIZ; //echo "
============
GET RESPOSTES CORRECTES USUARI: cit=$usr_ciutat / id=$usr_id --- ok_nok=$ok_nok
============"; if ($usr_id==0) { echo '
ERROR usuari=0 a fx get_respostes_correctes_usuari'; return 0; } $tf["opcio"] = 1; $tf["status"] = 1; $tf["usr_ciutat"] = $usr_ciutat; $tf["usr_id"] = $usr_id; $res = $QIZ->llistar_quiz_respostes ($tf); while ($row = mysql_fetch_array($res)) { //echo '
---mirem respostes del usuari '.$usr_id.' a la pregunta: '.$row["qir_pregunta"]; $total+= get_respostes_correctes_pregunta ( $ok_nok, $usr_ciutat, $usr_id, $row["qir_pregunta"]); } return $total; } // ----------------------------------------------------------------------- // aqui veiem QUANTES respostes d'un usuari i pregunta han estat correctes // ----------------------------------------------------------------------- function get_respostes_correctes_pregunta ( $ok_nok, $usr_ciutat, $usr_id, $pregunta) { GLOBAL $QIZ; $total = 0; //echo "
PREGUNTA: $pregunta --- usr ciutat/id=$usr_ciutat / $usr_id - ok_nok=$ok_nok
"; $t_opc = $QIZ->get_quiz_opcions ($pregunta, 1); // respostes correctes if ($pregunta > 0) { // respostes d'un usuari a una pregunta $taula["pregunta"] = $pregunta; $taula["usr_ciutat"] = $usr_ciutat; $taula["usr_id"] = $usr_id; $taula["status"] = 1; $result = $QIZ->llistar_quiz_respostes ($taula) ; $row = mysql_fetch_array($result); for ($k=1;$k<=10;$k++) { // recorrem les respsotes del usuari $field = "qir_resposta".$k; if ($row[$field] == $t_opc[$k]) { // si es correcta if ($ok_nok == 1) { // si busquem respostes correctes $total++; } } else { // si es incorrecta if ($ok_nok == 2) { // si busquem respostes INcorrectes $total++; } } //echo '
'.$field.'->'.$row[$field].' - resp correcta='.$t_opc[$k]; } } return $total; } ?> '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $t5["opcio"] = 1; $t5["tipus"] = "2,3,4"; // nomes els que tenen respostes correctes/incorrectes $t5["status"] = 1; $t5["groupby"] = "qir_usr_ciutat, qir_usr_id"; $t5["orderby"] = " total DESC"; $res = $QIZ->llistar_quiz_respostes ($t5); while ($row = mysql_fetch_array($res)) { $total_respostes = "xxx"; $total_quizs = $row["total"]; $respostes_ok = get_respostes_correctes_usuari( 1, $row["qir_usr_ciutat"], $row["qir_usr_id"] ); $respostes_nok = get_respostes_correctes_usuari( 2, $row["qir_usr_ciutat"], $row["qir_usr_id"] ); $encert = ($respostes_ok / $total_quizs * 10); $encert = number_format($encert, 1); echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ''; } echo '
0) { echo ''; echo ' '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Tria una quiz del desplegable de sota

o be
llistar_quiz_respostes ($tau2); $total_respostes = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $i++; $t_respostes[$i]["id"] = $row["qir_id"]; $t_respostes[$i]["nom"] = utf8_encode($USR->get_usuari( $row["qir_usr_id"], $row["qir_usr_ciutat"], "usr_nom", "", "", 1 )); for ($k=1;$k<=10;$k++){ $field = "qir_resposta".$k; $t_respostes[$i][$field] = $row[$field]; } } //print_r($t_respostes); if ($preg > 0) { $t_opc = $QIZ->get_quiz_opcions ($preg, 1); echo '
'; // això fa que sigui responsive mes o menys echo ''; echo ''; // --- capcelera ----------------------------------------------- echo ''; echo ' '; foreach ($t_opc as $key=>$value) { //$flag= ''; $flag_img = ($tipus_quiz==4) ? $dir_banderes_fragments."fr".$t_opc[$key].".png" : $dir_banderes.$t_opc[$key].".png"; $flag= ''; echo ''; } echo ''; // detall de respostes----------------------------------------------- if ( count($t_respostes) ) { foreach ($t_respostes as $key2=>$value2) { $total_fila = 0; $total_ok = 0; echo ''; echo ' '; foreach ($t_opc as $key=>$value) { $field = "qir_resposta".$key; if ($tipus_quiz == 2 OR $tipus_quiz==3 OR $tipus_quiz==4) { if ($t_respostes[$key2][$field] == $value) { echo ''; $total_ok++; } else { echo ''; } } else { if ($t_respostes[$key2][$field]==1) { echo ''; $total_columna[$key]++; $total_ok++; } else { echo ''; } $bg = ($t_respostes[$key2][$field]==1)? " ' " : ""; } } // --- total fila if ($tipus_quiz == 2) { // encara hem de veure que echo ' '; } else { echo ' '; } echo ''; } } //echo "
colomnes
"; //print_r($total_columna); // totals --------------------- echo ''; echo ' '; for ($i=1;$i<=10;$i++){ //echo ''; if ($tipus_quiz == 2) { echo ''; } else { if (!$mostrar_xuleta) { echo ''; } else { echo ''; } } } echo ''; // supertotals --------------------- echo ''; echo ' '; for ($i=1;$i<=10;$i++){ $supertotal = ( $total_columna[$i] == 0 ) ? 0 : intval( ($total_columna[$i]*100) / $total_respostes ); if ($tipus_quiz == 2) { echo ''; } else { if (!$mostrar_xuleta) { echo ''; } else { echo ''; } } } echo ''; echo '
'.$title.'
'; if ($tipus_quiz == 2) { echo $flag; } else { if (!$mostrar_xuleta) { // nomes mostra resultats si ha respost echo $flag; } else { echo '
'; echo $flag; echo ' '.utf8_encode($PAI->get_pais ($t_opc[$key],"pai_cat")).''; echo '
'; } } echo '
'.$t_respostes[$key2]["nom"].' '.($total_ok*10).'%'.($total_ok*10).'%
Respostes: '.$total_respostes.''.intval($total_columna[$i]).''; echo intval($total_columna[$i]); echo ''; echo intval($total_columna[$i]); echo ''; echo '
'; echo intval($total_columna[$i]); echo ' '.utf8_encode($PAI->get_pais ($t_opc[$i],"pai_cat")).': '.intval($total_columna[$i]).''; echo '
'; echo '
%'; echo $supertotal." %"; echo ''; echo $supertotal." %"; echo ''; echo '
'; echo $supertotal." %"; echo ' '.utf8_encode($PAI->get_pais ($t_opc[$i],"pai_cat")).': '.$supertotal.'%'; echo '
'; echo '
'; echo '
'; } ?>
0) { echo '

'.utf8_encode($USR->get_usuari( $usrid, $usrct, "usr_nom", "", "", 1 )).'

'; } else { if ($esmobil) { echo 'RESPON AQUEST QUIZ'; echo '

'; echo $preg_prev; echo " "; echo $preg_next; } else { echo $preg_prev; echo 'RESPON AQUEST QUIZ'; echo $preg_next; } } ?>
'; echo ''; //echo ''; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ''; echo ''; echo ' '; echo ''; $tux["opcio"] = 1; $tux["status"] = 1; $tux["usr_id"] = $usrid; $tux["usr_ciutat"] = $usrct; $tux["orderby"] = " qir_data DESC"; $resux = $QIZ->llistar_quiz_respostes ($tux); while ($row = mysql_fetch_array($resux)) { $total_respostes = 0; $respostes_ok = 0; $respostes_nok = 0; if ($row["qip_tipus"]==1) { for ($k=1;$k<=10;$k++) { // recorrem les respsotes del usuari $field = "qir_resposta".$k; if ($row["qip_tipus"]==1) { if ($row[$field] == 1) { $total_respostes++; } } } } else { $respostes_ok = get_respostes_correctes_pregunta ( 1, $row["qir_usr_ciutat"], $row["qir_usr_id"], $row["qir_pregunta"]); $respostes_nok = get_respostes_correctes_pregunta ( 2, $row["qir_usr_ciutat"], $row["qir_usr_id"], $row["qir_pregunta"]); $encert = $respostes_ok * 10; } echo ''; echo ' '; echo ' '; if ($row["qip_tipus"]==1) { echo ' '; } else { echo ' '; echo ' '; echo ' '; } echo ' '; echo ''; } echo '
estadistiques personalsOKNO OKencert
estadistiques personalsOKNO OKencert
Respostres
'.$row["qir_data"].''.utf8_encode($row["qip_titol"]).''.$total_respostes.''.$respostes_ok.''.$respostes_nok.''.$encert.' %
'; } ?>
'; echo '
estadistiques generals
Total quizs'.$total_quizs.'
Total jugadors'.$total_jugadors.'
Total respostes'.$total_respostes_quiz.'
Quiz amb MES respostes'.$top_quiz.'
Quiz amb MENYS respostes'.$bottom_quiz.'
Jugador amb MES respostes'.$top_jugador.'
'; ?>
llistar_quiz_preguntes($t); //print_r($taula_preg); echo ''; echo ''; echo ''; while ($row = mysql_fetch_array($result)) { $taux["opcio"] = 1; $taux["pregunta"] = $row["qip_id"]; $taux["status"] = 1; $result2 = $QIZ->llistar_quiz_respostes ($taux); $gran_total_respostes = mysql_num_rows($result2); echo ''; echo ' '; echo ' '; if ($row["qip_tipus"] == 1) { echo ' '; } else { echo ' '; echo ' '; echo ' '; } echo ''; } echo '
Per Quiz
QuizrespostesCorrectesincorrectes%
'.utf8_encode($row["qip_titol"]).''.$gran_total_respostes.' (no s\'aplica)'.$total_respostes_ok.'*'.$total_respostes_nok.'*'.$perc_total_respostes.'* %
'; echo '

(* = Pendent)

'; ?>
'; echo '
Per jugadors que han respost questionaris
jugadoresTotal RespostesQuestionarisCorrectes *incorrectes *% encert
'.utf8_encode($USR->get_usuari( $row["qir_usr_id"], $row["qir_usr_ciutat"], "usr_nom", "", "", 1 )).''.$total_respostes.''.$total_quizs.''.$respostes_ok.''.$respostes_nok.''.$encert.' %
'; echo '

* Hi ha quizs que són de preguntes, i per tant de respostes correctes i incorrectes, pero d\'altres son de llocs visitats, per tant no són avaluables. En les estadistiques d\'encerts valorem només els Quizs que fan preguntes del tipus correcte/incorrecte.

'; ?>