<?php
if (! isset($db)) {
if ($db = new PDO('sqlite:banane.db')) {
- $db->query('CREATE TABLE IF NOT EXISTS students
- (mnumber int, firstname string, lastname string, email string, password string, blackboard int DEFAULT 0, PRIMARY KEY (mnumber))');
+ $db->query('CREATE TABLE IF NOT EXISTS students
+ (mnumber int, firstname string, lastname string, email string, password string, blackboard int DEFAULT 0, lastblackboard TIMESTAMP, PRIMARY KEY (mnumber))');
$db->query('CREATE TABLE IF NOT EXISTS workdone
- (mnumber int, session int, manydone int, thisdone string)');
+ (mnumber int, session int, manydone int, thisdone string, tstamp TIMESTAMP)');
$db->query('CREATE TABLE IF NOT EXISTS prefs
(key string, value string, PRIMARY KEY (key))');
$db->query('CREATE TABLE IF NOT EXISTS sessions
- (id int NOT NULL, timestr string NOT NULL, PRIMARY KEY (id))');
+ (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
+ $db->query('CREATE TABLE IF NOT EXISTS exams
+ (id int NOT NULL, score string, PRIMARY KEY (id))');
+ $db->query('CREATE TABLE IF NOT EXISTS examscore
+ (mnumber int, exam int, scorestr string, tstamp TIMESTAMP)');
}
}
?>
<a href="sessionoverview.php">session overview</a>
|
+<a href="examoverview.php">exam overview</a>
+ |
<a href="summary.php">summary</a>
|
<a href="blackboard.php">blackboard</a>
|
<a href="sessions.php">sessions</a>
|
+<a href="exams.php">exams</a>
+ |
<a href="prefs.php">preferences</a>
|
<a href="password.php">password</a>
require 'include/head.inc';
require 'include/db.inc';
require 'include/session.inc';
+ require 'include/exams.inc';
require 'include/common.inc';
if ($db->query("SELECT COUNT(*) FROM students")->fetch(PDO::FETCH_NUM)[0] == 0) {
$result = $db->query("SELECT firstname, lastname, mnumber, blackboard FROM students ORDER BY LOWER(lastname)");
print "<table>";
- print "<td><b>First name </b></td><td><b>Last name </b></td><td><b>Matr.nummer </b></td><td><b>Examples </b></td><td><b>Blackboard </b></td>";
+ 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>";
+
while ($student = $result->fetch(PDO::FETCH_ASSOC)) {
$totexdone = 0;
if( $db->query("SELECT COUNT(*) FROM workdone WHERE mnumber=" . $student['mnumber'])->fetch(PDO::FETCH_NUM)[0] > 0 ) {
$exdone = $db->query("SELECT manydone FROM workdone WHERE mnumber=" . $student['mnumber']);
while ( $subdone = $exdone->fetch(PDO::FETCH_NUM) ) { $totexdone += $subdone[0]; }
}
+
+ $examscore=0;
+ foreach ($EXAMS as $exam) {
+ $scorestr = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $student['mnumber'] . " AND exam=" . $exam['id'])->fetch(PDO::FETCH_NUM)[0];
+ if ($scorestr != "") {
+ $singlescore = 0;
+ foreach (explode(',',$scorestr) as $points) { $singlescore = $singlescore + $points; }
+ $examscore = $examscore + $singlescore/$exam['totscore'];
+ }
+ }
+ $examscore = ($examscore / $EXAMS_n)*100;
+
print "<tr>";
print "<td>" . $student['firstname'] . "</td>";
print "<td>" . $student['lastname'] . "</td>";
print "<td>" . $student['mnumber'] . "</td>";
- print "<td>" . $totexdone . "/" . $SESSIONS_totex_nextinc . "</td>";
- print "<td>" . $student['blackboard'] . "</td>";
+ print "<td>";
+ print($student['blackboard']);
+ print "</td>";
+ print "<td>";
+ printf("%3d", round(100 * floatval($totexdone) / floatval($SESSIONS_totex_nextinc)));
+ print "%</td>";
+ print "<td>";
+ printf("%3d", round($examscore));
+ print "%</td>";
print "</tr>";
}
+
print "</table>";
?>
\ No newline at end of file
$db->query('CREATE TABLE IF NOT EXISTS prefs
(key string, value string, PRIMARY KEY (key))');
$db->query('CREATE TABLE IF NOT EXISTS sessions
- (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
+ (id int NOT NULL, examples string, nexamples int, PRIMARY KEY (id))');
+ $db->query('CREATE TABLE IF NOT EXISTS exams
+ (id int NOT NULL, score string, PRIMARY KEY (id))');
+ $db->query('CREATE TABLE IF NOT EXISTS examscore
+ (mnumber int, exam int, scorestr string, tstamp TIMESTAMP)');
}
}
?>
require 'include/db.inc';
require 'include/session.inc';
require 'include/common.inc';
+ require 'include/exams.inc';
if(isset($_POST['submit']) && $_POST['mnumber']!="") {
$mnumber = trim($_POST['mnumber']);
}
}
print "<tr>";
- print "<td></td><td></td><td><b>" . $tot_done . "/" . $SESSIONS_totex . "</b></td>";
+ print "<td></td><td></td><td><b>" . $tot_done . "/" . $SESSIONS_totex . " ==> " . round(100 * $tot_done / $SESSIONS_totex) . "%</b></td>";
print "</tr>";
print "</table>";
print "<br>";
+ print "<b>Exams</b><br>";
+
+ print "<table>";
+
+ $examscore=0;
+ foreach ($EXAMS as $exam) {
+ $scorestr = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $mnumber . " AND exam=" . $exam['id'])->fetch(PDO::FETCH_NUM)[0];
+ $singlescore = 0;
+ if ($scorestr != "") {
+ foreach (explode(',',$scorestr) as $points) { $singlescore = $singlescore + $points; }
+ $examscore = $examscore + $singlescore/$exam['totscore'];
+ }
+
+ print "<tr>";
+ print "<td>" . $exam['timestr'] . " </td>";
+ print "<td>{" . $scorestr . "}=" . $singlescore . "/" . $exam['totscore'] . " </td>";
+ print "<td>" . round(100*$singlescore/$exam['totscore']) . "% </td>";
+ print "</tr>";
+ }
+ $examscore = ($examscore / $EXAMS_n)*100;
+
+ if ($EXAMS_n > 0 ) {
+ print "<tr>";
+ print "<td></td><td></td>";
+ print "<td><b>" . round($examscore) . "%</b></td>";
+ print "</tr>";
+ }
+
+ print "</table>";
+
+ print "<br>";
+
print "<b>Blackboard</b>";
$blackdone = $db->query("SELECT blackboard FROM students WHERE mnumber=" . $mnumber)->fetch(PDO::FETCH_NUM)[0];