From f42183951baa8b147c4861b3e1c9649f07d004dc Mon Sep 17 00:00:00 2001 From: Dirk Riestere Date: Sat, 11 Feb 2017 05:18:52 +0100 Subject: Letzte Version war leider nicht vollständig was zu Fehlern führt --- modules-available/locationinfo/HisInOneAPI.php | 32 +++++++++++++++------- .../locationinfo/timetablerequest.php | 4 +-- 2 files changed, 24 insertions(+), 12 deletions(-) (limited to 'modules-available') diff --git a/modules-available/locationinfo/HisInOneAPI.php b/modules-available/locationinfo/HisInOneAPI.php index 6593db4b..756b7d2b 100644 --- a/modules-available/locationinfo/HisInOneAPI.php +++ b/modules-available/locationinfo/HisInOneAPI.php @@ -2,7 +2,7 @@ interface iTimetableRequest { public function getJson($param); - public function getJsonsl($param); + public function getJsons($param); } class HisInOneSoapClient implements iTimetableRequest @@ -146,6 +146,14 @@ class HisInOneSoapClient implements iTimetableRequest } return json_encode($timetable); } + + public function toArray($response){ + $response = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $response); + $xml = new SimpleXMLElement($response); + $array = json_decode(json_encode((array)$xml), TRUE); + return $array; + } + //Request for a timetable with roomids as array public function getJsons($param){ //get all eventIDs in a given room @@ -193,19 +201,23 @@ class HisInOneSoapClient implements iTimetableRequest } function getCurrentWeekDates() { - $startdate = date('Y-m-d'); - $enddate = date('+1 week'); - - $DateArray = array(); - $timestamp = strtotime($startdate); - while ($startdate <= $enddate) { - $startdate = date('Y-m-d', $timestamp); - $DateArray[] = $startdate; - $timestamp = strtotime('+1 days', strtotime($startdate)); + $startdate = strtotime('Now'); + for($i=0 ;$i<=7; $i++) { + $DateArray[] = date('Y-m-d', strtotime("+ {$i} day", $startdate)); + } return $DateArray; } } + + +$params = array("planelementId"=>42); + try { + + } + catch (Exception $ex) { + var_dump($ex); + } ?> diff --git a/modules-available/locationinfo/timetablerequest.php b/modules-available/locationinfo/timetablerequest.php index fb759904..bb65aad9 100644 --- a/modules-available/locationinfo/timetablerequest.php +++ b/modules-available/locationinfo/timetablerequest.php @@ -1,5 +1,5 @@ $locationID)); @@ -35,7 +35,7 @@ function fetchNewTimeTable($locationID){ function HisInOneRequest($url,$roomID,$lname,$passwd){ $url = $url."/qisserver/services2/CourseService"; $client = new HisInOneSoapClient($url, $lname, $passwd); - return $client->giveBackJson($roomID); + return $client->getJson($roomID); } \ No newline at end of file -- cgit v1.2.3-55-g7522