Skip to content
Snippets Groups Projects
Commit b2e0f16e authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix access to room information in admin courses export, fixes #5059

Closes #5059

Merge request studip/studip!3787
parent 3e3df31b
No related branches found
No related tags found
No related merge requests found
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
class CourseDateList implements Stringable class CourseDateList implements Stringable
{ {
/** /**
* @var array $regular_dates contains regular course dates. * @var SeminarCycleDate[] $regular_dates contains regular course dates.
*/ */
protected array $regular_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 * These can be part of a regular course date, or they can
* be irregular dates, depending on the use case of the * be irregular dates, depending on the use case of the
* CourseDateCollection instance. * CourseDateCollection instance.
...@@ -35,7 +35,7 @@ class CourseDateList implements Stringable ...@@ -35,7 +35,7 @@ class CourseDateList implements Stringable
protected array $single_dates = []; protected array $single_dates = [];
/** /**
* @var array $cancelled_dates contains cancelled course dates. * @var CourseExDate[] $cancelled_dates contains cancelled course dates.
*/ */
protected array $cancelled_dates = []; protected array $cancelled_dates = [];
...@@ -249,7 +249,7 @@ class CourseDateList implements Stringable ...@@ -249,7 +249,7 @@ class CourseDateList implements Stringable
$output[] = $date_line; $output[] = $date_line;
} else { } else {
//Group by rooms. //Group by rooms.
if (!is_array($output[$room->name])) { if (!isset($output[$room->name])) {
$output[$room->name] = []; $output[$room->name] = [];
} }
$output[$room->name][] = $date_line; $output[$room->name][] = $date_line;
...@@ -257,7 +257,7 @@ class CourseDateList implements Stringable ...@@ -257,7 +257,7 @@ class CourseDateList implements Stringable
} elseif ($group_by_rooms) { } elseif ($group_by_rooms) {
//Use the "null" room name: //Use the "null" room name:
$null_room_name = _('Kein Raum'); $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] = [];
} }
$output[$null_room_name][] = $date_line; $output[$null_room_name][] = $date_line;
...@@ -270,10 +270,12 @@ class CourseDateList implements Stringable ...@@ -270,10 +270,12 @@ class CourseDateList implements Stringable
$date_line = $single_date->getFullName($with_room_names ? 'long-include-room' : 'long'); $date_line = $single_date->getFullName($with_room_names ? 'long-include-room' : 'long');
if ($group_by_rooms) { if ($group_by_rooms) {
$room_name = _('Kein Raum'); $room_name = _('Kein Raum');
if ($single_date->room instanceof Room) { if ($single_date->room_booking) {
$room_name = $single_date->room->name; $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] = [];
} }
$output[$room_name][] = $date_line; $output[$room_name][] = $date_line;
...@@ -285,7 +287,7 @@ class CourseDateList implements Stringable ...@@ -285,7 +287,7 @@ class CourseDateList implements Stringable
foreach ($this->cancelled_dates as $cancelled_date) { foreach ($this->cancelled_dates as $cancelled_date) {
if ($group_by_rooms) { if ($group_by_rooms) {
$room_name = _('Kein Raum'); $room_name = _('Kein Raum');
if (!is_array($output[$room_name])) { if (!isset($output[$room_name])) {
$output[$room_name] = []; $output[$room_name] = [];
} }
$output[$room_name][] = $cancelled_date->toString(); $output[$room_name][] = $cancelled_date->toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment