summaryrefslogtreecommitdiff
path: root/includes/controller/shifttypes_controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller/shifttypes_controller.php')
-rw-r--r--includes/controller/shifttypes_controller.php84
1 files changed, 42 insertions, 42 deletions
diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php
index f54111c4..4bbf041d 100644
--- a/includes/controller/shifttypes_controller.php
+++ b/includes/controller/shifttypes_controller.php
@@ -10,34 +10,34 @@ function shifttype_link($shifttype)
*/
function shifttype_delete_controller()
{
- if (! isset($_REQUEST['shifttype_id'])) {
+ if (!isset($_REQUEST['shifttype_id'])) {
redirect(page_link_to('shifttypes'));
}
-
+
$shifttype = ShiftType($_REQUEST['shifttype_id']);
if ($shifttype === false) {
engelsystem_error('Unable to load shifttype.');
}
-
+
if ($shifttype == null) {
redirect(page_link_to('shifttypes'));
}
-
+
if (isset($_REQUEST['confirmed'])) {
$result = ShiftType_delete($shifttype['id']);
if ($result === false) {
engelsystem_error('Unable to delete shifttype.');
}
-
+
engelsystem_log('Deleted shifttype ' . $shifttype['name']);
success(sprintf(_('Shifttype %s deleted.'), $shifttype['name']));
redirect(page_link_to('shifttypes'));
}
-
+
return [
- sprintf(_("Delete shifttype %s"), $shifttype['name']),
- ShiftType_delete_view($shifttype)
- ];
+ sprintf(_("Delete shifttype %s"), $shifttype['name']),
+ ShiftType_delete_view($shifttype)
+ ];
}
/**
@@ -49,9 +49,9 @@ function shifttype_edit_controller()
$name = "";
$angeltype_id = null;
$description = "";
-
+
$angeltypes = AngelTypes();
-
+
if (isset($_REQUEST['shifttype_id'])) {
$shifttype = ShiftType($_REQUEST['shifttype_id']);
if ($shifttype === false) {
@@ -66,27 +66,27 @@ function shifttype_edit_controller()
$angeltype_id = $shifttype['angeltype_id'];
$description = $shifttype['description'];
}
-
+
if (isset($_REQUEST['submit'])) {
$valid = true;
-
+
if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') {
$name = strip_request_item('name');
} else {
$valid = false;
error(_('Please enter a name.'));
}
-
+
if (isset($_REQUEST['angeltype_id']) && preg_match("/^[0-9]+$/", $_REQUEST['angeltype_id'])) {
$angeltype_id = $_REQUEST['angeltype_id'];
} else {
$angeltype_id = null;
}
-
+
if (isset($_REQUEST['description'])) {
$description = strip_request_item_nl('description');
}
-
+
if ($valid) {
if ($shifttype_id) {
$result = ShiftType_update($shifttype_id, $name, $angeltype_id, $description);
@@ -106,16 +106,16 @@ function shifttype_edit_controller()
redirect(page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype_id);
}
}
-
+
return [
- shifttypes_title(),
- ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
- ];
+ shifttypes_title(),
+ ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
+ ];
}
function shifttype_controller()
{
- if (! isset($_REQUEST['shifttype_id'])) {
+ if (!isset($_REQUEST['shifttype_id'])) {
redirect(page_link_to('shifttypes'));
}
$shifttype = ShiftType($_REQUEST['shifttype_id']);
@@ -125,16 +125,16 @@ function shifttype_controller()
if ($shifttype == null) {
redirect(page_link_to('shifttypes'));
}
-
+
$angeltype = null;
if ($shifttype['angeltype_id'] != null) {
$angeltype = AngelType($shifttype['angeltype_id']);
}
-
+
return [
- $shifttype['name'],
- ShiftType_view($shifttype, $angeltype)
- ];
+ $shifttype['name'],
+ ShiftType_view($shifttype, $angeltype)
+ ];
}
/**
@@ -146,11 +146,11 @@ function shifttypes_list_controller()
if ($shifttypes === false) {
engelsystem_error("Unable to load shifttypes.");
}
-
+
return [
- shifttypes_title(),
- ShiftTypes_list_view($shifttypes)
- ];
+ shifttypes_title(),
+ ShiftTypes_list_view($shifttypes)
+ ];
}
/**
@@ -166,19 +166,19 @@ function shifttypes_title()
*/
function shifttypes_controller()
{
- if (! isset($_REQUEST['action'])) {
+ if (!isset($_REQUEST['action'])) {
$_REQUEST['action'] = 'list';
}
-
+
switch ($_REQUEST['action']) {
- default:
- case 'list':
- return shifttypes_list_controller();
- case 'view':
- return shifttype_controller();
- case 'edit':
- return shifttype_edit_controller();
- case 'delete':
- return shifttype_delete_controller();
- }
+ default:
+ case 'list':
+ return shifttypes_list_controller();
+ case 'view':
+ return shifttype_controller();
+ case 'edit':
+ return shifttype_edit_controller();
+ case 'delete':
+ return shifttype_delete_controller();
+ }
}