diff options
-rw-r--r-- | includes/pages/user_myshifts.php | 2 | ||||
-rw-r--r-- | includes/pages/user_shifts.php | 3 | ||||
-rw-r--r-- | includes/sys_shift.php | 11 |
3 files changed, 14 insertions, 2 deletions
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 9f344d6d..4dc4cc81 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -21,7 +21,7 @@ function user_myshifts() { return template_render('../templates/user_shifts_add.html', array ( 'angel' => $user['Nick'], - 'date' => date("Y-m-d H:i", $shift['start']) . ', ' . date("H", $shift['end'] - $shift['start']) . ' h', + 'date' => date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift), 'location' => $shift['Name'], 'title' => $shift['name'], 'type' => $shift['angel_type'], diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index c2648a78..3c2e9330 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -93,7 +93,8 @@ function user_shifts() { $user_text = $user['Nick']; return template_render('../templates/user_shifts_add.html', array ( - 'date' => date("Y-m-d H:i", $shift['start']) . ', ' . date("H:i", $shift['end'] - $shift['start']) . 'h', + //'date' => date("Y-m-d H:i", $shift['start']) . ', ' . date("H:i", $shift['end'] - $shift['start']) . 'h', + 'date' => date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift), 'title' => $shift['name'], 'location' => $shift['Name'], 'angel' => $user_text, diff --git a/includes/sys_shift.php b/includes/sys_shift.php index 7baeb8a4..329a40ff 100644 --- a/includes/sys_shift.php +++ b/includes/sys_shift.php @@ -1,4 +1,15 @@ <?php + + +/** + * Shiftlänge ausrechnen, kommt im Format 12:23h zurück + */ +function shift_length($shift) { + $length = round(($shift['end'] - $shift['start']) / (60 * 60), 0) . ":"; + $length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h"; + return $length; +} + function load_shift_basics() { global $VeranstaltungsTageMax, $Room, $RoomID, $EngelType, $EngelTypeID, $TID2Name, $Veranstaltungstage; |