reformatted code due to guidelines

This commit is contained in:
jwacalex 2018-12-22 02:13:02 +01:00 committed by msquare
parent 60a9c15454
commit 8c5b52aa11
1 changed files with 25 additions and 25 deletions

View File

@ -183,10 +183,10 @@ function admin_shifts()
$shifts = []; $shifts = [];
if ($mode == 'single') { if ($mode == 'single') {
$shifts[] = [ $shifts[] = [
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
} elseif ($mode == 'multi') { } elseif ($mode == 'multi') {
@ -202,10 +202,10 @@ function admin_shifts()
} }
$shifts[] = [ $shifts[] = [
'start' => $shift_start, 'start' => $shift_start,
'end' => $shift_end, 'end' => $shift_end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
@ -217,17 +217,17 @@ function admin_shifts()
$change_index = 0; $change_index = 0;
// Ersten/nächsten passenden Schichtwechsel suchen // Ersten/nächsten passenden Schichtwechsel suchen
foreach ($change_hours as $i => $change_time) { foreach ($change_hours as $i => $change_time) {
if(!preg_match('/\d{2}:\d{2}/',$change_time)) { if (!preg_match('/\d{2}:\d{2}/', $change_time)) {
$change_time = $change_time.":00"; $change_time = $change_time . ":00";
} }
$change_time = explode(':',$change_time); $change_time = explode(':', $change_time);
$change_hour = $change_time[0]; $change_hour = $change_time[0];
$change_minute = $change_time[1]; $change_minute = $change_time[1];
if ($start < $day + $change_hour * 60 * 60 + $change_minute * 60) { if ($start < $day + $change_hour * 60 * 60 + $change_minute * 60) {
$change_index = $i; $change_index = $i;
} elseif ($start == $day + $change_hour * 60 * 60 + $change_minute * 60) { } elseif ($start == $day + $change_hour * 60 * 60 + $change_minute * 60) {
// Start trifft Schichtwechsel // Start trifft Schichtwechsel
$change_index = ($i + count($change_hours) - 1) % count($change_hours); $change_index = ($i + count($change_hours) - 1) % count($change_hours);
break; break;
@ -240,12 +240,12 @@ function admin_shifts()
do { do {
$day = parse_date('Y-m-d H:i', date('Y-m-d', $shift_start) . ' 00:00'); $day = parse_date('Y-m-d H:i', date('Y-m-d', $shift_start) . ' 00:00');
$change_time=$change_hours[$change_index]; $change_time = $change_hours[$change_index];
if(!preg_match('/\d{2}:\d{2}/',$change_time)) { if (!preg_match('/\d{2}:\d{2}/', $change_time)) {
$change_time = $change_time.":00"; $change_time = $change_time . ":00";
} }
$change_time = explode(':',$change_time); $change_time = explode(':', $change_time);
$change_hour = $change_time[0]; $change_hour = $change_time[0];
$change_minute = $change_time[1]; $change_minute = $change_time[1];
@ -261,10 +261,10 @@ function admin_shifts()
} }
$shifts[] = [ $shifts[] = [
'start' => $shift_start, 'start' => $shift_start,
'end' => $shift_end, 'end' => $shift_end,
'RID' => $rid, 'RID' => $rid,
'title' => $title, 'title' => $title,
'shifttype_id' => $shifttype_id 'shifttype_id' => $shifttype_id
]; ];
@ -276,14 +276,14 @@ function admin_shifts()
$shifts_table = []; $shifts_table = [];
foreach ($shifts as $shift) { foreach ($shifts as $shift) {
$shifts_table_entry = [ $shifts_table_entry = [
'timeslot' => 'timeslot' =>
'<span class="glyphicon glyphicon-time"></span> ' '<span class="glyphicon glyphicon-time"></span> '
. date('Y-m-d H:i', $shift['start']) . date('Y-m-d H:i', $shift['start'])
. ' - ' . ' - '
. date('H:i', $shift['end']) . date('H:i', $shift['end'])
. '<br />' . '<br />'
. Room_name_render(Room($shift['RID'])), . Room_name_render(Room($shift['RID'])),
'title' => 'title' =>
ShiftType_name_render(ShiftType($shifttype_id)) ShiftType_name_render(ShiftType($shifttype_id))
. ($shift['title'] ? '<br />' . $shift['title'] : ''), . ($shift['title'] ? '<br />' . $shift['title'] : ''),
'needed_angels' => '' 'needed_angels' => ''
@ -319,8 +319,8 @@ function admin_shifts()
form_hidden('angelmode', $angelmode), form_hidden('angelmode', $angelmode),
form_submit('back', __('back')), form_submit('back', __('back')),
table([ table([
'timeslot' => __('Time and location'), 'timeslot' => __('Time and location'),
'title' => __('Type and title'), 'title' => __('Type and title'),
'needed_angels' => __('Needed angels') 'needed_angels' => __('Needed angels')
], $shifts_table), ], $shifts_table),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))