still working
This commit is contained in:
parent
328977b464
commit
da20992627
@ -477,7 +477,7 @@ if ($school_id) {
|
|||||||
$stmt->execute([$school_id]);
|
$stmt->execute([$school_id]);
|
||||||
$school_settings = $stmt->fetch(PDO::FETCH_ASSOC);
|
$school_settings = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
if ($school_settings && !empty($school_settings['working_days'])) {
|
if ($school_settings && !empty($school_settings['working_days'])) {
|
||||||
$days_from_db = explode(',', $school_settings['working_days']);
|
$days_from_db = array_map('trim', explode(',', $school_settings['working_days']));
|
||||||
// Filter the days to ensure only valid weekdays are included, up to Friday.
|
// Filter the days to ensure only valid weekdays are included, up to Friday.
|
||||||
$valid_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'];
|
$valid_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'];
|
||||||
$days_of_week = array_intersect($days_from_db, $valid_days);
|
$days_of_week = array_intersect($days_from_db, $valid_days);
|
||||||
@ -554,6 +554,7 @@ $class_timetables = get_timetable_from_db($pdoconn, $classes, $timeslots, $days_
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$period_idx = 0;
|
$period_idx = 0;
|
||||||
|
$day_name_to_index = array_flip(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']);
|
||||||
foreach ($timeslots as $timeslot) :
|
foreach ($timeslots as $timeslot) :
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
@ -564,8 +565,10 @@ $class_timetables = get_timetable_from_db($pdoconn, $classes, $timeslots, $days_
|
|||||||
<?php if ($timeslot['is_break']) : ?>
|
<?php if ($timeslot['is_break']) : ?>
|
||||||
<td colspan="<?php echo count($days_of_week); ?>" class="text-center table-secondary"><strong>Break</strong></td>
|
<td colspan="<?php echo count($days_of_week); ?>" class="text-center table-secondary"><strong>Break</strong></td>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<?php for ($day_idx = 0; $day_idx < count($days_of_week); $day_idx++) : ?>
|
<?php foreach ($days_of_week as $day_name) : ?>
|
||||||
<?php
|
<?php
|
||||||
|
if (!isset($day_name_to_index[$day_name])) continue;
|
||||||
|
$day_idx = $day_name_to_index[$day_name];
|
||||||
$lesson = $class_timetables[$class['id']][$day_idx][$period_idx] ?? null;
|
$lesson = $class_timetables[$class['id']][$day_idx][$period_idx] ?? null;
|
||||||
|
|
||||||
// Logic to determine if cell should be skipped
|
// Logic to determine if cell should be skipped
|
||||||
@ -613,7 +616,7 @@ $class_timetables = get_timetable_from_db($pdoconn, $classes, $timeslots, $days_
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<?php endfor; // day_idx ?>
|
<?php endforeach; // day_name ?>
|
||||||
<?php $period_idx++; ?>
|
<?php $period_idx++; ?>
|
||||||
<?php endif; // is_break ?>
|
<?php endif; // is_break ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user