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

prevent php-warnings, closes #2293

Closes #2293

Merge request studip/studip!1517
parent ef31c549
No related branches found
No related tags found
No related merge requests found
<? <?
// condense regular dates by room // condense regular dates by room
if (is_array($dates['regular']['turnus_data'])) foreach ($dates['regular']['turnus_data'] as $cycle) : if (!empty($dates['regular']['turnus_data'])) foreach ($dates['regular']['turnus_data'] as $cycle) :
if (is_array($cycle['assigned_rooms'])) foreach ($cycle['assigned_rooms'] as $room_id => $count) : if (!empty($cycle['assigned_rooms'])) foreach ($cycle['assigned_rooms'] as $room_id => $count) :
$room_object = Room::find($room_id); $room_object = Room::find($room_id);
$output[$room_object->name][] = $cycle['tostring_short'] .' ('. $count .'x)'; $output[$room_object->name][] = $cycle['tostring_short'] .' ('. $count .'x)';
endforeach; endforeach;
if (is_array($cycle['freetext_rooms'])) foreach ($cycle['freetext_rooms'] as $room => $count) : if (!empty($cycle['freetext_rooms'])) foreach ($cycle['freetext_rooms'] as $room => $count) :
if ($room) : if ($room) :
$output['('. $room .')'][] = $cycle['tostring_short'] .' ('. $count .'x)'; $output['('. $room .')'][] = $cycle['tostring_short'] .' ('. $count .'x)';
endif; endif;
...@@ -16,7 +16,7 @@ endforeach; ...@@ -16,7 +16,7 @@ endforeach;
// condense irregular dates by room // condense irregular dates by room
if (is_array($dates['irregular'])) foreach ($dates['irregular'] as $date) : if (!empty($dates['irregular'])) foreach ($dates['irregular'] as $date) :
if ($date['resource_id']) : if ($date['resource_id']) :
$output_dates[$date['resource_id']][] = $date; $output_dates[$date['resource_id']][] = $date;
elseif ($date['raum']) : elseif ($date['raum']) :
...@@ -25,7 +25,7 @@ if (is_array($dates['irregular'])) foreach ($dates['irregular'] as $date) : ...@@ -25,7 +25,7 @@ if (is_array($dates['irregular'])) foreach ($dates['irregular'] as $date) :
endforeach; endforeach;
// now shrink the dates for each room/freetext and add them to the output // now shrink the dates for each room/freetext and add them to the output
if (is_array($output_dates)) foreach ($output_dates as $dates) : if (!empty($output_dates)) foreach ($output_dates as $dates) :
if ($dates[0]['resource_id']) : if ($dates[0]['resource_id']) :
$room_object = Room::find($dates[0]['resource_id']); $room_object = Room::find($dates[0]['resource_id']);
$output[$room_object->name][] = implode(", ", shrink_dates($dates)); $output[$room_object->name][] = implode(", ", shrink_dates($dates));
...@@ -34,10 +34,11 @@ if (is_array($output_dates)) foreach ($output_dates as $dates) : ...@@ -34,10 +34,11 @@ if (is_array($output_dates)) foreach ($output_dates as $dates) :
endif; endif;
endforeach; endforeach;
if (!is_array($output) || count($output) === 0) : if (!isset($output) || count($output) === 0) :
echo _('nicht angegeben'); echo _('nicht angegeben');
elseif (count($output) === 1) : elseif (count($output) === 1) :
echo array_pop(array_keys($output)); $keys = array_keys($output);
echo array_pop($keys);
else : else :
$pos = 1; $pos = 1;
foreach ($output as $room => $dates) : foreach ($output as $room => $dates) :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment