diff options
author | Simon Rettberg | 2017-04-19 15:51:47 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-04-19 15:51:47 +0200 |
commit | 44418c209428335e611bfb9384578fb18b88978d (patch) | |
tree | 32b8a45b135472c74467acede98ae61ec501a351 /modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php | |
parent | Merge branch 'master' of dnbd3:openslx-ng/slx-admin into location-info-panel (diff) | |
download | slx-admin-44418c209428335e611bfb9384578fb18b88978d.tar.gz slx-admin-44418c209428335e611bfb9384578fb18b88978d.tar.xz slx-admin-44418c209428335e611bfb9384578fb18b88978d.zip |
[locationinfo] CourseBackends: Lots of bug fixes, missing error checks, improvements:
- Add more checks for returned data structures from backend, like keys in arrays
- Better error messages if something goes wrong, not just "server sent wrong xml"
- Make checkConnection() of davinci and hisinone not require a valid room id, which
we don't have in general
- hisinone: Parse data structure just once for every room
- Request coalescing: Only try so if getRefreshTime() > getCacheTime()
- Move toArray() to base class instead of having two copies
- Sanitize variable naming conventions
Diffstat (limited to 'modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php')
-rw-r--r-- | modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php index 484a5286..5bceac3e 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_dummy.inc.php @@ -1,6 +1,6 @@ <?php -class Coursebackend_Dummy extends CourseBackend +class CourseBackend_Dummy extends CourseBackend { private $pw; @@ -10,10 +10,10 @@ class Coursebackend_Dummy extends CourseBackend * * @param array $data with the credentials * @param string $url address of the server - * @param int $serverID ID 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) + public function setCredentials($json, $location, $serverId) { $x = $json; $this->pw = $x['password']; @@ -22,8 +22,7 @@ class Coursebackend_Dummy extends CourseBackend $this->error = false; return true; } else { - $this->errormsg = "USE mfg as password!"; - $this->error = true; + $this->error = "USE mfg as password!"; return false; } } @@ -37,8 +36,7 @@ class Coursebackend_Dummy extends CourseBackend $this->error = false; return true; } else { - $this->errormsg = "USE mfg as password!"; - $this->error = true; + $this->error = "USE mfg as password!"; return false; } } @@ -88,7 +86,7 @@ class Coursebackend_Dummy extends CourseBackend /** * Internal version of fetch, to be overridden by subclasses. * - * @param $roomIds array with local ID as key and serverID as value + * @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] |