redo shift signoff and icons for delete/confirm/acknowledgment questions
This commit is contained in:
parent
567ed9ebd2
commit
fd85034e7f
|
@ -40,11 +40,13 @@ function angeltypes_controller()
|
||||||
* Path to angeltype view.
|
* Path to angeltype view.
|
||||||
*
|
*
|
||||||
* @param int $angeltype_id AngelType id
|
* @param int $angeltype_id AngelType id
|
||||||
|
* @param array $params additional params
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function angeltype_link($angeltype_id)
|
function angeltype_link($angeltype_id, $params = [])
|
||||||
{
|
{
|
||||||
return page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype_id]);
|
$params = array_merge(['action' => 'view', 'angeltype_id' => $angeltype_id], $params);
|
||||||
|
return page_link_to('angeltypes', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -232,6 +232,24 @@ function shift_entry_add_controller()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a shift entry from get parameter entry_id.
|
||||||
|
*/
|
||||||
|
function shift_entry_load() {
|
||||||
|
$request = request();
|
||||||
|
|
||||||
|
if (!$request->has('entry_id') || !test_request_int('entry_id')) {
|
||||||
|
redirect(page_link_to('user_shifts'));
|
||||||
|
}
|
||||||
|
$shiftEntry = ShiftEntry($request->input('entry_id'));
|
||||||
|
if($shiftEntry == null) {
|
||||||
|
error(_('Shift entry not found.'));
|
||||||
|
redirect(page_link_to('user_shifts'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $shiftEntry;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove somebody from a shift.
|
* Remove somebody from a shift.
|
||||||
*/
|
*/
|
||||||
|
@ -239,52 +257,25 @@ function shift_entry_delete_controller()
|
||||||
{
|
{
|
||||||
global $privileges, $user;
|
global $privileges, $user;
|
||||||
$request = request();
|
$request = request();
|
||||||
|
$shiftEntry = shift_entry_load();
|
||||||
|
|
||||||
if (!$request->has('entry_id') || !test_request_int('entry_id')) {
|
$shift = Shift($shiftEntry['SID']);
|
||||||
redirect(page_link_to('user_shifts'));
|
$angeltype = AngelType($shiftEntry['TID']);
|
||||||
|
$signout_user = User($shiftEntry['UID']);
|
||||||
|
if(!Shift_signout_allowed($shift, $angeltype, $signout_user)) {
|
||||||
|
error(_('You are not allowed to remove this shift entry. If neccessary, ask your supporter or heaven to do so.'));
|
||||||
|
redirect(user_link($signout_user));
|
||||||
}
|
}
|
||||||
$entry_id = $request->input('entry_id');
|
|
||||||
|
if($request->has('continue')) {
|
||||||
$shift_entry_source = DB::selectOne('
|
ShiftEntry_delete($shiftEntry);
|
||||||
SELECT
|
success(_('Shift entry removed.'));
|
||||||
`User`.`Nick`,
|
redirect(shift_link($shift));
|
||||||
`User`.`Gekommen`,
|
|
||||||
`ShiftEntry`.`Comment`,
|
|
||||||
`ShiftEntry`.`UID`,
|
|
||||||
`ShiftTypes`.`name`,
|
|
||||||
`Shifts`.*,
|
|
||||||
`Room`.`Name`,
|
|
||||||
`AngelTypes`.`name` AS `angel_type`,
|
|
||||||
`AngelTypes`.`id` AS `angeltype_id`
|
|
||||||
FROM `ShiftEntry`
|
|
||||||
JOIN `User` ON (`User`.`UID`=`ShiftEntry`.`UID`)
|
|
||||||
JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`id`)
|
|
||||||
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
|
||||||
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
|
||||||
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
|
||||||
WHERE `ShiftEntry`.`id`=?',
|
|
||||||
[$entry_id]
|
|
||||||
);
|
|
||||||
if (!empty($shift_entry_source)) {
|
|
||||||
if (!in_array('user_shifts_admin', $privileges) && (!in_array('shiftentry_edit_angeltype_supporter',
|
|
||||||
$privileges) || !User_is_AngelType_supporter($user, AngelType($shift_entry_source['angeltype_id'])))
|
|
||||||
) {
|
|
||||||
redirect(page_link_to('user_shifts'));
|
|
||||||
}
|
|
||||||
|
|
||||||
ShiftEntry_delete($entry_id);
|
|
||||||
|
|
||||||
engelsystem_log(
|
|
||||||
'Deleted ' . User_Nick_render($shift_entry_source) . '\'s shift: ' . $shift_entry_source['name']
|
|
||||||
. ' at ' . $shift_entry_source['Name']
|
|
||||||
. ' from ' . date('Y-m-d H:i', $shift_entry_source['start'])
|
|
||||||
. ' to ' . date('Y-m-d H:i', $shift_entry_source['end'])
|
|
||||||
. ' as ' . $shift_entry_source['angel_type']
|
|
||||||
);
|
|
||||||
success(_('Shift entry deleted.'));
|
|
||||||
} else {
|
|
||||||
error(_('Entry not found.'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect(shift_link($shift_entry_source));
|
if($user['UID'] == $signout_user['UID']) {
|
||||||
|
return ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signout_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signout_user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,7 @@ function user_angeltypes_confirm_all_controller()
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
|
if (!in_array('admin_user_angeltypes', $privileges) && !User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
if ($user_angeltype == null) {
|
|
||||||
error(_('User angeltype doesn\'t exist.'));
|
|
||||||
redirect(page_link_to('angeltypes'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array('admin_user_angeltypes', $privileges) && !$user_angeltype['supporter']) {
|
|
||||||
error(_('You are not allowed to confirm all users for this angeltype.'));
|
error(_('You are not allowed to confirm all users for this angeltype.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,13 +134,26 @@ function ShiftEntry($shift_entry_id)
|
||||||
/**
|
/**
|
||||||
* Delete a shift entry.
|
* Delete a shift entry.
|
||||||
*
|
*
|
||||||
* @param int $shift_entry_id
|
* @param array $shiftEntry
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_delete($shift_entry_id)
|
function ShiftEntry_delete($shiftEntry)
|
||||||
{
|
{
|
||||||
$shift_entry = ShiftEntry($shift_entry_id);
|
mail_shift_removed(User($shiftEntry['UID']), Shift($shiftEntry['SID']));
|
||||||
mail_shift_removed(User($shift_entry['UID']), Shift($shift_entry['SID']));
|
|
||||||
DB::delete('DELETE FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]);
|
DB::delete('DELETE FROM `ShiftEntry` WHERE `id` = ?', [$shift_entry_id]);
|
||||||
|
|
||||||
|
$signout_user = User($shiftEntry['UID']);
|
||||||
|
$shift = Shift($shiftEntry['SID']);
|
||||||
|
$shifttype = ShiftType($shift['shifttype_id']);
|
||||||
|
$room = Room($shift['RID']);
|
||||||
|
$angeltype = AngelType($shiftEntry['TID']);
|
||||||
|
|
||||||
|
engelsystem_log(
|
||||||
|
'Shift signout: '. User_Nick_render($signout_user) . ' from 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']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -402,6 +402,38 @@ function Shift_signup_allowed_admin($needed_angeltype, $shift_entries)
|
||||||
return new ShiftSignupState(ShiftSignupState::FREE, $free_entries);
|
return new ShiftSignupState(ShiftSignupState::FREE, $free_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if an angel can signout from a shift.
|
||||||
|
*
|
||||||
|
* @param $shift The shift
|
||||||
|
* @param $angeltype The angeltype
|
||||||
|
* @param $signout_user The user that was signed up for the shift
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function Shift_signout_allowed($shift, $angeltype, $signout_user) {
|
||||||
|
global $user, $privileges;
|
||||||
|
|
||||||
|
// user shifts admin can sign out any user at any time
|
||||||
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// angeltype supporter can sign out any user at any time from their supported angeltype
|
||||||
|
if (
|
||||||
|
in_array('shiftentry_edit_angeltype_supporter', $privileges)
|
||||||
|
&& User_is_AngelType_supporter($user, $angeltype)
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($signout_user['UID'] == $user['UID'] && $shift['start'] > time() + config('last_unsubscribe') * 3600) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an angel can sign up for given shift.
|
* Check if an angel can sign up for given shift.
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,12 +26,12 @@ function user_myshifts()
|
||||||
&& preg_match('/^\d{1,}$/', $request->input('id'))
|
&& preg_match('/^\d{1,}$/', $request->input('id'))
|
||||||
&& count(DB::select('SELECT `UID` FROM `User` WHERE `UID`=?', [$request->input('id')])) > 0
|
&& 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 {
|
} 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->has('reset')) {
|
||||||
if ($request->input('reset') == 'ack') {
|
if ($request->input('reset') == 'ack') {
|
||||||
|
@ -47,7 +47,7 @@ function user_myshifts()
|
||||||
button(page_link_to('user_myshifts', ['reset' => 'ack']), _('Continue'), 'btn-danger')
|
button(page_link_to('user_myshifts', ['reset' => 'ack']), _('Continue'), 'btn-danger')
|
||||||
]);
|
]);
|
||||||
} elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) {
|
} elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) {
|
||||||
$user_id = $request->input('edit');
|
$shift_entry_id = $request->input('edit');
|
||||||
$shift = DB::selectOne('
|
$shift = DB::selectOne('
|
||||||
SELECT
|
SELECT
|
||||||
`ShiftEntry`.`freeloaded`,
|
`ShiftEntry`.`freeloaded`,
|
||||||
|
@ -68,7 +68,7 @@ function user_myshifts()
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
',
|
',
|
||||||
[
|
[
|
||||||
$user_id,
|
$shift_entry_id,
|
||||||
$shifts_user['UID'],
|
$shifts_user['UID'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -92,7 +92,7 @@ function user_myshifts()
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
ShiftEntry_update([
|
ShiftEntry_update([
|
||||||
'id' => $user_id,
|
'id' => $shift_entry_id,
|
||||||
'Comment' => $comment,
|
'Comment' => $comment,
|
||||||
'freeloaded' => $freeloaded,
|
'freeloaded' => $freeloaded,
|
||||||
'freeload_comment' => $freeload_comment
|
'freeload_comment' => $freeload_comment
|
||||||
|
@ -124,44 +124,6 @@ function user_myshifts()
|
||||||
} else {
|
} else {
|
||||||
redirect(page_link_to('user_myshifts'));
|
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']]));
|
redirect(page_link_to('users', ['action' => 'view', 'user_id' => $shifts_user['UID']]));
|
||||||
|
|
|
@ -31,8 +31,7 @@ function user_shifts()
|
||||||
|
|
||||||
// Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
|
// Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
|
||||||
if ($request->has('entry_id')) {
|
if ($request->has('entry_id')) {
|
||||||
shift_entry_delete_controller();
|
return shift_entry_delete_controller();
|
||||||
return '';
|
|
||||||
} elseif ($request->has('edit_shift')) {
|
} elseif ($request->has('edit_shift')) {
|
||||||
return shift_edit_controller();
|
return shift_edit_controller();
|
||||||
} elseif ($request->has('delete_shift')) {
|
} elseif ($request->has('delete_shift')) {
|
||||||
|
|
|
@ -50,14 +50,14 @@ function AngelType_delete_view($angeltype)
|
||||||
return page_with_title(sprintf(_('Delete angeltype %s'), $angeltype['name']), [
|
return page_with_title(sprintf(_('Delete angeltype %s'), $angeltype['name']), [
|
||||||
info(sprintf(_('Do you want to delete angeltype %s?'), $angeltype['name']), true),
|
info(sprintf(_('Do you want to delete angeltype %s?'), $angeltype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes'), _('cancel'), 'cancel'),
|
button(page_link_to('angeltypes'), glyph('remove') . _('cancel')),
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
'angeltypes',
|
'angeltypes',
|
||||||
['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
||||||
),
|
),
|
||||||
_('delete'),
|
glyph('ok') . _('delete'),
|
||||||
'ok'
|
'btn-danger'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -153,7 +153,7 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
|
||||||
}
|
}
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']]),
|
page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']]),
|
||||||
_('leave'), 'cancel'
|
_('leave')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,13 +442,11 @@ function AngelType_view_info(
|
||||||
$info[] = buttons([
|
$info[] = buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']]),
|
page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']]),
|
||||||
_('confirm all'),
|
glyph('ok') . _('confirm all')
|
||||||
'ok'
|
|
||||||
),
|
),
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']]),
|
page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']]),
|
||||||
_('deny all'),
|
glyph('remove') . _('deny all')
|
||||||
'cancel'
|
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
$info[] = table($table_headers, $members_unconfirmed);
|
$info[] = table($table_headers, $members_unconfirmed);
|
||||||
|
@ -523,8 +521,7 @@ function AngelTypes_about_view_angeltype($angeltype)
|
||||||
'user_angeltypes',
|
'user_angeltypes',
|
||||||
['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']]
|
['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']]
|
||||||
),
|
),
|
||||||
_('leave'),
|
_('leave')
|
||||||
'cancel'
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
|
|
|
@ -1,5 +1,76 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign off from an user from a shift with admin permissions, asking for ack.
|
||||||
|
*
|
||||||
|
* @param array $shiftEntry
|
||||||
|
* @param array $shift
|
||||||
|
* @param array $angeltype
|
||||||
|
* @param array $signoff_user
|
||||||
|
*
|
||||||
|
* @return string HTML
|
||||||
|
*/
|
||||||
|
function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user) {
|
||||||
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
|
info(sprintf(
|
||||||
|
_('Do you want to sign off %s from shift %s from %s to %s as %s?'),
|
||||||
|
User_Nick_render($signoff_user),
|
||||||
|
$shift['name'],
|
||||||
|
date('Y-m-d H:i', $shift['start']),
|
||||||
|
date('Y-m-d H:i', $shift['end']),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
|
buttons([
|
||||||
|
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
||||||
|
button(ShiftEntry_delete_link($shiftEntry, ['continue' => 1]), glyph('ok') . _('delete'), 'btn-danger')
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sign off from a shift, asking for ack.
|
||||||
|
*
|
||||||
|
* @param array $shiftEntry
|
||||||
|
* @param array $shift
|
||||||
|
* @param array $angeltype
|
||||||
|
* @param array $signoff_user
|
||||||
|
*
|
||||||
|
* @return string HTML
|
||||||
|
*/
|
||||||
|
function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user) {
|
||||||
|
return page_with_title(ShiftEntry_delete_title(), [
|
||||||
|
info(sprintf(
|
||||||
|
_('Do you want to sign off from your shift %s from %s to %s as %s?'),
|
||||||
|
$shift['name'],
|
||||||
|
date('Y-m-d H:i', $shift['start']),
|
||||||
|
date('Y-m-d H:i', $shift['end']),
|
||||||
|
$angeltype['name']
|
||||||
|
), true),
|
||||||
|
buttons([
|
||||||
|
button(user_link($signoff_user), glyph('remove') . _('cancel')),
|
||||||
|
button(ShiftEntry_delete_link($shiftEntry, ['continue' => 1]), glyph('ok') . _('delete'), 'btn-danger')
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to delete a shift entry.
|
||||||
|
* @param array $shiftEntry
|
||||||
|
*
|
||||||
|
* @return string URL
|
||||||
|
*/
|
||||||
|
function ShiftEntry_delete_link($shiftEntry, $params = []) {
|
||||||
|
$params = array_merge(['entry_id' => $shiftEntry['id']], $params);
|
||||||
|
return page_link_to('user_shifts', $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title for deleting a shift entry.
|
||||||
|
*/
|
||||||
|
function ShiftEntry_delete_title() {
|
||||||
|
return _('Shift sign off');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display form for adding/editing a shift entry.
|
* Display form for adding/editing a shift entry.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,14 +22,14 @@ function ShiftType_delete_view($shifttype)
|
||||||
return page_with_title(sprintf(_('Delete shifttype %s'), $shifttype['name']), [
|
return page_with_title(sprintf(_('Delete shifttype %s'), $shifttype['name']), [
|
||||||
info(sprintf(_('Do you want to delete shifttype %s?'), $shifttype['name']), true),
|
info(sprintf(_('Do you want to delete shifttype %s?'), $shifttype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('shifttypes'), _('cancel'), 'cancel'),
|
button(page_link_to('shifttypes'), glyph('remove') . _('cancel')),
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
'shifttypes',
|
'shifttypes',
|
||||||
['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1]
|
['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1]
|
||||||
),
|
),
|
||||||
_('delete'),
|
glyph('ok') . _('delete'),
|
||||||
'ok btn-danger'
|
'btn-danger'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -21,8 +21,7 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||||
_('cancel'),
|
glyph('remove') . _('cancel')
|
||||||
'cancel'
|
|
||||||
),
|
),
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes', [
|
page_link_to('user_angeltypes', [
|
||||||
|
@ -31,8 +30,8 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
|
||||||
'supporter' => ($supporter ? '1' : '0'),
|
'supporter' => ($supporter ? '1' : '0'),
|
||||||
'confirmed' => 1,
|
'confirmed' => 1,
|
||||||
]),
|
]),
|
||||||
_('yes'),
|
glyph('ok') . _('yes'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -53,16 +52,15 @@ function UserAngelTypes_delete_all_view($angeltype)
|
||||||
'angeltypes',
|
'angeltypes',
|
||||||
['action' => 'view', 'angeltype_id' => $angeltype['id']]
|
['action' => 'view', 'angeltype_id' => $angeltype['id']]
|
||||||
),
|
),
|
||||||
_('cancel'),
|
glyph('remove') . _('cancel')
|
||||||
'cancel'
|
|
||||||
),
|
),
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
'user_angeltypes',
|
'user_angeltypes',
|
||||||
['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
||||||
),
|
),
|
||||||
_('yes'),
|
glyph('ok') . _('yes'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -78,13 +76,12 @@ function UserAngelTypes_confirm_all_view($angeltype)
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), _('cancel'),
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
'cancel'),
|
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes',
|
page_link_to('user_angeltypes',
|
||||||
['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
|
['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
|
||||||
_('yes'),
|
glyph('ok') . _('yes'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -102,18 +99,14 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
|
||||||
_('cancel'),
|
|
||||||
'cancel'
|
|
||||||
),
|
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
'user_angeltypes',
|
'user_angeltypes',
|
||||||
['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
|
['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
|
||||||
),
|
),
|
||||||
_('yes'),
|
glyph('ok') . _('yes'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -131,16 +124,12 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
|
||||||
_('cancel'),
|
|
||||||
'cancel'
|
|
||||||
),
|
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes',
|
page_link_to('user_angeltypes',
|
||||||
['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
|
['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
|
||||||
_('yes'),
|
glyph('ok') . _('yes'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -187,18 +176,14 @@ function UserAngelType_join_view($user, $angeltype)
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(
|
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')),
|
||||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
|
||||||
_('cancel'),
|
|
||||||
'cancel'
|
|
||||||
),
|
|
||||||
button(
|
button(
|
||||||
page_link_to(
|
page_link_to(
|
||||||
'user_angeltypes',
|
'user_angeltypes',
|
||||||
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1]
|
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1]
|
||||||
),
|
),
|
||||||
_('save'),
|
glyph('ok') . _('save'),
|
||||||
'ok'
|
'btn-primary'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -363,19 +363,9 @@ function User_view_myshift($shift, $user_source, $its_me)
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (
|
if (Shift_signout_allowed($shift, ['id' => $shift['TID']], $user_source)) {
|
||||||
($shift['start'] > time() + config('last_unsubscribe') * 3600)
|
|
||||||
|| in_array('user_shifts_admin', $privileges)
|
|
||||||
) {
|
|
||||||
$parameters = [
|
|
||||||
'cancel' => $shift['id'],
|
|
||||||
'id' => $user_source['UID'],
|
|
||||||
];
|
|
||||||
if ($its_me) {
|
|
||||||
$parameters['id'] = '';
|
|
||||||
}
|
|
||||||
$myshift['actions'][] = button(
|
$myshift['actions'][] = button(
|
||||||
page_link_to('user_myshifts', $parameters),
|
ShiftEntry_delete_link($shift),
|
||||||
glyph('trash') . _('sign off'),
|
glyph('trash') . _('sign off'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue