diff options
| -rw-r--r-- | app/controllers/calendar/schedule.php | 11 | ||||
| -rw-r--r-- | lib/classes/calendar/EventData.php | 6 | ||||
| -rw-r--r-- | resources/assets/javascripts/lib/fullcalendar.js | 3 |
3 files changed, 18 insertions, 2 deletions
diff --git a/app/controllers/calendar/schedule.php b/app/controllers/calendar/schedule.php index f20a640..fca00c5 100644 --- a/app/controllers/calendar/schedule.php +++ b/app/controllers/calendar/schedule.php @@ -273,6 +273,11 @@ class Calendar_ScheduleController extends AuthenticatedController $event_classes[] = 'hidden-course'; } + $room = $cycle_date->getMostBookedRoom() ?: $cycle_date->getMostUsedFreetextRoomName(); + if ($room) { + $room = is_object($room) ? $room->name : '(' . $cycle_date->getMostUsedFreetextRoomName() . ')'; + } + $event = new \Studip\Calendar\EventData( $fake_begin, $fake_end, @@ -291,7 +296,11 @@ class Calendar_ScheduleController extends AuthenticatedController 'show' => $this->url_for('calendar/schedule/course_info/' . $cycle_date->seminar_id) ], [], - $event_icon ?: '' + $event_icon ?: '', + '', + false, + '', + $room ); $result[] = $event->toFullcalendarEvent(); diff --git a/lib/classes/calendar/EventData.php b/lib/classes/calendar/EventData.php index db1e472..58265cd 100644 --- a/lib/classes/calendar/EventData.php +++ b/lib/classes/calendar/EventData.php @@ -24,6 +24,7 @@ class EventData public $icon; public $border_colour; public $all_day; + public $header_text; /** * @var string The ID in this field is used to group events when displayed @@ -50,7 +51,8 @@ class EventData string $icon = '', string $border_colour = '', bool $all_day = false, - string $group_id = '' + string $group_id = '', + string $header_text = null ) { $this->begin = $begin; @@ -72,6 +74,7 @@ class EventData $this->border_colour = $border_colour ?: $background_colour; $this->all_day = $all_day; $this->group_id = $group_id; + $this->header_text = $header_text; } @@ -106,6 +109,7 @@ class EventData 'color' => $this->background_colour, 'borderColor' => $this->border_colour, 'editable' => $this->editable, + 'header_text' => $this->header_text, 'studip_weekday_begin' => $this->begin->format('N'), 'studip_weekday_end' => $this->end->format('N'), 'studip_object_class' => $this->object_class, diff --git a/resources/assets/javascripts/lib/fullcalendar.js b/resources/assets/javascripts/lib/fullcalendar.js index 6a0aea3..16d4c84 100644 --- a/resources/assets/javascripts/lib/fullcalendar.js +++ b/resources/assets/javascripts/lib/fullcalendar.js @@ -591,6 +591,9 @@ class Fullcalendar ); } else { $(eventElement).attr('title', event.title); + if (event.extendedProps.header_text) { + $(eventElement).find('.fc-time span').append(', ' + event.extendedProps.header_text); + } } if (event.extendedProps.icon) { |
