Skip to content
Snippets Groups Projects
Commit 28d699b6 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

don't show room-type-filter if no room types exists, closes #1423

Closes #1423

Merge request studip/studip!897
parent a6c63ca1
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ class RoomSearchWidget extends SidebarWidget ...@@ -33,7 +33,7 @@ class RoomSearchWidget extends SidebarWidget
} }
$room_types = Room::getAllRoomTypes(); $room_types = Room::getAllRoomTypes();
if ($room_types) { if (!empty($room_types)) {
$filtered_room_types = []; $filtered_room_types = [];
foreach ($room_types as $type) { foreach ($room_types as $type) {
$filtered_room_types[$type] = $type; $filtered_room_types[$type] = $type;
...@@ -42,10 +42,6 @@ class RoomSearchWidget extends SidebarWidget ...@@ -42,10 +42,6 @@ class RoomSearchWidget extends SidebarWidget
['' => _('Alle Raumtypen')], ['' => _('Alle Raumtypen')],
$filtered_room_types $filtered_room_types
); );
} else {
$room_types = [
'' => _('Alle Raumtypen')
];
} }
$this->criteria = []; $this->criteria = [];
...@@ -89,6 +85,7 @@ class RoomSearchWidget extends SidebarWidget ...@@ -89,6 +85,7 @@ class RoomSearchWidget extends SidebarWidget
'value' => '', 'value' => '',
'optional' => false 'optional' => false
]; ];
if (!empty($room_types)) {
$this->criteria['room_type'] = [ $this->criteria['room_type'] = [
'name' => 'room_type', 'name' => 'room_type',
'title' => _('Raumtyp'), 'title' => _('Raumtyp'),
...@@ -99,6 +96,7 @@ class RoomSearchWidget extends SidebarWidget ...@@ -99,6 +96,7 @@ class RoomSearchWidget extends SidebarWidget
'value' => '', 'value' => '',
'optional' => false 'optional' => false
]; ];
}
$this->criteria['special__building_location'] = [ $this->criteria['special__building_location'] = [
'name' => 'special__building_location', 'name' => 'special__building_location',
'title' => _('Standort / Gebäude'), 'title' => _('Standort / Gebäude'),
...@@ -167,6 +165,7 @@ class RoomSearchWidget extends SidebarWidget ...@@ -167,6 +165,7 @@ class RoomSearchWidget extends SidebarWidget
'value' => [10, 100], 'value' => [10, 100],
'optional' => false 'optional' => false
]; ];
} }
......
...@@ -7,30 +7,29 @@ ...@@ -7,30 +7,29 @@
[ [
'criteria' => ( 'criteria' => (
$selected_criteria['special__room_name'] $selected_criteria['special__room_name']
? $selected_criteria['special__room_name'] ?: $criteria['special__room_name']
: $criteria['special__room_name']
), ),
'removable' => false 'removable' => false
] ]
) ?> ) ?>
<? if (isset($criteria['room_type'])): ?>
<?= $this->render_partial( <?= $this->render_partial(
'sidebar/room-search-criteria.php', 'sidebar/room-search-criteria.php',
[ [
'criteria' => ( 'criteria' => (
$selected_criteria['room_type'] $selected_criteria['room_type']
? $selected_criteria['room_type'] ?: $criteria['room_type']
: $criteria['room_type']
), ),
'removable' => false 'removable' => false
] ]
) ?> ) ?>
<? endif ?>
<?= $this->render_partial( <?= $this->render_partial(
'sidebar/room-search-criteria.php', 'sidebar/room-search-criteria.php',
[ [
'criteria' => ( 'criteria' => (
$selected_criteria['room_category_id'] $selected_criteria['room_category_id']
? $selected_criteria['room_category_id'] ?: $criteria['room_category_id']
: $criteria['room_category_id']
), ),
'removable' => false 'removable' => false
] ]
...@@ -40,8 +39,7 @@ ...@@ -40,8 +39,7 @@
[ [
'criteria' => ( 'criteria' => (
$selected_criteria['special__building_location'] $selected_criteria['special__building_location']
? $selected_criteria['special__building_location'] ?: $criteria['special__building_location']
: $criteria['special__building_location']
), ),
'removable' => false 'removable' => false
] ]
...@@ -52,8 +50,7 @@ ...@@ -52,8 +50,7 @@
[ [
'criteria' => ( 'criteria' => (
$selected_criteria['special__building_location_label'] $selected_criteria['special__building_location_label']
? $selected_criteria['special__building_location_label'] ?: $criteria['special__building_location_label']
: $criteria['special__building_location_label']
), ),
'removable' => false 'removable' => false
] ]
...@@ -64,16 +61,14 @@ ...@@ -64,16 +61,14 @@
[ [
'criteria' => 'criteria' =>
$selected_criteria['special__seats'] $selected_criteria['special__seats']
? $selected_criteria['special__seats'] ?: $criteria['special__seats']
: $criteria['special__seats']
] ]
) ?> ) ?>
<?= $this->render_partial( <?= $this->render_partial(
'sidebar/room-search-criteria-available-range.php', 'sidebar/room-search-criteria-available-range.php',
[ [
'criteria' => $selected_criteria['special__time_range'] 'criteria' => $selected_criteria['special__time_range']
? $selected_criteria['special__time_range'] ?: $criteria['special__time_range']
: $criteria['special__time_range']
] ]
) ?> ) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment