aboutsummaryrefslogtreecommitdiff
path: root/lib/modules
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2024-03-21 15:25:51 +0000
committerPeter Thienel <thienel@data-quest.de>2024-03-21 15:28:14 +0000
commit24469784ea4194d41fbaea44bb1f1f38f813da57 (patch)
tree9c515ba4c6e55ebdf9baa023dd8f8297fbd7f09c /lib/modules
parent0c730886118220f966b3313a062582dfc54ff117 (diff)
reverted changes from StEP #1354 in lib/modules/ScheduleWidget.php, fixes #3836
Closes #3836 Merge request studip/studip!2703 (cherry picked from commit 36798071f8bc68e0f423293b9c9006655cfcc1ad) b660294c reverted changes from StEP #1354 in lib/modules/ScheduleWidget.php 647433f1 added code improvement
Diffstat (limited to 'lib/modules')
-rw-r--r--lib/modules/ScheduleWidget.php42
1 files changed, 6 insertions, 36 deletions
diff --git a/lib/modules/ScheduleWidget.php b/lib/modules/ScheduleWidget.php
index 0393176..5adc801 100644
--- a/lib/modules/ScheduleWidget.php
+++ b/lib/modules/ScheduleWidget.php
@@ -39,45 +39,15 @@ class ScheduleWidget extends CorePlugin implements PortalPlugin
*/
public function getPortalTemplate()
{
- $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
- ]
- ]
- ]
- ]
+ $view = CalendarScheduleModel::getUserCalendarView(
+ $GLOBALS['user']->id,
+ false,
+ false,
+ $days = [0, 1, 2, 3, 4]
);
$template = $GLOBALS['template_factory']->open('shared/string');
- $template->content = $fullcalendar;
+ $template->content = CalendarWidgetView::createFromWeekView($view)->render();
return $template;
}