\n"; echo ""; echo "\n"; } function showPie($value){ $value= serialize($value); $value=base64_encode ($value); echo "
\n"; echo ""; echo "
\n"; } function showGraph($value){ $value= serialize($value); $value=base64_encode ($value); $titley=Global_15; $titlex=Global_17; $title='statistic'; echo "
\n"; echo ""; echo "
\n"; } function getQuestions($t_id){ $sql=" SELECT questions.q_id, count FROM questions JOIN statistics ON questions.q_id = statistics.q_id AND t_id =".intval($t_id)." AND count>0 ORDER BY count DESC"; $query=mysql_query($sql); $i=0; while($qu =mysql_fetch_array($query ,MYSQL_BOTH )){ $question[$i]['q_id']= $qu['q_id']; $question[$i]['count']= $qu['count']; $i++; } for($i=0;$i$b["count"]) return -1 ; else return 1 ; } usort($quest, "cmp"); if(count($quest)<10) $limit=count($quest); else $limit=10; getData($limit,$quest); } function getTopQuestionValues($quest){ function cmpTopQ($a, $b) { if($a['count']>$b['count']) return -1 ; else return 1 ; } usort($quest, "cmpTopQ"); if(count($quest)<10) $limit=count($quest); else $limit=10; for($i=0;$i<$limit;$i++){ $j=$i+1; $quest[$i][]=$quest[$i]['percentagCorrect']; // wert } return $quest; } function getStatisticInfoPie($t_id){ $sql= "SELECT percentage FROM topics WHERE t_id=".intval($t_id).""; $query= mysql_query($sql); $value = mysql_fetch_assoc($query); $percentageToPass=$value['percentage']; // durchgefallen $sql2= "SELECT count(lp_id)as failed FROM learnprogress WHERE t_id=".intval($t_id)." and percentage <= $percentageToPass"; $query2=mysql_query($sql2); $value2 = mysql_fetch_assoc($query2); $failed=$value2['failed']; if(!$failed)$failed=0; // bestandende Tests $sql3= "SELECT count(user_id)as passed FROM learnprogress WHERE t_id=".intval($t_id)." and percentage >= $percentageToPass "; $query3=mysql_query($sql3); $value3=mysql_fetch_assoc($query3); $passed=$value3['passed']; if(!$passed)$passed=0; $value = array(array(Statistic_04, $passed),array(Statistic_05, $failed)); return $value; } function getTopTenValues($quest){ function cmp($a, $b) { if($a["percentagCorrect"]>$b["percentagCorrect"]) return -1 ; else return 1 ; } usort($quest, "cmp"); // nach percentageCorrect absteigend sortieren if(count($quest)<10) $limit=count($quest); else $limit=10; for($i=0;$i<$limit;$i++){ $j=$i+1; $question[$i]['q_id']=$quest[$i]['q_id']; // wert $question[$i][]=$quest[$i]['percentagCorrect']; // wert } return $question; } function getFlopTenValues($quest){ function cmp($a, $b) { if($a["percentagCorrect"]>$b["percentagCorrect"]) return 1 ; else return -1 ; } usort($quest, "cmp"); if(count($quest)<10) $limit=count($quest); else $limit=10; for($i=0;$i<$limit;$i++){ $j=$i+1; $question[$i]['q_id']=$quest[$i]['q_id']; // wert $question[$i][]=$quest[$i]['percentagCorrect']; // wert } return $question; } function tableHead(){ echo "
"; echo""; echo ""; echo""; echo""; echo""; echo""; echo ""; echo""; } function getData($limit,$quest){ for($i=0;$i<$limit;$i++) { $j=$i+1; $qu= new Question(); $topics= new Topic(); $qu-> setID($quest[$i]['q_id']); $qu->loadQuestion(); $qu_text=$qu->getQuestion(); echo ""; echo""; echo""; echo""; // array Werte ausgeben echo""; echo""; echo ""; } } function getTopTenCorrect($quest){ tableHead(); function cmp($a, $b) { // nach percentageCorrect sortieren if($a["percentagCorrect"]>$b["percentagCorrect"]) return -1 ; else return 1 ; } usort($quest, "cmp"); // nach percentageCorrect absteigend sortieren if(count($quest)<10) $limit=count($quest); else $limit=10; getData($limit,$quest); echo "
".Global_10."".Global_06."".Global_08." ".Global_11."".Global_03."
$j".$quest[$i]['q_id']."".stripslashes($qu_text)." ". $quest[$i]['count']." ". $quest[$i]['percentagCorrect']."%
"; } function getFlopTenCorrects($quest){ tableHead(); function cmp($a, $b) { // nach percentageCorrect sortieren if($a["percentagCorrect"]>$b["percentagCorrect"]) return 1 ; else return -1 ; } usort($quest, "cmp"); // nach percentageCorrectaufsteigen sortieren if(count($quest)<10) $limit=count($quest); else $limit=10; getData($limit,$quest); } function getUserInfo(){ // registrierte Benutzer $sql="SELECT count(CN_name) as number FROM user"; $query = mysql_query($sql); $num = mysql_fetch_assoc($query); $number=$num['number']; // Admin Benutzer $sqlAdmin="SELECT count(user_id) as numberAdmin FROM user WHERE admin='".intval(1)."'"; $queryAdmin = mysql_query($sqlAdmin) OR die(mysql_error()); if(empty($queryAdmin)) $numberAdmin=0; else{ $numAdmin = mysql_fetch_assoc($queryAdmin); $numberAdmin=$numAdmin['numberAdmin']; } // Benutzer Class I Zertifikat $sqlRoot="SELECT count(CN_name) as numberRoot1 FROM user WHERE root='".mysql_real_escape_string("CA Cert Signing Authority")."'"; $queryRoot = mysql_query($sqlRoot); $numRoot = mysql_fetch_assoc($queryRoot); $numberRoot1=$numRoot['numberRoot1']; // Benutzer Class III Zertifikat $numberRoot3=$number-$numberRoot1; // Benutzer Post zusendung $sqlPost="SELECT count(CN_name) as numberPost FROM user WHERE sendCert='".mysql_real_escape_string(post)."'"; $queryPost = mysql_query($sqlPost); $numPost = mysql_fetch_assoc($queryPost); $numberPost=$numPost['numberPost']; // Benutzer Email zusendung $sqlMail="SELECT count(CN_name) as numberMail FROM user WHERE sendCert='".mysql_real_escape_string(email)."'"; $queryMail = mysql_query($sqlMail); $numMail = mysql_fetch_assoc($queryMail); $numberMail=$numMail['numberMail']; // Benuter, die kein Zertifikat möchten $numberNo=$number-($numberMail+$numberPost); // Spracheinstellung der Benutzer "DE" $sqlDE="SELECT count(CN_name) as numberDE FROM user WHERE lang='".mysql_real_escape_string(DE)."'"; $queryDE = mysql_query($sqlDE); $numDE = mysql_fetch_assoc($queryDE); $numberDE=$numDE['numberDE']; // Spracheinstellung der Benutzer "EN" $numberEN=$number-$numberDE; echo "
"; echo " ".Statistic_06." "; echo "

".Statistic_07."

"; echo "
"; echo""; echo "".$number."

"; echo ""; echo""; echo "".$numberAdmin."

"; echo "

".Statistic_10."

"; echo "
"; echo""; echo "".$numberRoot1."

"; echo ""; echo""; echo "".$numberRoot3."

"; echo "

".Statistic_13."

"; echo "
"; echo""; echo "".$numberDE."

"; echo ""; echo""; echo "".$numberEN."

"; echo "

".Statistic_16."

"; echo "
"; echo""; echo "".$numberPost."

"; echo ""; echo""; echo "".$numberMail."

"; echo ""; echo""; echo "".$numberNo."

"; echo "
"; } function getStatisticTest($t_id){ // min Prozentzahl ermittlen $sqlTopic= "SELECT percentage FROM topics"; $queryTopic= mysql_query($sqlTopic); $perc = mysql_fetch_assoc($queryTopic); $percentage=$perc['percentage']; // alle Daten ermitteln $sql="SELECT DISTINCT date from learnprogress WHERE t_id='".intval($t_id)."' ORDER BY date ASC "; $query= mysql_query($sql); $find=mysql_num_rows($query) ; if($find==0){ echo '
'.Global_07."
"; } else{ echo "
"; echo " ".Statistic_20." "; while($timestamp =mysql_fetch_array($query ,MYSQL_BOTH )){ $time=$timestamp['date']; // in arra speichern $sqlnum="SELECT count(lp_id)as number FROM learnprogress WHERE t_id='".intval($t_id)."' and date='$time'"; $querynum=mysql_query($sqlnum); $num = mysql_fetch_assoc($querynum); $count=$num['number']; $sqlPassed="SELECT count(lp_id)as pass FROM learnprogress WHERE percentage >= '".intval($percentage)."' and date='$time'"; $queryPassed=mysql_query($sqlPassed); if(empty($queryPassed)) $passed=0; else{ $numPassed = mysql_fetch_assoc($queryPassed); $passed=$numPassed['pass']; } echo "

".$time."

"; echo "
"; echo""; echo "".$count."

"; echo ""; echo""; echo "".$passed."


"; } } echo "
"; } ?>