aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2022-05-20 11:34:43 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2022-05-20 11:34:43 +0000
commit2d4cb8be96700192fa0395400df3338f3fafd369 (patch)
treec5750aeb8bc3f5812625d1bb18840994aa78ae06
parenta762ad293934d305237e0090dc9499cd23788bbe (diff)
fix rooms search, closes #226 closes #1022, closes #227
Closes #226, #1022, and #227 Merge request studip/studip!648
-rw-r--r--lib/classes/sidebar/RoomSearchWidget.class.php12
-rw-r--r--resources/assets/javascripts/lib/resources.js8
-rw-r--r--templates/sidebar/room-search-criteria-available-range.php2
-rw-r--r--templates/sidebar/room-search-criteria-templates.php25
4 files changed, 17 insertions, 30 deletions
diff --git a/lib/classes/sidebar/RoomSearchWidget.class.php b/lib/classes/sidebar/RoomSearchWidget.class.php
index 652edfb..8f2aec6 100644
--- a/lib/classes/sidebar/RoomSearchWidget.class.php
+++ b/lib/classes/sidebar/RoomSearchWidget.class.php
@@ -120,15 +120,13 @@ class RoomSearchWidget extends SidebarWidget
}
}
-
+ $current_semester = Semester::findCurrent();
+ $all_semesters = Semester::getAll();
$begin = new DateTime();
- $begin = $begin->add(new DateInterval('P1D'));
+ $begin = $begin->setTimestamp($current_semester->beginn);
$begin->setTime(intval(date('H')), 0, 0);
$end = clone $begin;
- $end = $end->add(new DateInterval('PT30M'));
-
- $current_semester = Semester::findCurrent();
- $all_semesters = Semester::getAll();
+ $end = $end->setTimestamp($current_semester->ende);
$this->criteria['special__time_range'] = [
'name' => 'special__time_range',
@@ -164,7 +162,7 @@ class RoomSearchWidget extends SidebarWidget
'type' => 'num',
'range_search' => true,
'switch' => true,
- 'value' => '0',
+ 'value' => [10, 100],
'optional' => false
];
}
diff --git a/resources/assets/javascripts/lib/resources.js b/resources/assets/javascripts/lib/resources.js
index 9f1f066..ccc8ca3 100644
--- a/resources/assets/javascripts/lib/resources.js
+++ b/resources/assets/javascripts/lib/resources.js
@@ -353,12 +353,8 @@ class Resources
jQuery(new_criteria_inputs[0]).attr('name', option_value);
let min_input = new_criteria_inputs[1];
let max_input = new_criteria_inputs[2];
- jQuery(min_input).attr('name', option_value + '_min');
- jQuery(min_input).attr('type', 'number');
- jQuery(max_input).attr('name', option_value + '_max');
- jQuery(max_input).attr('type', 'number');
- jQuery(min_input).val(Math.round(parseInt(min_input) * 1.25));
- jQuery(max_input).val(Math.round(parseInt(max_input) * 0.75));
+ jQuery(min_input).attr({name: option_value + '_min', type: 'number'});
+ jQuery(max_input).attr({name: option_value + '_max', type: 'number'});
} else {
let new_criteria_input = jQuery(new_criteria).find('input')[0];
jQuery(new_criteria_input).attr('name', option_value);
diff --git a/templates/sidebar/room-search-criteria-available-range.php b/templates/sidebar/room-search-criteria-available-range.php
index 1a07f65..4157e35 100644
--- a/templates/sidebar/room-search-criteria-available-range.php
+++ b/templates/sidebar/room-search-criteria-available-range.php
@@ -99,7 +99,7 @@
<option value=""><?= _('Bitte wählen') ?></option>
<? foreach ($criteria['day_of_week']['options'] as $value => $title): ?>
<option value="<?= htmlReady($value) ?>"
- <?= ($value == $day_of_week['value']
+ <?= ($value === (int)$criteria['day_of_week']['value']
? 'selected="selected"'
: '') ?>>
<?= htmlReady($title) ?>
diff --git a/templates/sidebar/room-search-criteria-templates.php b/templates/sidebar/room-search-criteria-templates.php
index 33eb2f5..1713982 100644
--- a/templates/sidebar/room-search-criteria-templates.php
+++ b/templates/sidebar/room-search-criteria-templates.php
@@ -1,7 +1,6 @@
<li class="template invisible"
data-template-type="bool">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -15,8 +14,7 @@
</li>
<li class="template invisible"
data-template-type="range">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -26,18 +24,17 @@
<span></span>
<div class="range-input-container">
<?= _('von') ?>
- <input type="number"
+ <input type="number" value="10"
class="room-search-widget_criteria-list_input">
<?= _('bis') ?>
- <input type="number"
+ <input type="number" value="100"
class="room-search-widget_criteria-list_input">
</div>
</label>
</li>
<li class="template invisible"
data-template-type="num">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -50,8 +47,7 @@
</li>
<li class="template invisible"
data-template-type="select">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -64,8 +60,7 @@
</li>
<li class="template invisible"
data-template-type="date">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -83,8 +78,7 @@
</li>
<li class="template invisible"
data-template-type="date_range">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]
@@ -103,8 +97,7 @@
</li>
<li class="template invisible"
data-template-type="other">
- <?= Icon::create('trash', 'clickable')->asImg(
- '16px',
+ <?= Icon::create('trash')->asImg(
[
'class' => 'text-bottom remove-icon'
]