aboutsummaryrefslogtreecommitdiff
path: root/admin-update.php
diff options
context:
space:
mode:
authorFriedrich Beckmann <friedrich.beckmann@gmx.de>2026-01-30 17:59:23 +0100
committerFriedrich Beckmann <friedrich.beckmann@gmx.de>2026-01-30 17:59:23 +0100
commitd0fce093ef2f16fc2897baf7ddf93b6f969890bf (patch)
treec39446943c2a36c4bafcaa5e1640d3ea85721a90 /admin-update.php
initial commit
The first prototype where you can upload student data from moodle and change the marks. In student view the results for the logged in person can be viewed.
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