aboutsummaryrefslogtreecommitdiff
path: root/admin-update.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin-update.php')
-rw-r--r--admin-update.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/admin-update.php b/admin-update.php
new file mode 100644
index 0000000..f0d3896
--- /dev/null
+++ b/admin-update.php
@@ -0,0 +1,39 @@
+<?php
+// Check the entries in the form and compare them with the
+// data in the database. If there are updates, then change
+// the data in the database and append the json file with
+// the changes.
+if (empty($_POST["note"])) {
+ return;
+}
+$notenneu = $_POST["note"];
+
+foreach ($notenneu as $matrikelnummer => $pruefungen) {
+ foreach ($pruefungen as $fach => $teilpruefungen) {
+ foreach ($teilpruefungen as $teilpruefung => $semesterliste) {
+ foreach ($semesterliste as $semestername => $note) {
+ if (!array_key_exists($fach,$students[$matrikelnummer]["noten"])) {
+ var_dump($students[$matrikelnummer]);
+ echo "<p>ERROR: Fach $fach bei $matrikelnummer existiert nicht</p>";
+ } else {
+ if (!empty($note) and (
+ empty($students[$matrikelnummer]["noten"][$fach][$teilpruefung]) or
+ $students[$matrikelnummer]["noten"][$fach][$teilpruefung] !== $note)) {
+ if (($teilpruefung === "klausur" and in_array($note,$notenklausur) or
+ $teilpruefung === "labor" and in_array($note,$notenlabor))) {
+ $students[$matrikelnummer]["noten"][$fach][$teilpruefung] = $note;
+ db_student_update_note($matrikelnummer,$fach,$teilpruefung,$note);
+ break;
+ } else {
+ var_dump($students[$matrikelnummer]);
+ echo "<p>ERROR: Note $note ungueltig fuer $matrikelnummer,$fach,$teilpruefung </p>";
+ }
+ }
+ }
+ }
+ }
+
+ }
+}
+
+?> \ No newline at end of file