diff options
author | msquare <msquare@notrademark.de> | 2016-12-28 14:49:00 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-12-28 14:49:00 +0100 |
commit | 6c4bb0da3170ca365c6ef01991e26f26dd29fb30 (patch) | |
tree | 93d2d7473a0cfa754024031b6b4acdc5a3de5f89 /includes/pages | |
parent | cbeb45ef16a62095a44f14dc7a2ff7a20b947c74 (diff) |
move data sorting to begin
Diffstat (limited to 'includes/pages')
-rw-r--r-- | includes/pages/user_shifts.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 8a3dedb4..da3c5463 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -132,8 +132,25 @@ function view_user_shifts() { $shiftsFilter = $_SESSION['ShiftsFilter']; $shifts = Shifts_by_ShiftsFilter($shiftsFilter); - $needed_angeltypes = NeededAngeltypes_by_ShiftsFilter($shiftsFilter); - $shift_entries = ShiftEntries_by_ShiftsFilter($shiftsFilter); + $needed_angeltypes_source = NeededAngeltypes_by_ShiftsFilter($shiftsFilter); + $shift_entries_source = ShiftEntries_by_ShiftsFilter($shiftsFilter); + + $needed_angeltypes = []; + $shift_entries = []; + foreach ($shifts as $shift) { + $needed_angeltypes[$shift['SID']] = []; + $shift_entries[$shift['SID']] = []; + } + foreach ($needed_angeltypes_source as $needed_angeltype) { + $needed_angeltypes[$needed_angeltype['SID']][] = $needed_angeltype; + } + foreach ($shift_entries_source as $shift_entry) { + $shift_entries[$shift_entry['SID']][] = $shift_entry; + } + unset($needed_angeltypes_source); + unset($shift_entries_source); + + $shiftCalendarRenderer = new ShiftCalendarRenderer($shifts, $needed_angeltypes, $shift_entries, $shiftsFilter); if ($user['api_key'] == "") { User_reset_api_key($user, false); @@ -154,7 +171,6 @@ function view_user_shifts() { $end_day = date("Y-m-d", $shiftsFilter->getEndTime()); $end_time = date("H:i", $shiftsFilter->getEndTime()); - $shiftCalendarRenderer = new ShiftCalendarRenderer($shifts, $needed_angeltypes, $shift_entries, $shiftsFilter); return page([ div('col-md-12', [ msg(), |