]> git.treefish.org Git - banana.git/blobdiff - summary.php
...
[banana.git] / summary.php
diff --git a/summary.php b/summary.php
new file mode 100644 (file)
index 0000000..3354ca3
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+  require 'include/head.inc';
+  require 'include/db.inc';
+  require 'include/session.inc';
+  require 'include/common.inc';
+
+  if(isset($_POST['submit']) && $_POST['mnumber']!="") {
+    $mnumber = trim($_POST['mnumber']);
+    $password = trim($_POST['password']);
+    
+    require 'include/usercheck.inc';
+
+    block("black", "summary for " . $_POST['mnumber']);
+
+    print "<b>Examples Submitted</b>";
+    print "<table>";
+
+    $tot_done = 0;
+
+    foreach ($SESSIONS as $session) {
+      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);
+
+      if ( $exdone[1] == "" ) { $exdone[1] = "0"; }
+
+      $tot_done = $tot_done + $exdone[1];
+
+      print "<tr>";
+      print "<td>" . $session['timestr'] . "&nbsp;&nbsp;</td>";
+      print "<td>" . $session['examples'] . "(" . $session['nexamples'] . ")" . "&nbsp;&nbsp;</td>";
+      print "<td>" . $exdone[1] . "/" . $session['nexamples'] . "(" . $exdone[0] . ")" . "&nbsp;&nbsp;</td>";
+      print "</tr>";
+    }
+    print "<tr>";
+    print "<td></td><td></td><td><b>" . $tot_done . "/" . $SESSIONS_totex . "</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];
+    
+    print "<br>";
+
+    for( $ib=0; $ib<$blackdone; $ib++ ) { echo "&nbsp;*&nbsp;"; }
+
+    break;
+  }  
+?>
+
+<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
+  <table bgcolor="black">
+    <tr><th><b><font color="white">Last submission</font></b></th><tr>
+  </table>
+
+  <table>
+    <tr>  
+      <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>
+    </tr>
+    <tr><th colspan=2></th></tr>
+
+    <tr>
+      <th align="left"><input type="submit" name="submit" value="Show"></th> <th></th>
+    </tr>
+  </table>
+</form>