diff options
author | Dirk Riestere | 2017-03-01 19:28:18 +0100 |
---|---|---|
committer | Dirk Riestere | 2017-03-01 19:28:18 +0100 |
commit | a2545dfaa398f2825a43853227bbdeed913bf192 (patch) | |
tree | f764770a1f358129c866d0b024074bc06e6c6e0b /modules-available | |
parent | API: Fixed Calendar function. (diff) | |
download | slx-admin-a2545dfaa398f2825a43853227bbdeed913bf192.tar.gz slx-admin-a2545dfaa398f2825a43853227bbdeed913bf192.tar.xz slx-admin-a2545dfaa398f2825a43853227bbdeed913bf192.zip |
Bugfixes und checkConection implementiert
Diffstat (limited to 'modules-available')
3 files changed, 30 insertions, 11 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend.inc.php b/modules-available/locationinfo/inc/coursebackend.inc.php index 675fd575..a3e7bf96 100644 --- a/modules-available/locationinfo/inc/coursebackend.inc.php +++ b/modules-available/locationinfo/inc/coursebackend.inc.php @@ -87,6 +87,11 @@ abstract class CourseBackend public abstract function getCredentials(); /** + * @return boolean true if the connection works, false otherwise + */ + public abstract function checkConection(); + + /** * uses json to setCredentials, the json must follow the form given in * getCredentials * @param json $json jsonarray with the credentials diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php index 2801070a..6e07e1f4 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_davinci.inc.php @@ -14,6 +14,11 @@ class Coursebackend_Davinci extends CourseBackend { $this->serverID = $serverID; //Davinci doesn't have credentials } + + public function checkConection(){ + $this->fetchSchedulesInternal(42); + return $this->error; + } public function getCredentials(){ $return = array(); return $return; diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php index 519d85b7..46fc0af8 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php @@ -16,6 +16,11 @@ class CourseBackend_HisInOne extends CourseBackend $this->location = $location."/qisserver/services2/CourseService"; $this->serverID = $serverID; } + + public function checkConection(){ + $this->findUnit(42); + return $this->error; + } //Cache the timetables for 30 minutes ttables older than 60 are not refreshed public function getCacheTime(){ @@ -120,6 +125,9 @@ class CourseBackend_HisInOne extends CourseBackend $this->errormsg =$respons2['soapenvBody']['soapenvFault']['faultcode']." ".$respons2['soapenvBody']['soapenvFault']['faultstring']; return; } + else{ + $this->error = false; + } $id = $respons2['soapenvBody']['hisfindUnitResponse']['hisunitIds']['hisid']; return $id; } @@ -154,6 +162,9 @@ class CourseBackend_HisInOne extends CourseBackend $this->errormsg =$respons2['soapenvBody']['soapenvFault']['faultcode']." ".$respons2['soapenvBody']['soapenvFault']['faultstring']; return; } + else{ + $this->error = false; + } $respons3 = $respons2['soapenvBody']['hisreadUnitResponse']; return $respons3; } @@ -313,8 +324,7 @@ class CourseBackend_HisInOne extends CourseBackend foreach($dates as $date){ $roomID = $date['hisroomId']; $datum = $date['hisexecutiondate']; - if(intval($roomID) == $param && in_array($datum,$currentWeek)){ - + if(intval($roomID) == $room && in_array($datum,$currentWeek)){ $startTime = $date['hisstarttime']; $endTime = $date['hisendtime']; $json = array( @@ -332,7 +342,7 @@ class CourseBackend_HisInOne extends CourseBackend foreach($dates as $date){ $roomID = $date['hisroomId']; $datum = $date['hisexecutiondate']; - if(intval($roomID) == $param && in_array($datum,$currentWeek)){ + if(intval($roomID) == $room && in_array($datum,$currentWeek)){ $startTime = $date['hisstarttime']; $endTime = $date['hisendtime']; @@ -367,11 +377,10 @@ class CourseBackend_HisInOne extends CourseBackend } -/* - * $client = new CourseBackend_HisInOne(); - * $login = ['username'=> '','password'=>'','role'=>'']; -$login = json_encode($login); -$client->setCredentials($login,"https://histestwebserver.vm.uni-freiburg.de",3); -$test=$client->fetchSchedulesInternal([42=>42]); -echo htmlentities($test[42]); -*/
\ No newline at end of file + +//$client = new CourseBackend_HisInOne(); +//$login = ['username'=> '','password'=>'','role'=>'']; +//$login = json_encode($login); +//$client->setCredentials($login,"https://histestwebserver.vm.uni-freiburg.de",3); +//$test=$client->fetchSchedulesInternal([42=>42]); +//echo htmlentities($test[42]); |