Skip to content
Snippets Groups Projects
Commit 989e9fb6 authored by David Siegfried's avatar David Siegfried
Browse files

prevent php-warnings, closes #2258

Closes #2258

Merge request studip/studip!1487
parent beeda274
No related branches found
No related tags found
No related merge requests found
...@@ -37,31 +37,36 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : ...@@ -37,31 +37,36 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) :
echo implode(", \n", $output); echo implode(", \n", $output);
$freetext_rooms = []; $freetext_rooms = [];
$irregular_rooms = [];
if (is_array($dates['irregular'])): if (!empty($dates['irregular'])):
foreach ($dates['irregular'] as $date) : foreach ($dates['irregular'] as $date) :
if (!isset($irregular_rooms[$date['resource_id']])) {
$irregular_rooms[$date['resource_id']] = 0;
}
$irregular[] = $date; $irregular[] = $date;
$irregular_strings[] = $date['tostring']; $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;
}
$irregular_rooms[$date['resource_id']]++; $irregular_rooms[$date['resource_id']]++;
elseif ($date['raum']) : elseif (!empty($date['raum'])) :
if (!isset($freetext_rooms['('. $date['raum'] .')'])) {
$freetext_rooms['('. $date['raum'] .')'] = 0;
}
$freetext_rooms['('. $date['raum'] .')']++; $freetext_rooms['('. $date['raum'] .')']++;
endif; endif;
endforeach; endforeach;
unset($irregular_rooms['']); unset($irregular_rooms['']);
echo sizeof($output) ? ", \n" : ''; echo count($output) ? ", \n" : '';
$rooms = array_merge(getPlainRooms($irregular_rooms, false), array_keys($freetext_rooms)); $rooms = array_merge(getPlainRooms($irregular_rooms, false), array_keys($freetext_rooms));
if (is_array($irregular) && sizeof($irregular)) : if (!empty($irregular)) :
if (isset($shrink) && !$shrink && sizeof($irregular) < 20) : if (isset($shrink) && !$shrink && count($irregular) < 20) :
foreach ($irregular as $date) : foreach ($irregular as $date) :
echo $date['tostring']; echo $date['tostring'];
if ($show_room && $date['resource_id']) : if ($show_room && !empty($date['resource_id'])) :
echo ', '. _('Ort:') . ' '; echo ', '. _('Ort:') . ' ';
echo Room::find($date['resource_id']); echo Room::find($date['resource_id']);
endif; endif;
...@@ -69,9 +74,9 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) : ...@@ -69,9 +74,9 @@ if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) :
endforeach; endforeach;
else : else :
echo _("Termine am") . implode(', ', shrink_dates($irregular)); echo _("Termine am") . implode(', ', shrink_dates($irregular));
if (is_array($rooms) && sizeof($rooms) > 0) : if (!empty($rooms)) :
if (sizeof($rooms) > 3) : if (count($rooms) > 3) :
$rooms = array_slice($rooms, sizeof($rooms) - 3, sizeof($rooms)); $rooms = array_slice($rooms, count($rooms) - 3, count($rooms));
endif; endif;
if ($show_room) : if ($show_room) :
......
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