2 require 'include/head.inc';
3 require 'include/db.inc';
4 require 'include/session.inc';
5 require 'include/exams.inc';
6 require 'include/common.inc';
8 if ($db->query("SELECT COUNT(*) FROM students")->fetch(PDO::FETCH_NUM)[0] == 0) {
9 block("red", "no students registered");
13 block("black", "summary of everything for " . date("d.m.Y H:i"));
15 $result = $db->query("SELECT firstname, lastname, mnumber, blackboard FROM students ORDER BY LOWER(lastname)");
18 print "<td><b>First name </b></td><td><b>Last name </b></td><td><b>Matr.nummer </b></td><td><b>Blackboard </b></td><td><b>Examples </b></td><td><b>Exams </b></td>";
20 while ($student = $result->fetch(PDO::FETCH_ASSOC)) {
22 if( $db->query("SELECT COUNT(*) FROM workdone WHERE mnumber=" . $student['mnumber'])->fetch(PDO::FETCH_NUM)[0] > 0 ) {
23 $exdone = $db->query("SELECT manydone FROM workdone WHERE mnumber=" . $student['mnumber']);
24 while ( $subdone = $exdone->fetch(PDO::FETCH_NUM) ) { $totexdone += $subdone[0]; }
28 foreach ($EXAMS as $exam) {
29 $scorestr = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $student['mnumber'] . " AND exam=" . $exam['id'])->fetch(PDO::FETCH_NUM)[0];
30 if ($scorestr != "") {
32 foreach (explode(',',$scorestr) as $points) { $singlescore = $singlescore + $points; }
33 $examscore = $examscore + $singlescore/$exam['totscore'];
36 $examscore = ($examscore / $EXAMS_n)*100;
39 print "<td>" . $student['firstname'] . "</td>";
40 print "<td>" . $student['lastname'] . "</td>";
41 print "<td>" . $student['mnumber'] . "</td>";
43 print($student['blackboard']);
46 printf("%3d", round(100 * floatval($totexdone) / floatval($SESSIONS_totex_nextinc)));
49 printf("%3d", round($examscore));