2   require 'include/head.inc';
 
   3   require 'include/db.inc';
 
   4   require 'include/session.inc';
 
   5   require 'include/common.inc';
 
   6   require 'include/exams.inc';
 
   8   if(isset($_POST['submit']) && $_POST['mnumber']!="") {
 
   9     $mnumber = trim($_POST['mnumber']);
 
  10     $password = trim($_POST['password']);
 
  12     require 'include/usercheck.inc';
 
  14     block("black", "summary for " . $_POST['mnumber']);
 
  16     if ( isset($SESSIONS_next) ) {
 
  17        print "<b>Submitted for next session on " . $SESSIONS[$SESSIONS_next]['timestr']  . "</b>";
 
  21        if($db->query("SELECT COUNT(*) FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM)[0] == 0) {
 
  22          print "<tr><td>0 (0/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr>";
 
  25          $wdone = $db->query("SELECT thisdone,manydone FROM workdone WHERE mnumber = $mnumber AND session = $SESSIONS_next")->fetch(PDO::FETCH_NUM);
 
  26          print "<tr><td>" . $wdone[0] . " (" . $wdone[1] . "/" . $SESSIONS[$SESSIONS_next]['nexamples'] . ")</td></tr><br>";
 
  34     print "<b>Examples submitted so far</b>";
 
  39     if( isset($SESSIONS) ) {
 
  40       foreach ($SESSIONS as $session) {
 
  41         if ( isset($SESSIONS_next) ) {
 
  42           if ($session['id'] == $SESSIONS_next) { break; }
 
  45         $exdone = $db->query("SELECT thisdone, manydone FROM workdone WHERE mnumber=" . $mnumber . " AND session=" . $session['id'])->fetch(PDO::FETCH_NUM);
 
  47         if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
 
  49         $tot_done = $tot_done + $exdone[1];
 
  52         print "<td>" . $session['timestr'] . "  </td>";
 
  53         print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . "  </td>";
 
  54         print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . "  </td>";
 
  59     print "<td></td><td></td><td><b>" . $tot_done . "/" . $SESSIONS_totex . " ==> " . round(100 * $tot_done / $SESSIONS_totex) . "%</b></td>";
 
  66     print "<b>Exams</b><br>";
 
  71     foreach ($EXAMS as $exam) {
 
  72       $scorestr = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $mnumber . " AND exam=" . $exam['id'])->fetch(PDO::FETCH_NUM)[0];
 
  74       if ($scorestr != "") {
 
  75         foreach (explode(',',$scorestr) as $points) { $singlescore = $singlescore + $points; }
 
  76         $examscore = $examscore + $singlescore/$exam['totscore']; 
 
  80       print "<td>" . $exam['timestr'] . "  </td>";
 
  81       print "<td>{" . $scorestr . "}=" . $singlescore . "/" . $exam['totscore'] . "  </td>";
 
  82       print "<td>" . round(100*$singlescore/$exam['totscore']) . "%  </td>";
 
  85     $examscore = ($examscore / $EXAMS_n)*100;
 
  89       print "<td></td><td></td>";
 
  90       print "<td><b>" . round($examscore) . "%</b></td>";            
 
  98     print "<b>Blackboard</b>";
 
  99     $blackdone = $db->query("SELECT blackboard FROM students WHERE mnumber=" . $mnumber)->fetch(PDO::FETCH_NUM)[0];
 
 103     for( $ib=0; $ib<$blackdone; $ib++ ) { echo " * "; }
 
 109 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
 
 110   <table bgcolor="black">
 
 111     <tr><th><b><font color="white">Summary</font></b></th><tr>
 
 116       <th align="left">Mat.nummer:</th> <th align="left"><input type="text" name="mnumber"></th>
 
 119       <th align="left">Password:</th> <th align="left"><input type="password" name="password"></th>
 
 121     <tr><th colspan=2></th></tr>
 
 124       <th align="left"><input type="submit" name="submit" value="Show"></th> <th></th>