summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-19 20:58:01 +0100
committermsquare <msquare@notrademark.de>2017-12-19 20:58:01 +0100
commitfd85034e7f2277730f4ea4de49dade6d125832dd (patch)
tree54017bb754302b578838479d8f4d68f4a92010dd /includes/pages
parent567ed9ebd2603a5deb9c171b4d969f7188414794 (diff)
redo shift signoff and icons for delete/confirm/acknowledgment questions
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/user_myshifts.php50
-rw-r--r--includes/pages/user_shifts.php3
2 files changed, 7 insertions, 46 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']]));
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 355a7bb6..9ff9ba1a 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -31,8 +31,7 @@ function user_shifts()
// Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
if ($request->has('entry_id')) {
- shift_entry_delete_controller();
- return '';
+ return shift_entry_delete_controller();
} elseif ($request->has('edit_shift')) {
return shift_edit_controller();
} elseif ($request->has('delete_shift')) {