Se ce la mandano buona abbiamo un orario decente su telefono.

This commit is contained in:
2025-10-04 19:38:39 +02:00
parent 40da7d0d58
commit 9c9c26a470
2 changed files with 84 additions and 46 deletions

View File

@@ -154,67 +154,61 @@ td:hover {
color: #666;
}
/* --- qui sostituisci con la versione migliorata --- */
/* Mostra solo la tabella su desktop */
.desktop-schedule { display: table; width: 100%; border-collapse: collapse; }
.mobile-schedule { display: none; }
/* Mobile: nasconde tabella, mostra card */
@media (max-width: 768px) {
table {
box-shadow: none;
border-radius: 0;
.desktop-schedule { display: none; }
.mobile-schedule { display: flex; flex-direction: column; gap: 1.5rem; }
.mobile-schedule .day {
background: #f8f8f8;
border-radius: 10px;
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
padding: 1rem;
}
tr {
margin-bottom: 20px;
.mobile-schedule h2 {
margin-top: 0;
margin-bottom: .8rem;
font-size: 1.2rem;
color: #111;
border-bottom: 1px solid #ddd;
padding-bottom: .3rem;
}
.lesson {
background: #fff;
border: 1px solid #eee;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(0,0,0,0.08);
overflow: hidden;
padding: 10px;
padding: .6rem .8rem;
margin-bottom: .6rem;
}
td {
padding: 8px 8px 8px 50%;
border: none;
border-bottom: 1px solid #eee;
font-size: 0.9em;
.lesson.empty {
opacity: .6;
}
td::before {
position: absolute;
top: 10px;
left: 10px;
color: #1f618d;
font-size: 0.85em;
text-transform: uppercase;
letter-spacing: 0.5px;
content: attr(data-label);
.hour {
font-size: 0.9rem;
color: #666;
margin-bottom: 3px;
}
td > .subject {
.subject {
font-weight: 600;
font-size: 1em;
margin-bottom: 2px;
color: #222;
}
td > .teacher {
font-size: 0.85em;
.teacher {
font-size: 0.85rem;
color: #555;
}
td > .room {
font-size: 0.75em;
color: #888;
}
td:last-child {
border-bottom: none;
}
}
@media (max-width: 480px) {
td {
padding-left: 45%;
}
td::before {
width: 40%;
font-size: 0.8em;
.room {
font-size: 0.8rem;
color: #777;
}
}

View File

@@ -1,5 +1,5 @@
<?php
include("lib/db.php");
#include("lib/db.php");
$class_id = intval($_GET['class_id']);
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
@@ -89,6 +89,50 @@ if ($res->num_rows === 0) {
}
?>
</table>
<div class="mobile-schedule">
<?php foreach($days as $d): ?>
<div class="day">
<h2><?= $d ?></h2>
<?php
foreach($hours as $hnum => $hlabel):
$q = $conn->query("SELECT subjects.name, subjects.teacher, subjects.room
FROM timetable
LEFT JOIN subjects ON timetable.subject_id = subjects.id
WHERE class_id=$class_id AND day='$d' AND hour=$hnum");
if($q->num_rows > 0):
$row = $q->fetch_assoc();
$subject = $row['name'];
$room = $row['room'];
$teachers = [$row['teacher']];
while($row = $q->fetch_assoc()){
$teachers[] = $row['teacher'];
}
if(count($teachers) > 1){
$last = array_pop($teachers);
$teachers_list = implode(", ", $teachers) . " e " . $last;
} else {
$teachers_list = $teachers[0];
}
?>
<div class="lesson">
<div class="hour"><?= $hlabel ?></div>
<div class="subject"><?= $subject ?></div>
<div class="teacher"><?= $teachers_list ?></div>
<?php if($room): ?><div class="room"><?= $room ?></div><?php endif; ?>
</div>
<?php else: ?>
<div class="lesson empty">
<div class="hour"><?= $hlabel ?></div>
<div class="subject">—</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<p style="text-align: center;">Copyright (C) 2025 EmmeV. - Released under <a href="https://git.vichingo455.freeddns.org/emmev-code/orario/src/branch/stable/LICENSE.txt" target="_blank">GNU AGPL 3.0 License</a>.</p>
</body>
</html>