diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2026-03-17 12:16:42 +0000 |
|---|---|---|
| committer | Moritz Strohm <strohm@data-quest.de> | 2026-03-17 12:16:42 +0000 |
| commit | a7ccb7e8391add935f11bc7e769c1c75d975faef (patch) | |
| tree | 10a84f8b26677004be5165aa1c6efccc488d9dd7 /lib | |
| parent | 25ed2699b087ccc852f091903490720c3f46fb34 (diff) | |
do not show room names for each regular date when grouping them by room, fixes #6372
Closes #6372
Merge request studip/studip!4833
(cherry picked from commit ee91143bc05333323b44b5a41c6592894d0811f9)
618bed23 fixed display of room information for course dates
c1ac3c8c schedule: group rooms for course dates in details view
357ada1c reverted room/time format change in schedule
93db1a6e really reverted room/time format change in schedule
ba149c8e course/overview/index: reverted grouping of dates
15cd96c8 changed format name
Co-authored-by: Moritz Strohm <strohm@data-quest.de>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/classes/CourseDateList.php | 2 | ||||
| -rw-r--r-- | lib/models/SeminarCycleDate.php | 23 |
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/classes/CourseDateList.php b/lib/classes/CourseDateList.php index 8a6be35..6847ec2 100644 --- a/lib/classes/CourseDateList.php +++ b/lib/classes/CourseDateList.php @@ -240,7 +240,7 @@ class CourseDateList implements Stringable { $output = []; foreach ($this->regular_dates as $regular_date) { - $date_line = $regular_date->toString('long-start'); + $date_line = $regular_date->toString($with_room_names ? 'long-start' : 'long-start-without-room'); if ($with_room_names || $group_by_rooms) { $room = $regular_date->getMostBookedRoom(); if ($room instanceof Room) { diff --git a/lib/models/SeminarCycleDate.php b/lib/models/SeminarCycleDate.php index 45d3e6a..e37bb64 100644 --- a/lib/models/SeminarCycleDate.php +++ b/lib/models/SeminarCycleDate.php @@ -204,11 +204,12 @@ class SeminarCycleDate extends SimpleORMap /** * Generates a string for a regular date. Depending on the selected format, more or less information * are present in the generated string: - * - short: Only the weekday, beginning and end - * - long: Weekday, beginning, end and the repetition interval - * - long-start: Same as long but with the start date. - * - full: Same as long, but also with the start and end week of the regular date in the semester - * and the description of the regular date, if provided. + * - short: Only the weekday, beginning and end + * - long: Weekday, beginning, end and the repetition interval + * - long-start: Same as long but with the start date. + * - long-start-without-room: Same as long-start but without the room. + * - full: Same as long, but also with the start and end week of the regular date in the semester + * and the description of the regular date, if provided. * * @param string $format The format string: "short", "long" or "full". Defaults to "short". * @@ -216,7 +217,7 @@ class SeminarCycleDate extends SimpleORMap */ public function toString(string $format = 'short', bool $as_html = false) : string { - if (!in_array($format, ['short', 'long', 'long-start', 'full'])) { + if (!in_array($format, ['short', 'long', 'long-start', 'long-start-without-room', 'full'])) { //Invalid format: return ''; } @@ -241,10 +242,12 @@ class SeminarCycleDate extends SimpleORMap _('%{weekday}, %{beginning} - %{end}, %{interval}'), $parameters ); - } elseif ($format === 'long-start') { + } elseif (in_array($format, ['long-start', 'long-start-without-room'])) { $text = _('%{weekday}, %{beginning} - %{end}, %{interval}'); - $room = $this->getMostBookedRoom(); - + $room = null; + if ($format === 'long-start') { + $room = $this->getMostBookedRoom(); + } if ($room) { if ($as_html) { $parameters['room_name'] = sprintf( @@ -255,7 +258,7 @@ class SeminarCycleDate extends SimpleORMap } else { $parameters['room_name'] = $room->name; } - } else { + } elseif ($format !== 'long-start-without-room') { //Use the freetext room name: $room = $this->getMostUsedFreetextRoomName(); if ($room) { |
