aboutsummaryrefslogtreecommitdiff
path: root/admin-show.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-show.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-show.php')
-rw-r--r--admin-show.php154
1 files changed, 154 insertions, 0 deletions
diff --git a/admin-show.php b/admin-show.php
new file mode 100644
index 0000000..10394d8
--- /dev/null
+++ b/admin-show.php
@@ -0,0 +1,154 @@
+<?php
+include "setup.php";
+if (session_status() === PHP_SESSION_NONE) {
+ my_session_start();
+}
+$login=false;
+if (isset($_SESSION["login"])) {
+ $login = $_SESSION["login"];
+}
+
+if ($login !== "admin") {
+ header("Location: index.php");
+ exit;
+}
+?>
+
+<!DOCTYPE html>
+<html>
+<body>
+<h1>Listenansicht</h1>
+
+<table>
+<tr>
+<td>
+ <a href="admin-addusers.php">Add students</a>
+</td>
+<td>
+ <a href="admin-show.php">Show students</a>
+</td>
+<td>
+ <a href="logout.php">Logout</a>
+</td>
+</tr>
+</table>
+
+<?php
+
+
+// If we pushed the update button, update the database
+if (!empty($_POST["update"])) {
+ include "admin-update.php";
+}
+
+//var_dump($_POST);
+
+if (!empty($_POST["note"])) {
+ //var_dump($_POST["note"]);
+}
+
+if (!empty($_POST["semester"])) {
+ $selectedsemester = $_POST["semester"];
+} else {
+ $selectedsemester = "alle";
+}
+if (!empty($_POST["pruefung"])) {
+ $selectedpruefung = $_POST["pruefung"];
+} else {
+ $selectedpruefung = "alle";
+}
+echo "<form action=\"admin-show.php\" method=\"post\">";
+echo "<table>";
+echo "<tr>";
+echo "<th>Semester</th>";
+echo "<th>Prüfung</th>";
+echo "<th>Gruppe</th>";
+echo "<th>Nachname</th>";
+echo "<th>Vorname</th>";
+echo "<th>Labor</th>";
+echo "<th>Klausur</th>";
+echo "</tr>";
+echo "<tr>";
+echo "<td>";
+echo "<select name=\"semester\">";
+if ($selectedsemester === "alle") {
+echo "<option value=\"alle\" selected>alle</option>";
+} else {
+echo "<option value=\"alle\">alle</option>";
+}
+foreach ($semester as $semestername) {
+ if ($selectedsemester === $semestername) {
+ echo "<option value=\"$semestername\" selected>$semestername</option>";
+ } else {
+ echo "<option value=\"$semestername\">$semestername</option>";
+ }
+}
+echo "</select>";
+echo "</td>";
+echo "<td>";
+echo "<select name=\"pruefung\">";
+if ($selectedpruefung === "alle") {
+echo "<option value=\"alle\" selected>alle</option>";
+} else {
+echo "<option value=\"alle\">alle</option>";
+}
+foreach ($pfp as $pruefung => $value) {
+ if ($selectedpruefung === $pruefung) {
+ echo "<option value=\"$pruefung\" selected>$pruefung</option>";
+ } else {
+ echo "<option value=\"$pruefung\">$pruefung</option>";
+ }
+}
+echo "</select>";
+echo "</td>";
+echo "<td></td>";
+echo "<td>";
+echo "<input type=\"submit\" name=\"filter\" value=\"filter\">";
+echo "</td>";
+//echo "</form>";
+echo "</tr>";
+//echo "</table>";
+
+//echo "<form action=\"admin-show.php\" method=\"post\">";
+//echo "<table>";
+foreach ($groups as $semester => $pruefungen) {
+ if ($selectedsemester === "alle" or $selectedsemester === $semester) {
+ foreach ($pruefungen as $pruefung => $groupsperpruefung) {
+ if ($selectedpruefung === "alle" or $selectedpruefung === $pruefung) {
+ foreach ($groupsperpruefung as $groupname => $teilnehmerarray) {
+ foreach ($teilnehmerarray as $matrikelnummer) {
+ echo "<tr>";
+ echo "<td> $semester </td>";
+ echo "<td> $pruefung </td>";
+ echo "<td> $groupname </td>";
+ $student = $students[$matrikelnummer];
+ $nachname = $student["nachname"];
+ $vorname = $student["vorname"];
+ if (!empty($student["noten"][$pruefung]["klausur"])) {
+ $klausurnote = $student["noten"][$pruefung]["klausur"];
+ } else {
+ $klausurnote = "";
+ }
+ if (!empty($student["noten"][$pruefung]["labor"])) {
+ $labornote = $student["noten"][$pruefung]["labor"];
+ } else {
+ $labornote = "";
+ }
+ echo "<td><a href=\"show-user.php?matrikelnummer=$matrikelnummer\">$nachname</a></td>";
+ echo "<td> $vorname </td>";
+ echo "<td><input type=\"text\" name=\"note[$matrikelnummer][$pruefung][labor][$semester]\" value=\"$labornote\" size=2 maxlength=2></td>";
+ echo "<td><input type=\"text\" name=\"note[$matrikelnummer][$pruefung][klausur][$semester]\" value=\"$klausurnote\" size=3 maxlength=3></td>";
+ echo "</tr>";
+ }
+ }
+ }
+ }
+ }
+}
+echo "</table>";
+echo "<input type=\"submit\" name=\"update\" value=\"update\">";
+echo "</form>";
+?>
+
+</body>
+</html> \ No newline at end of file