summaryrefslogtreecommitdiff
path: root/includes/pages/user_myshifts.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/pages/user_myshifts.php')
-rw-r--r--includes/pages/user_myshifts.php50
1 files changed, 6 insertions, 44 deletions
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php
index 836bd566..f605792f 100644
--- a/includes/pages/user_myshifts.php
+++ b/includes/pages/user_myshifts.php
@@ -26,12 +26,12 @@ function user_myshifts()
&& preg_match('/^\d{1,}$/', $request->input('id'))
&& count(DB::select('SELECT `UID` FROM `User` WHERE `UID`=?', [$request->input('id')])) > 0
) {
- $user_id = $request->input('id');
+ $shift_entry_id = $request->input('id');
} else {
- $user_id = $user['UID'];
+ $shift_entry_id = $user['UID'];
}
- $shifts_user = DB::selectOne('SELECT * FROM `User` WHERE `UID`=? LIMIT 1', [$user_id]);
+ $shifts_user = DB::selectOne('SELECT * FROM `User` WHERE `UID`=? LIMIT 1', [$shift_entry_id]);
if ($request->has('reset')) {
if ($request->input('reset') == 'ack') {
@@ -47,7 +47,7 @@ function user_myshifts()
button(page_link_to('user_myshifts', ['reset' => 'ack']), _('Continue'), 'btn-danger')
]);
} elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) {
- $user_id = $request->input('edit');
+ $shift_entry_id = $request->input('edit');
$shift = DB::selectOne('
SELECT
`ShiftEntry`.`freeloaded`,
@@ -68,7 +68,7 @@ function user_myshifts()
LIMIT 1
',
[
- $user_id,
+ $shift_entry_id,
$shifts_user['UID'],
]
);
@@ -92,7 +92,7 @@ function user_myshifts()
if ($valid) {
ShiftEntry_update([
- 'id' => $user_id,
+ 'id' => $shift_entry_id,
'Comment' => $comment,
'freeloaded' => $freeloaded,
'freeload_comment' => $freeload_comment
@@ -124,44 +124,6 @@ function user_myshifts()
} else {
redirect(page_link_to('user_myshifts'));
}
- } elseif ($request->has('cancel') && preg_match('/^\d+$/', $request->input('cancel'))) {
- $user_id = $request->input('cancel');
- $shift = DB::selectOne('
- SELECT *
- FROM `Shifts`
- INNER JOIN `ShiftEntry` USING (`SID`)
- WHERE `ShiftEntry`.`id`=? AND `UID`=?
- ',
- [
- $user_id,
- $shifts_user['UID'],
- ]
- );
- if (count($shift) > 0) {
- if (
- ($shift['start'] > time() + config('last_unsubscribe') * 3600)
- || in_array('user_shifts_admin', $privileges)
- ) {
- ShiftEntry_delete($user_id);
-
- $room = Room($shift['RID']);
- $angeltype = AngelType($shift['TID']);
- $shifttype = ShiftType($shift['shifttype_id']);
-
- engelsystem_log(
- 'Deleted own shift: ' . $shifttype['name']
- . ' at ' . $room['Name']
- . ' from ' . date('Y-m-d H:i', $shift['start'])
- . ' to ' . date('Y-m-d H:i', $shift['end'])
- . ' as ' . $angeltype['name']
- );
- success(_('Shift canceled.'));
- } else {
- error(_('It\'s too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so.'));
- }
- } else {
- redirect(user_link($shifts_user));
- }
}
redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user['UID']]));