aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2025-01-24 15:26:52 +0100
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2025-01-24 15:26:52 +0100
commitcba3b3c1b8c0ce11c818e8e832752221b70fd3ba (patch)
treed32771ad6154f25db4e2296301fd497fb0c18a2c
parent7ff14f9d59d098147bb78ee0de8e385fe2fdc208 (diff)
add room name to schedule events, fixes #5149biest-5149
-rw-r--r--app/controllers/calendar/schedule.php11
-rw-r--r--lib/classes/calendar/EventData.php6
-rw-r--r--resources/assets/javascripts/lib/fullcalendar.js3
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) {