From 9dc5dbe3b6eacae5ea8dc335304edf7007d2ab57 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Sun, 5 Jan 2014 19:33:52 +0100 Subject: cookie-0005-API-add-getApiKey.patch --- includes/model/Shifts_model.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'includes/model/Shifts_model.php') diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 224bfc0b..df47b967 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -41,7 +41,7 @@ function mShiftList() { if (count($shifts_source) > 0) { return $shifts_source; } -return null; + return null; } /** @@ -51,10 +51,27 @@ return null; */ function mShift($id) { $shifts_source = sql_select("SELECT * FROM `Shifts` WHERE `SID`=" . sql_escape($id) . " LIMIT 1"); + $shiftsEntry_source = sql_select("SELECT `TID` , `UID` , `freeloaded` FROM `ShiftEntry` WHERE `SID`=" . sql_escape($id) ); + if ($shifts_source === false) return false; - if (count($shifts_source) > 0) - return $shifts_source[0]; + if (count($shifts_source) > 0) { + $result = $shifts_source[0]; + + $result['ShiftEntry'] = $shiftsEntry_source; + + $temp = NeededAngelTypes_by_shift($id); + foreach( $temp as $e) + { + $result['NeedAngels'][] = array ( + 'TID' => $e['angel_type_id'], + 'count' => $e['count'], + 'restricted' => $e['restricted'], + 'taken' => $e['taken'] ); + } + + return $result; + } return null; } @@ -71,7 +88,7 @@ function Shifts() { return false; foreach ($shifts_source as &$shift) { - $needed_angeltypes = NeededAngelTypes_by_shift($shift); + $needed_angeltypes = NeededAngelTypes_by_shift($shift['SID']); if ($needed_angeltypes === false) return false; -- cgit v1.2.3-54-g00ecf