From 79a4823726634484c22082e8977b744f19a5509b Mon Sep 17 00:00:00 2001 From: Curry141 <135717077+Daniongithub@users.noreply.github.com> Date: Sat, 27 Sep 2025 18:06:46 +0200 Subject: [PATCH] Fixing mobile view and improving some menus. --- htdocs/admin/subjects.php | 42 ++++++++++++++- htdocs/css/timetable.css | 109 ++++++++++++++++++++++++++++---------- htdocs/laboratori.php | 28 ++++++++-- htdocs/studenti.php | 31 +++++++++-- 4 files changed, 173 insertions(+), 37 deletions(-) diff --git a/htdocs/admin/subjects.php b/htdocs/admin/subjects.php index a7bd79b..eaa20f5 100644 --- a/htdocs/admin/subjects.php +++ b/htdocs/admin/subjects.php @@ -47,7 +47,44 @@ if (isset($_GET['delete'])) { + real_escape_string($_POST['name']); + $teacher = $conn->real_escape_string($_POST['teacher']); + $room = $conn->real_escape_string($_POST['room']); + $conn->query("UPDATE subjects + SET name='$name', teacher='$teacher', room='$room' + WHERE id=$id"); +} +// 2. Mostrare il form se edit richiesto +if(isset($_GET['edit'])){ + $id = intval($_GET['edit']); + $res = $conn->query("SELECT * FROM subjects WHERE id=$id"); + if($res->num_rows > 0){ + $subject = $res->fetch_assoc(); + ?> +
ID | @@ -64,7 +101,10 @@ if (isset($_GET['delete'])) {{$row['name']} | {$row['teacher']} | {$row['room']} | -Elimina | ++ Modifica | + Elimina + |
- {$row['subject_name']}
- {$row['teacher']}
- {$row['class_name']}
+ $subject
+ $entries_list
| ";
} else {
echo ""; diff --git a/htdocs/studenti.php b/htdocs/studenti.php index 41baed3..8515ad5 100644 --- a/htdocs/studenti.php +++ b/htdocs/studenti.php @@ -54,10 +54,33 @@ if ($res->num_rows === 0) { FROM timetable LEFT JOIN subjects ON timetable.subject_id = subjects.id WHERE class_id=$class_id AND day='$d' AND hour=$hnum"); - if($row = $q->fetch_assoc()){ - echo " | {$row['name']}
- {$row['teacher']}
- {$row['room']} | ";
+
+ if($q->num_rows > 0){
+ $row = $q->fetch_assoc();
+ $subject = $row['name'];
+ $room = $row['room'];
+
+ // metto il primo docente
+ $teachers = [$row['teacher']];
+
+ // aggiungo eventuali altri docenti
+ while($row = $q->fetch_assoc()){
+ $teachers[] = $row['teacher'];
+ }
+
+ // se più docenti -> unisci con virgola e "e" finale
+ if(count($teachers) > 1){
+ $last = array_pop($teachers);
+ $teachers_list = implode(", ", $teachers) . " e " . $last;
+ } else {
+ $teachers_list = $teachers[0];
+ }
+
+ echo "
+ $subject
+ $teachers_list
+ $room
+ | ";
} else {
echo ""; } -- 2.39.5 |
---|