diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2022-11-17 12:57:52 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-11-17 12:57:52 +0000 |
| commit | 5600a0a29927e227766e371b097b91bace168bd0 (patch) | |
| tree | 0533ec842914f65c62d68faf2b2d77dbc4d999ca /templates/dates | |
| parent | 542f4737998a3f5f16a8d582c9ede412f9cf99ec (diff) | |
prevent php-warnings, closes #1789
Closes #1789
Merge request studip/studip!1171
Diffstat (limited to 'templates/dates')
| -rw-r--r-- | templates/dates/seminar_html_roomplanning.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/templates/dates/seminar_html_roomplanning.php b/templates/dates/seminar_html_roomplanning.php index 60beec2..50f3fdf 100644 --- a/templates/dates/seminar_html_roomplanning.php +++ b/templates/dates/seminar_html_roomplanning.php @@ -44,6 +44,8 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : echo implode(", <br>", $output); $freetext_rooms = []; + $irregular_rooms = []; + $irregular = []; if (is_array($dates['irregular'])): foreach ($dates['irregular'] as $date) : @@ -52,9 +54,15 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : } $irregular[] = $date; $irregular_strings[] = $date['tostring']; - if ($date['resource_id']) : + if (!empty($date['resource_id'])) : + if (!isset($irregular_rooms[$date['resource_id']])) : + $irregular_rooms[$date['resource_id']] = 0; + endif; $irregular_rooms[$date['resource_id']]++; - elseif ($date['raum']) : + elseif (!empty($date['raum'])) : + if (!isset($freetext_rooms['('. $date['raum'] .')'])) : + $freetext_rooms['('. $date['raum'] .')'] = 0; + endif; $freetext_rooms['('. $date['raum'] .')']++; endif; endforeach; @@ -69,9 +77,9 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : if (empty($with_past_intervals) && $date->end_time < $now) { continue; } - echo $date['tostring']; + echo $date['tostring'] ?? ''; - if ($show_room && $date['resource_id']) : + if ($show_room && !empty($date['resource_id'])) : echo ', '. _('Ort:') . ' '; $room_obj = Room::find($date['resource_id']); echo '<a href="' . $room_obj->getActionLink('show') . '" target="_blank">' @@ -81,7 +89,7 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : endforeach; else : echo _("Termine am") . implode(', ', shrink_dates($irregular)); - if (is_array($rooms) && count($rooms) > 0) : + if (count($rooms) > 0) : if (count($rooms) > 3) : $rooms = array_slice($rooms, count($rooms) - 3, count($rooms)); endif; |
