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']);
block("black", "summary for " . $_POST['mnumber']);
- print "<b>Examples Submitted</b>";
+ if ( isset($SESSIONS_next) ) {
+ print "<b>Submitted for next session on " . $SESSIONS[$SESSIONS_next]['timestr'] . "</b>";
+
+ print "<table>";
+
+ if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM)[0] == 0) {
+ print "<tr><td>0 (0/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr>";
+ }
+ else {
+ $wdone = $db->query("SELECT thisdone,manydone FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM);
+ print "<tr><td>" . $wdone[0] . " (" . $wdone[1] . "/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr><br>";
+ }
+
+ print "</table>";
+
+ print "<br>";
+ }
+
+ print "<b>Examples submitted so far</b>";
print "<table>";
$tot_done = 0;
- foreach ($SESSIONS as $session) {
- if ($session['id'] == $SESSIONS_next) { break; }
+ if( isset($SESSIONS) ) {
+ foreach ($SESSIONS as $session) {
+ if ( isset($SESSIONS_next) ) {
+ if ($session['id'] == $SESSIONS_next) { break; }
+ }
- $exdone = $db->query("SELECT thisdone, manydone FROM workdone WHERE mnumber=" . $mnumber . " AND session=" . $session['id'])->fetch(PDO::FETCH_NUM);
+ $exdone = $db->query("SELECT thisdone, manydone FROM workdone WHERE mnumber=" . $mnumber . " AND session=" . $session['id'])->fetch(PDO::FETCH_NUM);
- if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
+ if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
- $tot_done = $tot_done + $exdone[1];
+ $tot_done = $tot_done + $exdone[1];
- print "<tr>";
- print "<td>" . $session['timestr'] . " </td>";
- print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . " </td>";
- print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . " </td>";
- print "</tr>";
+ print "<tr>";
+ print "<td>" . $session['timestr'] . " </td>";
+ print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . " </td>";
+ print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . " </td>";
+ print "</tr>";
+ }
}
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];
<th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
</tr>
<tr>
- <th align="left">Password:</th> <th align="left"><input type="text" name="password"></th>
+ <th align="left">Password:</th> <th align="left"><input type="password" name="password"></th>
</tr>
<tr><th colspan=2></th></tr>