summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/locationinfo8
-rw-r--r--modules-available/locationinfo/inc/coursebackend.inc.php2
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php35
-rw-r--r--modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php7
4 files changed, 47 insertions, 5 deletions
diff --git a/doc/locationinfo b/doc/locationinfo
index 9994466a..e8f4ea50 100644
--- a/doc/locationinfo
+++ b/doc/locationinfo
@@ -96,6 +96,14 @@ For example (the name of the images could be overlay1.jpg, overlay1.svg):
-if calendar items don't fit, show less days or if in mode 1 give the calendar more space(calendar width);
-it is possible to use different modes if you show more then one room
+4.CourseBackend
+===============
+fetchSchedule returns an array containing an array as value and the local room ID as key.
+The contained array contains arrays that have this form ["start"=>'JJJJ-MM-DD HH:MM:SS',"end"=>'JJJJ-MM-DD HH:MM:SS',"title"=>string].
+getError returns the last errormessage.
+checkConection uses a hardcoded room for test purposes.
+If you want to write a new Class you can look at the Dummy Class to learn the structure.
+You also should write the language files for your options into the lang directory.
Panel
=====
diff --git a/modules-available/locationinfo/inc/coursebackend.inc.php b/modules-available/locationinfo/inc/coursebackend.inc.php
index 74af45ff..e14e9443 100644
--- a/modules-available/locationinfo/inc/coursebackend.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend.inc.php
@@ -128,7 +128,7 @@ abstract class CourseBackend
* @param $roomIds array with local ID as key and serverID as value
* @return array a recursive array that uses the roomID as key
* and has the schedule array as value. A shedule array contains an array in this format:
- * {"start"=>'JJJJ-MM-DD HH:MM:SS',"end"=>'JJJJ-MM-DD HH:MM:SS',"title"=>string}
+ * ["start"=>'JJJJ-MM-DD HH:MM:SS',"end"=>'JJJJ-MM-DD HH:MM:SS',"title"=>string]
*/
protected abstract function fetchSchedulesInternal($roomId);
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php
index b8aa44a0..482ca097 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php
@@ -2,6 +2,15 @@
class Coursebackend_Dummy extends CourseBackend {
private $pw;
+ /**
+ * uses json to setCredentials, the json must follow the form given in
+ * getCredentials
+ *
+ * @param array $data with the credentials
+ * @param string $url address of the server
+ * @param int $serverID ID of the server
+ * @returns bool if the credentials were in the correct format
+ */
public function setCredentials($json,$location,$serverID) {
$x = $json;
$this->pw = $x['password'];
@@ -16,6 +25,9 @@ class Coursebackend_Dummy extends CourseBackend {
}
}
+ /**
+ * @return boolean true if the connection works, false otherwise
+ */
public function checkConnection(){
if ($this->pw == "mfg") {
$this->error = false;
@@ -27,24 +39,43 @@ class Coursebackend_Dummy extends CourseBackend {
}
}
+ /**
+ * @returns array with parameter name as key and and an array with type, help text and mask as value
+ */
public function getCredentials(){
$options = ["opt1", "opt2", "opt3", "opt4", "opt5", "opt6", "opt7", "opt8"];
$credentials = ["username" => "string","password"=>"password","integer"=>"int","option"=>$options,"CheckTheBox" =>"bool","CB2 t" =>"bool"];
return $credentials;
}
+ /**
+ * @return string return display name of backend
+ */
public function getDisplayName(){
return'Dummy with array';
}
-
+ /**
+ * @return int desired caching time of results, in seconds. 0 = no caching
+ */
public function getCacheTime(){
return 0;
}
-
+ /**
+ * @return int age after which timetables are no longer refreshed should be
+ * greater then CacheTime
+ */
public function getRefreshTime(){
return 0;
}
+ /**
+ * Internal version of fetch, to be overridden by subclasses.
+ *
+ * @param $roomIds array with local ID as key and serverID as value
+ * @return array a recursive array that uses the roomID as key
+ * and has the schedule array as value. A shedule array contains an array in this format:
+ * ["start"=>'JJJJ-MM-DD HH:MM:SS',"end"=>'JJJJ-MM-DD HH:MM:SS',"title"=>string]
+ */
public function fetchSchedulesInternal($roomId){
$a = array();
foreach ($roomId as $id) {
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
index 4333f0a8..783fde13 100644
--- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
+++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php
@@ -79,8 +79,10 @@ class CourseBackend_HisInOne extends CourseBackend
$body->appendChild($findUnit);
$termYearN = $doc->createElement('termYear', $termYear);
$findUnit->appendChild($termYearN);
- $termTypeValueId = $doc->createElement('termTypeValueId', $termType);
- $findUnit->appendChild($termTypeValueId);
+ if($termType1 !=3 && $termType1 != 10){
+ $termTypeValueId = $doc->createElement('termTypeValueId', $termType);
+ $findUnit->appendChild($termTypeValueId);
+ }
$roomIdN = $doc->createElement('ns1:roomId', $roomID);
$findUnit->appendChild($roomIdN);
@@ -289,6 +291,7 @@ class CourseBackend_HisInOne extends CourseBackend
}
}
}
+ error_log(json_encode($timetable));
$tTables[$room] = $timetable;
}
return $tTables;