diff options
-rw-r--r-- | modules-available/locationinfo/api.inc.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index 421296b6..5c333271 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -20,13 +20,16 @@ function HandleParameters() { getConfig($getRoomID); } elseif ($getAction == "calendar") { $getRoomID = Request::get('id', 0, 'int'); - getCalendar($getRoomID); + echo getCalendar($getRoomID); } elseif ($getAction == "roomtree") { $roomIDS = Request::get('ids', 0, 'string'); getRoomTree($roomIDS); } elseif ($getAction == "pcstates") { $roomIDS = Request::get('ids', 0, 'string'); getPcStates($roomIDS); + } elseif ($getAction == "calendars") { + $roomIDS = Request::get('ids', 0, 'string'); + getCalendars($roomIDS); } } @@ -36,6 +39,19 @@ function getMultipleInformations($roomids) { return $filteredIdList; } +// TODO FILTER 2 weeks or some days only +function getCalendars($ids) { + $idList = getMultipleInformations($ids); + $calendars = array(); + + foreach ($idList as $id) { + $a['id'] = $id; + $a['calendar'] = json_decode(getCalendar($id), true); + $calendars[] = $a; + } + echo json_encode($calendars); +} + function getPcStates($ids) { $idList = getMultipleInformations($ids); @@ -156,9 +172,9 @@ function getCalendar($getRoomID) { $NOW = time(); if ($lastupdate == 0 || $NOW - $lastupdate > 900) { - echo updateCalendar($getRoomID, $serverid, $serverroomid); + return updateCalendar($getRoomID, $serverid, $serverroomid); } else { - echo $calendar; + return $calendar; } } |