From b40170f220c046e62d6ec219293fa5a8ab5d4e24 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 7 Dec 2025 17:27:54 +0000 Subject: [PATCH] Revert to version 403c8e4 --- teacher_timetable.php | 83 ++++++++++++++++++------------------------- timetable.php | 8 +---- 2 files changed, 35 insertions(+), 56 deletions(-) diff --git a/teacher_timetable.php b/teacher_timetable.php index a7be905..d86497a 100644 --- a/teacher_timetable.php +++ b/teacher_timetable.php @@ -103,24 +103,26 @@ foreach ($teacher_schedule_raw as $lesson) { $day_idx = $lesson['day_of_week']; if (isset($timeslot_id_to_period_idx[$lesson['timeslot_id']])) { $period_idx = $timeslot_id_to_period_idx[$lesson['timeslot_id']]; - - // Skip if this slot is already filled by a continuation marker - if (isset($teacher_timetable_by_period[$day_idx][$period_idx]) && isset($teacher_timetable_by_period[$day_idx][$period_idx]['continuation'])) { - continue; - } - - // Place the lesson. Handle co-teaching by making it an array. - if (!isset($teacher_timetable_by_period[$day_idx][$period_idx]) || $teacher_timetable_by_period[$day_idx][$period_idx] === null) { - $teacher_timetable_by_period[$day_idx][$period_idx] = [$lesson]; - } else { + + if (isset($teacher_timetable_by_period[$day_idx][$period_idx])) { + // This slot is already filled, potentially by a multi-class elective. + // Create an array if it's not already one. + if (!is_array($teacher_timetable_by_period[$day_idx][$period_idx])) { + $teacher_timetable_by_period[$day_idx][$period_idx] = [$teacher_timetable_by_period[$day_idx][$period_idx]]; + } $teacher_timetable_by_period[$day_idx][$period_idx][] = $lesson; + } else { + $teacher_timetable_by_period[$day_idx][$period_idx] = $lesson; } - if (!empty($lesson['is_double'])) { - $next_period_idx = $period_idx + 1; - if (isset($non_break_periods[$next_period_idx])) { - $continuation_marker = ['continuation' => true, 'original_lesson' => $lesson]; - $teacher_timetable_by_period[$day_idx][$next_period_idx] = $continuation_marker; + if (!empty($lesson['is_double']) && isset($teacher_timetable_by_period[$day_idx][$period_idx + 1])) { + if (isset($teacher_timetable_by_period[$day_idx][$period_idx + 1])) { + if (!is_array($teacher_timetable_by_period[$day_idx][$period_idx + 1])) { + $teacher_timetable_by_period[$day_idx][$period_idx + 1] = [$teacher_timetable_by_period[$day_idx][$period_idx + 1]]; + } + $teacher_timetable_by_period[$day_idx][$period_idx + 1][] = $lesson; + } else { + $teacher_timetable_by_period[$day_idx][$period_idx + 1] = $lesson; } } } @@ -232,45 +234,28 @@ error_log("Final teacher_timetable_by_period structure: " . print_r($teacher_tim - $day): ?> - + '; + echo '' . htmlspecialchars($display_name) . '
'; + echo '' . htmlspecialchars($single_lesson['class_name']) . ''; + echo ''; } } - ?> - - '; - echo '' . htmlspecialchars($display_name) . '
'; - echo '' . htmlspecialchars($single_lesson['class_name']) . ''; - echo ''; - } - } - } - ?> - - +