\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"
".Global_10."
";
echo"
".Global_06."
";
echo"
".Global_08."
";
echo"
".Global_11."
";
echo "
".Global_03."
";
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"
$j
";
echo"
".$quest[$i]['q_id']."
";
echo"
".stripslashes($qu_text)."
"; // array Werte ausgeben
echo"
". $quest[$i]['count']."
";
echo"
". $quest[$i]['percentagCorrect']."%
";
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 "
";
}
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 "";
}
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 '