From: Alexander Schmidt Date: Wed, 26 Sep 2012 14:09:46 +0000 (+0200) Subject: ... X-Git-Url: https://git.treefish.org/banana.git/commitdiff_plain/3f75cb10d008938dca476577d6256765093d1932?ds=inline ... --- diff --git a/admin/include/nav.inc b/admin/include/nav.inc index d473d97..896f85c 100644 --- a/admin/include/nav.inc +++ b/admin/include/nav.inc @@ -6,6 +6,8 @@ a:focus { text-decoration:none; font-weight:normal; color:blue; } +next session + | summary | blackboard diff --git a/admin/nextsession.php b/admin/nextsession.php new file mode 100644 index 0000000..ca467fd --- /dev/null +++ b/admin/nextsession.php @@ -0,0 +1,30 @@ +query("SELECT firstname, lastname, mnumber, blackboard FROM students ORDER BY lastname"); + + print ""; + print ""; + while ($student = $result->fetch(PDO::FETCH_ASSOC)) { + $result2 = $db->query("SELECT manydone, thisdone FROM workdone WHERE mnumber=" . $student['mnumber'] . " AND session=" . $SESSIONS_actual)->fetch(PDO::FETCH_NUM); + + $exdone = $result2[0]; + if ($exdone == "") { $exdone=0; } + + $thisdone = $result2[1]; + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + } + print "
First name Last name Matr.nummer Examples Blackboard 
" . $student['firstname'] . "" . $student['lastname'] . "" . $student['mnumber'] . "" . $thisdone . " (" . $exdone . "/" . $SESSIONS[$SESSIONS_actual]['nexamples'] . ")" . $student['blackboard'] . "
"; +?> \ No newline at end of file diff --git a/admin/summary.php b/admin/summary.php index 345f5a0..0cd5467 100644 --- a/admin/summary.php +++ b/admin/summary.php @@ -18,7 +18,7 @@ print "" . $student['firstname'] . ""; print "" . $student['lastname'] . ""; print "" . $student['mnumber'] . ""; - print "" . $totexdone . "/" . $SESSIONS_totex . ""; + print "" . $totexdone . "/" . $SESSIONS_totex_nextinc . ""; print "" . $student['blackboard'] . ""; print ""; } diff --git a/include/session.inc b/include/session.inc index 7b5b798..c31441e 100644 --- a/include/session.inc +++ b/include/session.inc @@ -1,6 +1,8 @@ query("SELECT id,examples,nexamples FROM sessions ORDER BY id"); $SESSIONS_next = -1; + $SESSIONS_actual = -1; + while ($session = $result->fetch(PDO::FETCH_ASSOC)) { $SESSIONS[$session['id']] = array("id" => $session['id'], "timestr" => date("d.m.Y H:i", $session['id']), "workdone" => $db->query("SELECT COUNT(*) FROM workdone WHERE session=" . $session['id'])->fetch(PDO::FETCH_NUM)[0], @@ -8,6 +10,9 @@ if ( strtotime("now") < $session['id'] && ( $SESSIONS_next==-1 || $SESSIONS_next > $session['id'] ) ) { $SESSIONS_next = $session['id']; } + if ( strtotime("now") < $session['id'] + 3600 && ( $SESSIONS_actual==-1 || $SESSIONS_actual > $session['id'] ) ) { + $SESSIONS_actual = $session['id']; + } } if($SESSIONS_next == -1) unset($SESSIONS_next); @@ -15,4 +20,9 @@ foreach ($SESSIONS as $session) { if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; } } + + $SESSIONS_totex_nextinc = 0; + foreach ($SESSIONS as $session) { + if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; } + } ?>