From: Alexander Schmidt Date: Thu, 29 Nov 2012 13:41:29 +0000 (+0100) Subject: forgot some files. X-Git-Url: https://git.treefish.org/banana.git/commitdiff_plain/40b00377877560ee2c6c4d5a771824059deac819?hp=7c6abf783f4b583b0c8bc43ad434fcce37a3dcc7 forgot some files. --- diff --git a/admin/examoverview.php b/admin/examoverview.php new file mode 100644 index 0000000..b82ff5c --- /dev/null +++ b/admin/examoverview.php @@ -0,0 +1,94 @@ +query("SELECT COUNT(*) FROM examscore WHERE mnumber=$up_mnumber AND exam=$up_examid AND tstamp=$up_tstamp")->fetch(PDO::FETCH_NUM)[0] == 0 ) { + $db->query("DELETE FROM examscore WHERE mnumber=$up_mnumber AND exam=$up_examid"); + $db->query("INSERT INTO examscore (exam,mnumber,scorestr,tstamp) values ($up_examid,$up_mnumber,\"$up_scorestr\",$up_tstamp)"); + block("lightgreen", "modified submit"); + } + } + + print "
"; + print ""; + print "
"; + + block("black", "summary for exam " . $EXAMS[$showexam]['timestr'] . " (" . $EXAMS[$showexam]['scorestr'] . ")"); + + $result = $db->query("SELECT firstname, lastname, mnumber FROM students ORDER BY LOWER(lastname)"); + + print ""; + print ""; + + # if( isset($EXAMS_actual) && $showexam == $EXAMS_actual ) { + # print ""; + # } + # else { + # print ""; + # } + + while ($student = $result->fetch(PDO::FETCH_ASSOC)) { + $result2 = $db->query("SELECT scorestr FROM examscore WHERE mnumber=" . $student['mnumber'] . " AND exam=" . $showexam)->fetch(PDO::FETCH_NUM); + + $exdone = $result2[0]; + if ($exdone == "") { $exdone=0; } + + $scorestr = $result2[0]; + + $totscore = 0; + foreach (explode(',',$scorestr) as $points) { + $totscore = $totscore + $points; + } + + print ""; + print ""; + print ""; + print ""; + print ""; + + print ""; + + print ""; + } + print "
First name Last name Matr.nummer Total Score Blackboard Modify 
" . $student['firstname'] . "" . $student['lastname'] . "" . $student['mnumber'] . "" . $totscore . "/" . $EXAMS[$showexam]['totscore'] . "
"; + if( isset($_GET['examselected']) ) { print ""; } + print ""; + print ""; + print ""; + print ""; + print "
"; +?> diff --git a/admin/exams.php b/admin/exams.php new file mode 100644 index 0000000..902956b --- /dev/null +++ b/admin/exams.php @@ -0,0 +1,56 @@ +query("INSERT INTO exams (id,score) VALUES (" . strtotime(trim($_POST['stime'])) . ",'" . $_POST['score'] . "')"); + block("lightgreen", "added exam"); + } + + if(isset($_GET['delete'])) { + $db->query("DELETE FROM exams WHERE id=" . $_GET['delete']); + block("red", "deleted exam"); + } + + require 'include/exams.inc'; + + block("black", "add exam"); +?> + +
+ + + + + + + + +
Time: (e.g. 10.9.2012 10:30)
Score: (e.g. 4,5,5)
+
+ +"; + foreach ($EXAMS as $exam) { + print ""; + print "" . $exam['id'] . "  "; + print "" . $exam['timestr'] . "  "; + print "" . $exam['scorestr'] . "(" . $exam['nquests'] . ")" . "  "; + print "" . $exam['totscore'] . "  "; + if ($exam['nresults'] == 0) { + print "delete"; + } + else { print "locked"; } + print ""; + } + print ""; + +?> \ No newline at end of file diff --git a/admin/include/exams.inc b/admin/include/exams.inc new file mode 120000 index 0000000..fdc9de9 --- /dev/null +++ b/admin/include/exams.inc @@ -0,0 +1 @@ +../../include/exams.inc \ No newline at end of file diff --git a/include/exams.inc b/include/exams.inc new file mode 100644 index 0000000..1e3f9a0 --- /dev/null +++ b/include/exams.inc @@ -0,0 +1,43 @@ +query("SELECT id,score FROM exams ORDER BY id"); + $EXAMS_next = -1; + $EXAMS_actual = -1; + $EXAMS_n = 0; + + while ($exam = $result->fetch(PDO::FETCH_ASSOC)) { + $totpoints = 0; + foreach (explode(',',$exam['score']) as $points) { + $totpoints = $totpoints + $points; + } + $EXAMS[$exam['id']] = array("id" => $exam['id'], + "timestr" => date("d.m.Y H:i", $exam['id']), + "scorestr" => $exam['score'], + "totscore" => $totpoints, + "nresults" => $db->query("SELECT COUNT(*) FROM examscore WHERE exam=" . $exam['id'])->fetch(PDO::FETCH_NUM)[0], + "nquests" => count(explode(',',$exam['score']))); + if ( strtotime("now") < $exam['id'] && ( $EXAMS_next==-1 || $EXAMS_next > $exam['id'] ) ) { + $EXAMS_next = $exam['id']; + } + if ( strtotime("now") < $exam['id'] + 3600 && ( $EXAMS_actual==-1 || $EXAMS_actual > $exam['id'] ) ) { + $EXAMS_actual = $exam['id']; + } + $EXAMS_n++; + } + if($EXAMS_next == -1) unset($EXAMS_next); + if($EXAMS_actual == -1) unset($EXAMS_actual); + + $EXAMS_totscore = 0; + $EXAMS_totscore_nextinc = 0; + if(isset($EXAMS)) { + foreach ($EXAMS as $exam) { + if( (! isset($EXAMS_next)) || $exam['id'] < $EXAMS_next ) { $EXAMS_totscore += $exam['totscore']; } + if( (! isset($EXAMS_actual)) || $exam['id'] != $EXAMS_actual ) { $EXAMS_last = $exam['id']; } + if( (! isset($EXAMS_next)) || $exam['id'] <= $EXAMS_next ) { $EXAMS_totscore_nextinc += $exam['totscore']; } + } + } + + } +?>