Skip to content
Snippets Groups Projects
Commit 833fdebf authored by Moritz Strohm's avatar Moritz Strohm Committed by Peter Thienel
Browse files

settings/calendar: check for start and end time and allow the end time to be...

settings/calendar: check for start and end time and allow the end time to be set to 24:00, fixes #3868

Closes #3868

Merge request studip/studip!2721
parent c4c3cfb3
No related branches found
No related tags found
No related merge requests found
...@@ -56,10 +56,23 @@ class Settings_CalendarController extends Settings_SettingsController ...@@ -56,10 +56,23 @@ class Settings_CalendarController extends Settings_SettingsController
{ {
$this->check_ticket(); $this->check_ticket();
$start = Request::option('cal_start');
$end = Request::option('cal_end');
if ($start >= $end) {
PageLayout::postError(_('Die Startuhrzeit muss vor der Enduhrzeit liegen.'));
$calendar_user_control_data = (array) UserConfig::get($GLOBALS['user']->id)->getValue('CALENDAR_SETTINGS');
foreach ($calendar_user_control_data as $key => $value) {
$this->$key = $value;
}
$this->start = $start;
$this->end = $end;
return;
}
$this->config->store('CALENDAR_SETTINGS', [ $this->config->store('CALENDAR_SETTINGS', [
'view' => Request::option('cal_view'), 'view' => Request::option('cal_view'),
'start' => Request::option('cal_start'), 'start' => $start,
'end' => Request::option('cal_end'), 'end' => $end,
'step_day' => Request::option('cal_step_day'), 'step_day' => Request::option('cal_step_day'),
'step_week' => Request::option('cal_step_week'), 'step_week' => Request::option('cal_step_week'),
'type_week' => Request::option('cal_type_week'), 'type_week' => Request::option('cal_type_week'),
......
...@@ -78,7 +78,7 @@ $cal_step_weeks = [ ...@@ -78,7 +78,7 @@ $cal_step_weeks = [
<label> <label>
<?= _('Enduhrzeit') ?> <?= _('Enduhrzeit') ?>
<select name="cal_end" aria-label="<?= _('Endzeit der Tages- und Wochenansicht') ?>" class="size-s"> <select name="cal_end" aria-label="<?= _('Endzeit der Tages- und Wochenansicht') ?>" class="size-s">
<? for ($i = 0; $i < 24; $i += 1): ?> <? for ($i = 1; $i < 25; $i += 1): ?>
<option value="<?= $i ?>" <? if ($end == $i) echo 'selected'; ?>> <option value="<?= $i ?>" <? if ($end == $i) echo 'selected'; ?>>
<?= sprintf(_('%02u:00 Uhr'), $i) ?> <?= sprintf(_('%02u:00 Uhr'), $i) ?>
</option> </option>
......
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