summaryrefslogtreecommitdiff
path: root/includes/controller/shifts_controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller/shifts_controller.php')
-rw-r--r--includes/controller/shifts_controller.php36
1 files changed, 22 insertions, 14 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 96f12baa..c359850f 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -1,4 +1,5 @@
<?php
+
use Engelsystem\ShiftSignupState;
/**
@@ -7,7 +8,7 @@ use Engelsystem\ShiftSignupState;
*/
function shift_link($shift)
{
- $link = page_link_to('shifts') . '&action=view';
+ $link = page_link_to('shifts', ['action' => 'view']);
if (isset($shift['SID'])) {
$link .= '&shift_id=' . $shift['SID'];
}
@@ -20,7 +21,7 @@ function shift_link($shift)
*/
function shift_delete_link($shift)
{
- return page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'];
+ return page_link_to('user_shifts', ['delete_shift' => $shift['SID']]);
}
/**
@@ -29,7 +30,7 @@ function shift_delete_link($shift)
*/
function shift_edit_link($shift)
{
- return page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'];
+ return page_link_to('user_shifts', ['edit_shift' => $shift['SID']]);
}
/**
@@ -61,7 +62,7 @@ function shift_edit_controller()
$angeltypes = select_array(AngelTypes(), 'id', 'name');
$shifttypes = select_array(ShiftTypes(), 'id', 'name');
- $needed_angel_types = select_array(NeededAngelTypes_by_shift($shift_id), 'id', 'count');
+ $needed_angel_types = select_array(NeededAngelTypes_by_shift($shift_id), 'angel_type_id', 'count');
foreach (array_keys($angeltypes) as $angeltype_id) {
if (!isset($needed_angel_types[$angeltype_id])) {
$needed_angel_types[$angeltype_id] = 0;
@@ -116,15 +117,20 @@ function shift_edit_controller()
$msg .= error(_('The ending time has to be after the starting time.'), true);
}
- foreach ($needed_angel_types as $needed_angeltype_id => $needed_angeltype_name) {
- if ($request->has('type_' . $needed_angeltype_id) && test_request_int('type_' . $needed_angeltype_id)) {
- $needed_angel_types[$needed_angeltype_id] = trim($request->input('type_' . $needed_angeltype_id));
- } else {
- $valid = false;
- $msg .= error(sprintf(
- _('Please check your input for needed angels of type %s.'),
- $needed_angeltype_name
- ), true);
+ foreach ($needed_angel_types as $needed_angeltype_id => $count) {
+ $needed_angel_types[$needed_angeltype_id] = 0;
+
+ $queryKey = 'type_' . $needed_angeltype_id;
+ if ($request->has($queryKey)) {
+ if (test_request_int($queryKey)) {
+ $needed_angel_types[$needed_angeltype_id] = trim($request->input($queryKey));
+ } else {
+ $valid = false;
+ $msg .= error(sprintf(
+ _('Please check your input for needed angels of type %s.'),
+ $angeltypes[$needed_angeltype_id]
+ ), true);
+ }
}
}
@@ -225,7 +231,9 @@ function shift_delete_controller()
date('Y-m-d H:i', $shift['start']),
date('H:i', $shift['end'])
), true),
- '<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _('delete') . '</a>'
+ '<a class="button" href="'
+ . page_link_to('user_shifts', ['delete_shift' => $shift_id, 'delete' => 1]) .
+ '">' . _('delete') . '</a>'
]);
}