Skip to content
Snippets Groups Projects
Commit f652b374 authored by David Siegfried's avatar David Siegfried Committed by Elmar Ludwig
Browse files

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

Closes #1423

Merge request studip/studip!897
parent 4306e046
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,7 @@ class RoomSearchWidget extends SidebarWidget
}
$room_types = Room::getAllRoomTypes();
if ($room_types) {
if (!empty($room_types)) {
$filtered_room_types = [];
foreach ($room_types as $type) {
$filtered_room_types[$type] = $type;
......@@ -42,10 +42,6 @@ class RoomSearchWidget extends SidebarWidget
['' => _('Alle Raumtypen')],
$filtered_room_types
);
} else {
$room_types = [
'' => _('Alle Raumtypen')
];
}
$this->criteria = [];
......@@ -89,16 +85,18 @@ class RoomSearchWidget extends SidebarWidget
'value' => '',
'optional' => false
];
$this->criteria['room_type'] = [
'name' => 'room_type',
'title' => _('Raumtyp'),
'type' => 'select',
'range_search' => false,
'options' => $room_types,
'switch' => false,
'value' => '',
'optional' => false
];
if (!empty($room_types)) {
$this->criteria['room_type'] = [
'name' => 'room_type',
'title' => _('Raumtyp'),
'type' => 'select',
'range_search' => false,
'options' => $room_types,
'switch' => false,
'value' => '',
'optional' => false
];
}
$this->criteria['special__building_location'] = [
'name' => 'special__building_location',
'title' => _('Standort / Gebäude'),
......@@ -167,6 +165,7 @@ class RoomSearchWidget extends SidebarWidget
'value' => [10, 100],
'optional' => false
];
}
......
......@@ -6,31 +6,30 @@
'sidebar/room-search-criteria.php',
[
'criteria' => (
$selected_criteria['special__room_name']
? $selected_criteria['special__room_name']
: $criteria['special__room_name']
),
'removable' => false
]
) ?>
<?= $this->render_partial(
'sidebar/room-search-criteria.php',
[
'criteria' => (
$selected_criteria['room_type']
? $selected_criteria['room_type']
: $criteria['room_type']
),
$selected_criteria['special__room_name']
?: $criteria['special__room_name']
),
'removable' => false
]
) ?>
<? if (isset($criteria['room_type'])): ?>
<?= $this->render_partial(
'sidebar/room-search-criteria.php',
[
'criteria' => (
$selected_criteria['room_type']
?: $criteria['room_type']
),
'removable' => false
]
) ?>
<? endif ?>
<?= $this->render_partial(
'sidebar/room-search-criteria.php',
[
'criteria' => (
$selected_criteria['room_category_id']
? $selected_criteria['room_category_id']
: $criteria['room_category_id']
?: $criteria['room_category_id']
),
'removable' => false
]
......@@ -40,8 +39,7 @@
[
'criteria' => (
$selected_criteria['special__building_location']
? $selected_criteria['special__building_location']
: $criteria['special__building_location']
?: $criteria['special__building_location']
),
'removable' => false
]
......@@ -52,8 +50,7 @@
[
'criteria' => (
$selected_criteria['special__building_location_label']
? $selected_criteria['special__building_location_label']
: $criteria['special__building_location_label']
?: $criteria['special__building_location_label']
),
'removable' => false
]
......@@ -64,16 +61,14 @@
[
'criteria' =>
$selected_criteria['special__seats']
? $selected_criteria['special__seats']
: $criteria['special__seats']
?: $criteria['special__seats']
]
) ?>
<?= $this->render_partial(
'sidebar/room-search-criteria-available-range.php',
[
'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.
Finish editing this message first!
Please register or to comment