diff options
author | Dirk Riestere | 2016-12-14 18:38:40 +0100 |
---|---|---|
committer | Dirk Riestere | 2016-12-14 18:38:40 +0100 |
commit | 90bffc4950a12708c592f0139361c2a833f0e0e3 (patch) | |
tree | abf0adb36d2ec11016c47c19631734e8535ae0e4 /modules-available/locationinfo/api.inc.php | |
parent | Funktion um json von HisInOne abzufragen, es wird aber noch keine neue Datei ... (diff) | |
download | slx-admin-90bffc4950a12708c592f0139361c2a833f0e0e3.tar.gz slx-admin-90bffc4950a12708c592f0139361c2a833f0e0e3.tar.xz slx-admin-90bffc4950a12708c592f0139361c2a833f0e0e3.zip |
Die funktion ist jetzt in der api und gibt ein leeres json zurück falls servertype nicht Hisinone ist
Diffstat (limited to 'modules-available/locationinfo/api.inc.php')
-rw-r--r-- | modules-available/locationinfo/api.inc.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php index d156f7ab..106f6498 100644 --- a/modules-available/locationinfo/api.inc.php +++ b/modules-available/locationinfo/api.inc.php @@ -230,3 +230,31 @@ function getPcInfos($locationID, $coords) { return $str; } +function fetchNewTimeTable($locationID){ + //Get room information + $dbquery1 = Database::simpleQuery("SELECT serverid, serverroomid FROM location_info WHERE locationid = :id", array('id' => $locationID)); + $dbd1=$dbquery1->fetch(PDO::FETCH_ASSOC); + $serverID = $dbd1['serverid']; + $roomID = $dbd1['serverroomid']; + //Get login data for the server + $dbquery2 = Database::simpleQuery("SELECT serverurl, servertype, login, passwd FROM `setting_location_info` WHERE serverid = :id", array('id' => $serverID)); + $dbd2=$dbquery2->fetch(PDO::FETCH_ASSOC); + $url = $dbd2['serverurl']; + $type = $dbd2['servetype']; + $lname = $dbd2['login']; + $passwd = $dbd2['passwd']; + //Return json with dates + if($type == 'HISinOne'){ + $array = file_get_contents($url . $roomID . '.json'); + $ttable = json_decode($array); + $results = count($ttable); + for ($r = 0; $r < $results; $r++){ + unset($ttable[$r]->allDay); + } + + } + else{ + $ttable = "{}"; + } + return json_encode($ttable); + } |