Skip to content
Snippets Groups Projects
Commit 2d4cb8be authored by David Siegfried's avatar David Siegfried
Browse files

fix rooms search, closes #226 closes #1022, closes #227

Closes #226, #1022, and #227

Merge request studip/studip!648
parent a762ad29
No related branches found
No related tags found
No related merge requests found
...@@ -120,15 +120,13 @@ class RoomSearchWidget extends SidebarWidget ...@@ -120,15 +120,13 @@ class RoomSearchWidget extends SidebarWidget
} }
} }
$current_semester = Semester::findCurrent();
$all_semesters = Semester::getAll();
$begin = new DateTime(); $begin = new DateTime();
$begin = $begin->add(new DateInterval('P1D')); $begin = $begin->setTimestamp($current_semester->beginn);
$begin->setTime(intval(date('H')), 0, 0); $begin->setTime(intval(date('H')), 0, 0);
$end = clone $begin; $end = clone $begin;
$end = $end->add(new DateInterval('PT30M')); $end = $end->setTimestamp($current_semester->ende);
$current_semester = Semester::findCurrent();
$all_semesters = Semester::getAll();
$this->criteria['special__time_range'] = [ $this->criteria['special__time_range'] = [
'name' => 'special__time_range', 'name' => 'special__time_range',
...@@ -164,7 +162,7 @@ class RoomSearchWidget extends SidebarWidget ...@@ -164,7 +162,7 @@ class RoomSearchWidget extends SidebarWidget
'type' => 'num', 'type' => 'num',
'range_search' => true, 'range_search' => true,
'switch' => true, 'switch' => true,
'value' => '0', 'value' => [10, 100],
'optional' => false 'optional' => false
]; ];
} }
......
...@@ -353,12 +353,8 @@ class Resources ...@@ -353,12 +353,8 @@ class Resources
jQuery(new_criteria_inputs[0]).attr('name', option_value); jQuery(new_criteria_inputs[0]).attr('name', option_value);
let min_input = new_criteria_inputs[1]; let min_input = new_criteria_inputs[1];
let max_input = new_criteria_inputs[2]; let max_input = new_criteria_inputs[2];
jQuery(min_input).attr('name', option_value + '_min'); jQuery(min_input).attr({name: option_value + '_min', type: 'number'});
jQuery(min_input).attr('type', 'number'); jQuery(max_input).attr({name: option_value + '_max', 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));
} else { } else {
let new_criteria_input = jQuery(new_criteria).find('input')[0]; let new_criteria_input = jQuery(new_criteria).find('input')[0];
jQuery(new_criteria_input).attr('name', option_value); jQuery(new_criteria_input).attr('name', option_value);
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<option value=""><?= _('Bitte wählen') ?></option> <option value=""><?= _('Bitte wählen') ?></option>
<? foreach ($criteria['day_of_week']['options'] as $value => $title): ?> <? foreach ($criteria['day_of_week']['options'] as $value => $title): ?>
<option value="<?= htmlReady($value) ?>" <option value="<?= htmlReady($value) ?>"
<?= ($value == $day_of_week['value'] <?= ($value === (int)$criteria['day_of_week']['value']
? 'selected="selected"' ? 'selected="selected"'
: '') ?>> : '') ?>>
<?= htmlReady($title) ?> <?= htmlReady($title) ?>
......
<li class="template invisible" <li class="template invisible"
data-template-type="bool"> data-template-type="bool">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -15,8 +14,7 @@ ...@@ -15,8 +14,7 @@
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="range"> data-template-type="range">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -26,18 +24,17 @@ ...@@ -26,18 +24,17 @@
<span></span> <span></span>
<div class="range-input-container"> <div class="range-input-container">
<?= _('von') ?> <?= _('von') ?>
<input type="number" <input type="number" value="10"
class="room-search-widget_criteria-list_input"> class="room-search-widget_criteria-list_input">
<?= _('bis') ?> <?= _('bis') ?>
<input type="number" <input type="number" value="100"
class="room-search-widget_criteria-list_input"> class="room-search-widget_criteria-list_input">
</div> </div>
</label> </label>
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="num"> data-template-type="num">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -50,8 +47,7 @@ ...@@ -50,8 +47,7 @@
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="select"> data-template-type="select">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -64,8 +60,7 @@ ...@@ -64,8 +60,7 @@
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="date"> data-template-type="date">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -83,8 +78,7 @@ ...@@ -83,8 +78,7 @@
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="date_range"> data-template-type="date_range">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
...@@ -103,8 +97,7 @@ ...@@ -103,8 +97,7 @@
</li> </li>
<li class="template invisible" <li class="template invisible"
data-template-type="other"> data-template-type="other">
<?= Icon::create('trash', 'clickable')->asImg( <?= Icon::create('trash')->asImg(
'16px',
[ [
'class' => 'text-bottom remove-icon' 'class' => 'text-bottom remove-icon'
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment