aboutsummaryrefslogtreecommitdiff
path: root/lib/modules/ScheduleWidget.php
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2024-01-29 15:16:24 +0000
committerMoritz Strohm <strohm@data-quest.de>2024-01-29 15:16:24 +0000
commit7c1df847d94d3956bc763b94b73cebfe108dc9a1 (patch)
treee18e003bff65c5bf0748c644d6cd3d235cb1feca /lib/modules/ScheduleWidget.php
parentda0110d5e85279123e8dde392cb4c926397238bf (diff)
StEP 01354, closes #1354
Closes #1354 Merge request studip/studip!2116
Diffstat (limited to 'lib/modules/ScheduleWidget.php')
-rw-r--r--lib/modules/ScheduleWidget.php42
1 files changed, 36 insertions, 6 deletions
diff --git a/lib/modules/ScheduleWidget.php b/lib/modules/ScheduleWidget.php
index 339beb3..0393176 100644
--- a/lib/modules/ScheduleWidget.php
+++ b/lib/modules/ScheduleWidget.php
@@ -39,15 +39,45 @@ class ScheduleWidget extends CorePlugin implements PortalPlugin
*/
public function getPortalTemplate()
{
- $view = CalendarScheduleModel::getUserCalendarView(
- $GLOBALS['user']->id,
- false,
- false,
- $days = array(0,1,2,3,4)
+ $week_slot_duration = \Studip\Calendar\Helper::getCalendarSlotDuration('week');
+ $calendar_settings = $GLOBALS['user']->cfg->CALENDAR_SETTINGS ?? [];
+
+ $semester = Semester::findCurrent();
+ $fullcalendar = \Studip\Fullcalendar::create(
+ '',
+ [
+ 'minTime' => '08:00',
+ 'maxTime' => '20:00',
+ 'allDaySlot' => false,
+ 'header' => [
+ 'left' => '',
+ 'right' => ''
+ ],
+ 'views' => [
+ 'timeGridWeek' => [
+ 'columnHeaderFormat' => ['weekday' => 'long'],
+ 'weekends' => $calendar_settings['type_week'] === 'LONG',
+ 'slotDuration' => $week_slot_duration
+ ]
+ ],
+ 'defaultView' => 'timeGridWeek',
+ 'defaultDate' => date('Y-m-d'),
+ 'timeGridEventMinHeight' => 20,
+ 'eventSources' => [
+ [
+ 'url' => URLHelper::getURL('dispatch.php/calendar/calendar/schedule_data'),
+ 'method' => 'GET',
+ 'extraParams' => [
+ 'semester_id' => $semester->id,
+ 'full_semester_time_range' => false
+ ]
+ ]
+ ]
+ ]
);
$template = $GLOBALS['template_factory']->open('shared/string');
- $template->content = CalendarWidgetView::createFromWeekView($view)->render();
+ $template->content = $fullcalendar;
return $template;
}