diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2024-12-20 11:22:18 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2024-12-20 11:22:18 +0000 |
| commit | 27104518d2873cc7fcf25a845ef5756f7b14e0b3 (patch) | |
| tree | 2a7e9235c130a0f1aeb32bdbeaaf252a10cb4b0d | |
| parent | 02990f73bd61f7dbccd9ca9971d1aee72130d8e1 (diff) | |
show day view in schedule if the current day is visible, closes #5036
Closes #5036
Merge request studip/studip!3782
| -rw-r--r-- | lib/classes/calendar/Helper.php | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/classes/calendar/Helper.php b/lib/classes/calendar/Helper.php index 2151d34..992e236 100644 --- a/lib/classes/calendar/Helper.php +++ b/lib/classes/calendar/Helper.php @@ -158,6 +158,20 @@ class Helper } } + $available_views = [ + 'timeGridWeek' => [ + 'columnHeaderFormat' => ['weekday' => 'short'], + 'slotDuration' => $slot_duration + ] + ]; + if (!in_array(date('N'), $hidden_days)) { + //The current day is visible: Allow a day view: + $available_views['timeGridDay'] = [ + 'columnHeaderFormat' => ['weekday' => 'short'], + 'slotDuration' => $slot_duration + ]; + } + return new \Studip\Fullcalendar( _('Stundenplan'), [ @@ -168,15 +182,10 @@ class Helper 'maxTime' => $schedule_settings['end_time'] ?? '20:00', 'allDaySlot' => false, 'header' => [ - 'left' => '', + 'left' => count($available_views) > 1 ? implode(',', array_keys($available_views)) : '', 'right' => '' ], - 'views' => [ - 'timeGridWeek' => [ - 'columnHeaderFormat' => ['weekday' => 'short'], - 'slotDuration' => $slot_duration - ] - ], + 'views' => $available_views, 'columnHeaderFormat' => ['weekday' => 'short'], 'defaultView' => 'timeGridWeek', 'defaultDate' => date('Y-m-d'), |
