diff options
author | Bot <bot@myigel.name> | 2017-01-02 15:43:36 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-01-02 15:49:53 +0100 |
commit | d71e7bbfad2f07f82df0c515608996d250fd4182 (patch) | |
tree | 5083a17b218c08b3a699a0bf15bec926cc2dd185 /includes/controller/rooms_controller.php | |
parent | 7313e15ce8236e19331fb6639a3a5b97c8f06ecd (diff) |
Formatting
Diffstat (limited to 'includes/controller/rooms_controller.php')
-rw-r--r-- | includes/controller/rooms_controller.php | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/includes/controller/rooms_controller.php b/includes/controller/rooms_controller.php index 2e45dead..d19e91bb 100644 --- a/includes/controller/rooms_controller.php +++ b/includes/controller/rooms_controller.php @@ -1,7 +1,6 @@ <?php -use Engelsystem\ShiftsFilterRenderer; use Engelsystem\ShiftsFilter; -use Engelsystem\ShiftCalendarRenderer; +use Engelsystem\ShiftsFilterRenderer; /** * Room controllers for managing everything room related. @@ -13,26 +12,28 @@ use Engelsystem\ShiftCalendarRenderer; function room_controller() { global $privileges; - - if (! in_array('view_rooms', $privileges)) { + + if (!in_array('view_rooms', $privileges)) { redirect(page_link_to()); } - + $room = load_room(); $all_shifts = Shifts_by_room($room); $days = []; foreach ($all_shifts as $shift) { $day = date("Y-m-d", $shift['start']); - if (! in_array($day, $days)) { + if (!in_array($day, $days)) { $days[] = $day; } } - - $shiftsFilter = new ShiftsFilter(true, [ - $room['RID'] - ], AngelType_ids()); + + $shiftsFilter = new ShiftsFilter( + true, + [$room['RID']], + AngelType_ids() + ); $selected_day = date("Y-m-d"); - if (! empty($days)) { + if (!empty($days)) { $selected_day = $days[0]; } if (isset($_REQUEST['shifts_filter_day'])) { @@ -40,16 +41,16 @@ function room_controller() } $shiftsFilter->setStartTime(parse_date("Y-m-d H:i", $selected_day . ' 00:00')); $shiftsFilter->setEndTime(parse_date("Y-m-d H:i", $selected_day . ' 23:59')); - + $shiftsFilterRenderer = new ShiftsFilterRenderer($shiftsFilter); $shiftsFilterRenderer->enableDaySelection($days); - + $shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter); - + return [ - $room['Name'], - Room_view($room, $shiftsFilterRenderer, $shiftCalendarRenderer) - ]; + $room['Name'], + Room_view($room, $shiftsFilterRenderer, $shiftCalendarRenderer) + ]; } /** @@ -57,17 +58,17 @@ function room_controller() */ function rooms_controller() { - if (! isset($_REQUEST['action'])) { + if (!isset($_REQUEST['action'])) { $_REQUEST['action'] = 'list'; } - + switch ($_REQUEST['action']) { - default: - case 'list': - redirect(page_link_to('admin_rooms')); - case 'view': - return room_controller(); - } + default: + case 'list': + redirect(page_link_to('admin_rooms')); + case 'view': + return room_controller(); + } } function room_link($room) @@ -85,14 +86,14 @@ function room_edit_link($room) */ function load_room() { - if (! test_request_int('room_id')) { + if (!test_request_int('room_id')) { redirect(page_link_to()); } - + $room = Room($_REQUEST['room_id']); if ($room == null) { redirect(page_link_to()); } - + return $room; } |