Compare commits

...

2 Commits

2 changed files with 84 additions and 46 deletions

View File

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

View File

@@ -1,5 +1,5 @@
<?php <?php
include("lib/db.php"); #include("lib/db.php");
$class_id = intval($_GET['class_id']); $class_id = intval($_GET['class_id']);
$class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc(); $class = $conn->query("SELECT * FROM classes WHERE id=$class_id")->fetch_assoc();
$days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]; $days = ["Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"];
@@ -89,6 +89,50 @@ if ($res->num_rows === 0) {
} }
?> ?>
</table> </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> <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> </body>
</html> </html>