diff options
author | Jannik Schönartz | 2017-02-06 00:36:49 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-02-06 00:36:49 +0100 |
commit | 433a089fc113cba0d9662cb0d3634501f5f5eb28 (patch) | |
tree | 2296e34b07e17a381e1b37a9d3aeb52f8a67cfbe /modules-available | |
parent | frontend: more stuff on panel (diff) | |
download | slx-admin-433a089fc113cba0d9662cb0d3634501f5f5eb28.tar.gz slx-admin-433a089fc113cba0d9662cb0d3634501f5f5eb28.tar.xz slx-admin-433a089fc113cba0d9662cb0d3634501f5f5eb28.zip |
API added method for getting calendar info (unfiltered for now) with multiple id support
Diffstat (limited to 'modules-available')
-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; } } |