1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
<?
if (!isset($show_room)) :
// show rooms only if there is more than one
if (empty($dates['rooms']) || sizeof($dates['rooms']) === 1) :
$show_room = false;
else :
$show_room = true;
endif;
endif;
if (!empty($dates['regular']['turnus_data']) || !empty($dates['irregular'])) :
$output = [];
if (is_array($dates['regular']['turnus_data'])) foreach ($dates['regular']['turnus_data'] as $cycle) :
$first_date = sprintf(_("ab %s"), strftime('%x', $cycle['first_date']['date']));
if ($cycle['cycle'] == 1) :
$cycle_output = $cycle['tostring_short'] . ' (' . sprintf(_("zweiwöchentlich, %s"), $first_date) . ')';
elseif ($cycle['cycle'] == 2) :
$cycle_output = $cycle['tostring_short'] . ' (' . sprintf(_("dreiwöchentlich, %s"), $first_date) . ')';
else :
$cycle_output = $cycle['tostring_short'] . ' (' . _("wöchentlich") . ')';
endif;
if ($cycle['desc'])
$cycle_output .= ' - '. $cycle['desc'];
if ($show_room) :
$cycle_output .= $this->render_partial('dates/_seminar_rooms',
[
'assigned' => $cycle['assigned_rooms'],
'freetext' => $cycle['freetext_rooms'],
'plain' => true]
);
endif;
$output[] = $cycle_output;
endforeach;
echo implode(", \n", $output);
$freetext_rooms = [];
if (is_array($dates['irregular'])):
foreach ($dates['irregular'] as $date) :
$irregular[] = $date;
$irregular_strings[] = $date['tostring'];
if ($date['resource_id']) :
$irregular_rooms[$date['resource_id']]++;
elseif ($date['raum']) :
$freetext_rooms['('. $date['raum'] .')']++;
endif;
endforeach;
unset($irregular_rooms['']);
echo sizeof($output) ? ", \n" : '';
$rooms = array_merge(getPlainRooms($irregular_rooms, false), array_keys($freetext_rooms));
if (is_array($irregular) && sizeof($irregular)) :
if (isset($shrink) && !$shrink && sizeof($irregular < 20)) :
foreach ($irregular as $date) :
echo $date['tostring'];
if ($show_room && $date['resource_id']) :
echo ', '. _('Ort:') . ' ';
echo Room::find($date['resource_id']);
endif;
echo "\n";
endforeach;
else :
echo _("Termine am") . implode(', ', shrink_dates($irregular));
if (is_array($rooms) && sizeof($rooms) > 0) :
if (sizeof($rooms) > 3) :
$rooms = array_slice($rooms, sizeof($rooms) - 3, sizeof($rooms));
endif;
if ($show_room) :
echo ', ' . _("Ort:") . ' ';
echo implode(', ', $rooms);
endif;
endif;
endif;
endif;
endif;
endif;
|