aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2026-03-17 12:16:29 +0000
committerMoritz Strohm <strohm@data-quest.de>2026-03-17 12:16:29 +0000
commitee91143bc05333323b44b5a41c6592894d0811f9 (patch)
treedba3e8850350227fed080a06d184ed5f5170cb33 /lib
parentee78e07f006b7f80d80745f5fb0c6ce3eb73962e (diff)
do not show room names for each regular date when grouping them by room, fixes #6372
Closes #6372 Merge request studip/studip!4833
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/CourseDateList.php2
-rw-r--r--lib/models/SeminarCycleDate.php23
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/classes/CourseDateList.php b/lib/classes/CourseDateList.php
index 5aa1a02..cb1c504 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 799cd4a..ad467bf 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) {