summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
diff options
context:
space:
mode:
authorDirk Riestere2017-03-02 23:32:22 +0100
committerDirk Riestere2017-03-02 23:32:22 +0100
commit2ca95f58b77ee34743dcc1a84335a5ef53730db2 (patch)
tree22ce474b10977d971f963e186b2ec5bc745f11e4 /modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
parentMerge branch 'location-info-panel' of git.openslx.org:openslx-ng/slx-admin in... (diff)
downloadslx-admin-2ca95f58b77ee34743dcc1a84335a5ef53730db2.tar.gz
slx-admin-2ca95f58b77ee34743dcc1a84335a5ef53730db2.tar.xz
slx-admin-2ca95f58b77ee34743dcc1a84335a5ef53730db2.zip
Bugfixes und Code verschönert
Diffstat (limited to 'modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php')
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php38
1 files changed, 22 insertions, 16 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
index 157a5bf6..b223a69b 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
@@ -6,7 +6,6 @@ class CourseBackend_HisInOne extends CourseBackend
private $password;
private $location;
private $open;
- public $serverID;
//Sets the location and the login information of this client
public function setCredentials($json,$location,$serverID) {
@@ -24,7 +23,7 @@ class CourseBackend_HisInOne extends CourseBackend
$this->serverID = $serverID;
}
- public function checkConection(){
+ public function checkConnection(){
$this->findUnit(42);
return $this->error;
}
@@ -71,7 +70,7 @@ class CourseBackend_HisInOne extends CourseBackend
public function findUnit($roomID){
$termyear = date('Y');
$termtype = date('n');
- if($termtype > 3 && termtype < 10){
+ if($termtype > 3 && $termtype < 10){
$termtype = 2;
}
elseif ($termtype > 10) {
@@ -114,13 +113,14 @@ class CourseBackend_HisInOne extends CourseBackend
if(isset($respons2['soapenvBody']['soapenvFault'])){
$this->error = true;
$this->errormsg =$respons2['soapenvBody']['soapenvFault']['faultcode']." ".$respons2['soapenvBody']['soapenvFault']['faultstring'];
- return;
+ return false;
}
else{
$this->error = false;
}
if($this->open){
$units = $respons2['soapenvBody']['hisfindUnitResponse']['hisunits']['hisunit'];
+ $id = [];
foreach ($units as $unit) {
$id[]= $unit['hisid'];
}
@@ -163,7 +163,7 @@ class CourseBackend_HisInOne extends CourseBackend
if(isset($respons2['soapenvBody']['soapenvFault'])){
$this->error = true;
$this->errormsg =$respons2['soapenvBody']['soapenvFault']['faultcode']." ".$respons2['soapenvBody']['soapenvFault']['faultstring'];
- return;
+ return false;
}
else{
$this->error = false;
@@ -211,15 +211,20 @@ class CourseBackend_HisInOne extends CourseBackend
curl_close($soap_do);
return $output;
}
-
- //Request for a timetable with roomid as int
- public function getJson($param){
+
+ /**
+ * Request for a timetable
+ * @param $param int the roomid
+ * @return string the timetable as json
+ */
+ public function getJson($param){
//get all eventIDs in a given room
$eventIDs = $this-> findUnit($param);
if($this->error == true){
return $this->errormsg;
}
//get all information on each event
+ $events = [];
foreach ($eventIDs as $each_event) {
$events[] = $this->readUnit((int) $each_event);
if($this->error == true){
@@ -294,17 +299,18 @@ class CourseBackend_HisInOne extends CourseBackend
//Request for a timetable with roomids as array
public function fetchSchedulesInternal($param){
//get all eventIDs in a given room
+ $eventIDs = [];
foreach ($param as $ID) {
- $eventIDs = $this-> findUnit($ID);
- if($this->error == true){
- return $this->errormsg;
- }
- }
- $eventIDs = array_unique($eventIDs);
-
+ $eventIDs = array_merge($eventIDs, $this->findUnit($ID));
+ var_dump($eventIDs);
+ $eventIDs = array_unique($eventIDs);
+ if ($this->error == true) {
+ return $this->errormsg;
+ }
+ }
//get all information on each event
foreach ($eventIDs as $each_event) {
- $events[] = $this->readUnit((int) $each_event);
+ $events[] = $this->readUnit(intval($each_event));
if($this->error == true){
return $this->errormsg;
}