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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
<?php
/**
* @var Room $room
* @var User $current_user
* @var array $time_intervals
* @var Resources_RoomPlanningController $controller
* @var string $underload
* @var array $room_availability_share
* @var array $unavailable_dates
* @var array $amount_of_dates
* @var array $metadate_availability_share
* @var array $selected_rooms
* @var array $unavailable_metadate_dates
* @var array $amount_of_metadate_dates
* @var array $room_availability
*/
?>
<tr class="nohover">
<td class="nowrap">
<? if ($room->bookingPlanVisibleForUser($current_user)): ?>
<?
$booking_plan_params = [];
if (isset($time_intervals[0]) && $time_intervals[0]['begin']) {
$booking_plan_params = [
'defaultDate' => date('Y-m-d', $time_intervals[0]['begin'])
];
}
?>
<a href="<?= $controller->link_for(
'resources/room_planning/booking_plan/' . $room->id,
$booking_plan_params
) ?>" target="_blank"
title="<?= _('Zum Belegungsplan') ?>">
<?= htmlReady($room->name) ?>
</a>
<? else: ?>
<?= htmlReady($room->name) ?>
<? endif ?>
<?= tooltipIcon($room->room_type) ?>
– <?= htmlReady(sprintf('%d Sitzplätze', $room->seats)) ?>
<? if (!empty($underload)) : ?>
[<?= htmlReady($underload) ?>%]
<? endif ?>
</td>
<? if (!empty($time_intervals) && count($time_intervals) > 1) : ?>
<td>
<input type="checkbox" data-proxyfor="input.radio-<?= htmlReady($room->id) ?>"
name="all_in_room" value="<?= htmlReady($room->id) ?>"
<?= $room_availability_share[$room->id] <= 0.0 ? 'disabled="disabled"' : '' ?>>
<? if ($room_availability_share[$room->id] >= 1.0) : ?>
<?= Icon::create('check-circle', Icon::ROLE_STATUS_GREEN)->asImg(['class' => 'text-bottom']) ?>
<? elseif ($room_availability_share[$room->id] <= 0.0) : ?>
<?= Icon::create('decline-circle', Icon::ROLE_STATUS_RED)->asImg(['class' => 'text-bottom']) ?>
<? else : ?>
<?= Icon::create('exclaim-circle', Icon::ROLE_STATUS_YELLOW)->asImg(['class' => 'text-bottom']) ?>
<?= tooltipIcon(sprintf(
_('%u von %u Terminen nicht verfügbar'),
$unavailable_dates[$room->id],
$amount_of_dates[$room->id]
)) ?>
<? endif ?>
</td>
<? endif ?>
<? foreach ($time_intervals as $metadate_id => $data): ?>
<? if (($data['metadate'] instanceof SeminarCycleDate)) : ?>
<?
$availability = $metadate_availability_share[$room->id][$metadate_id];
$range_index = 'SeminarCycleDate' . '_' . $metadate_id;
$room_radio_name = 'selected_rooms[' . $range_index . ']';
?>
<td>
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>"
<?= $availability <= 0.0 ? 'disabled="disabled"' : '' ?>
<?= ($availability > 0 && isset($selected_rooms[$range_index]) && $selected_rooms[$range_index] == $room->id)
? 'checked'
: ''?>>
<? if ($availability >= 1.0) : ?>
<?= Icon::create('check-circle', Icon::ROLE_STATUS_GREEN)->asImg(['class' => 'text-bottom']) ?>
<? elseif ($availability <= 0.0) : ?>
<?= Icon::create('decline-circle', Icon::ROLE_STATUS_RED)->asImg(['class' => 'text-bottom']) ?>
<? else : ?>
<?= Icon::create('exclaim-circle', Icon::ROLE_STATUS_YELLOW)->asImg(['class' => 'text-bottom']) ?>
<?= tooltipIcon(sprintf(
_('%u von %u Terminen nicht verfügbar'),
$unavailable_metadate_dates[$room->id][$metadate_id],
$amount_of_metadate_dates[$room->id][$metadate_id]
)) ?>
<? endif ?>
<? $stats = 0; array_walk($data['intervals'], function($item, $key, $room_id) use (&$stats) {
if (in_array($room_id, $item['booked_rooms'])) {
$stats++;
}
}, $room->id) ?>
<? if ($stats > 0) : ?>
<?= tooltipIcon(sprintf(
_('%s von %s Terminen sind in diesem Raum'),
$stats, count($data['intervals'])
));
?>
<? endif ?>
</td>
<? else : ?>
<? $i = 0 ?>
<? foreach($data['intervals'] as $interval) : ?>
<?
$available = !empty($room_availability[$room->id][$metadate_id][$i]);
$range_index = $interval['range'] . '_' . $interval['range_id'];
$room_radio_name = 'selected_rooms[' . $range_index . ']';
?>
<td>
<? if ($available || (!empty($interval['booked_rooms']) && in_array($room->id, $interval['booked_rooms']))): ?>
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
class="text-bottom radio-<?= htmlReady($room->id) ?>"
value="<?= htmlReady($room->id) ?>"
<?= (!empty($selected_rooms[$range_index]) && $selected_rooms[$range_index] === $room->id
|| (!empty($interval['booked_rooms']) && in_array($room->id, $interval['booked_rooms'])))
? 'checked="checked"'
: ''?>>
<?= Icon::create('check-circle', Icon::ROLE_STATUS_GREEN)->asImg(['class' => 'text-bottom']) ?>
<? else: ?>
<input type="radio" name="<?= htmlReady($room_radio_name) ?>"
value="1" disabled="disabled"
class="text-bottom">
<?= Icon::create('decline-circle', Icon::ROLE_STATUS_RED)->asImg(['class' => 'text-bottom']) ?>
<? endif ?>
</td>
<? $i++ ?>
<? endforeach ?>
<? endif ?>
<? endforeach ?>
</tr>
|