aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-12-20 08:35:18 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-12-20 08:35:18 +0000
commitb2e0f16e9f0bef9a7aa1a82d4bb166234a0423b4 (patch)
tree80647e1ef77f6f0a10ce8434bea5b15abe3c071e
parent3e3df31b8e63b020e7f3e9655a7565227758cd23 (diff)
fix access to room information in admin courses export, fixes #5059
Closes #5059 Merge request studip/studip!3787
-rw-r--r--lib/classes/CourseDateList.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/classes/CourseDateList.php b/lib/classes/CourseDateList.php
index 5f6d4b1..8a6be35 100644
--- a/lib/classes/CourseDateList.php
+++ b/lib/classes/CourseDateList.php
@@ -22,12 +22,12 @@
class CourseDateList implements Stringable
{
/**
- * @var array $regular_dates contains regular course dates.
+ * @var SeminarCycleDate[] $regular_dates contains regular course dates.
*/
protected array $regular_dates = [];
/**
- * @var array $single_dates contains single course dates.
+ * @var CourseDate[] $single_dates contains single course dates.
* These can be part of a regular course date, or they can
* be irregular dates, depending on the use case of the
* CourseDateCollection instance.
@@ -35,7 +35,7 @@ class CourseDateList implements Stringable
protected array $single_dates = [];
/**
- * @var array $cancelled_dates contains cancelled course dates.
+ * @var CourseExDate[] $cancelled_dates contains cancelled course dates.
*/
protected array $cancelled_dates = [];
@@ -249,7 +249,7 @@ class CourseDateList implements Stringable
$output[] = $date_line;
} else {
//Group by rooms.
- if (!is_array($output[$room->name])) {
+ if (!isset($output[$room->name])) {
$output[$room->name] = [];
}
$output[$room->name][] = $date_line;
@@ -257,7 +257,7 @@ class CourseDateList implements Stringable
} elseif ($group_by_rooms) {
//Use the "null" room name:
$null_room_name = _('Kein Raum');
- if (!is_array($output[$null_room_name])) {
+ if (!isset($output[$null_room_name])) {
$output[$null_room_name] = [];
}
$output[$null_room_name][] = $date_line;
@@ -270,10 +270,12 @@ class CourseDateList implements Stringable
$date_line = $single_date->getFullName($with_room_names ? 'long-include-room' : 'long');
if ($group_by_rooms) {
$room_name = _('Kein Raum');
- if ($single_date->room instanceof Room) {
- $room_name = $single_date->room->name;
+ if ($single_date->room_booking) {
+ $room_name = $single_date->room_booking->room_name;
+ } elseif ($single_date->raum) {
+ $room_name = $single_date->raum;
}
- if (!is_array($output[$room_name])) {
+ if (!isset($output[$room_name])) {
$output[$room_name] = [];
}
$output[$room_name][] = $date_line;
@@ -285,7 +287,7 @@ class CourseDateList implements Stringable
foreach ($this->cancelled_dates as $cancelled_date) {
if ($group_by_rooms) {
$room_name = _('Kein Raum');
- if (!is_array($output[$room_name])) {
+ if (!isset($output[$room_name])) {
$output[$room_name] = [];
}
$output[$room_name][] = $cancelled_date->toString();