diff options
author | Simon Rettberg | 2016-07-12 16:55:50 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-12 16:55:50 +0200 |
commit | 78dfda5da73f5a97d108703e34b70b2ca957fe7a (patch) | |
tree | cf93e432639ec685db3be4961691fbfa1ee8007a /modules-available/dozmod | |
parent | Update example config (diff) | |
download | slx-admin-78dfda5da73f5a97d108703e34b70b2ca957fe7a.tar.gz slx-admin-78dfda5da73f5a97d108703e34b70b2ca957fe7a.tar.xz slx-admin-78dfda5da73f5a97d108703e34b70b2ca957fe7a.zip |
[dozmod] Minor api cleanup
Diffstat (limited to 'modules-available/dozmod')
-rw-r--r-- | modules-available/dozmod/api.inc.php | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php index 1adcc429..17ead3c1 100644 --- a/modules-available/dozmod/api.inc.php +++ b/modules-available/dozmod/api.inc.php @@ -28,7 +28,7 @@ function cache_hash($obj) function cache_key_to_filename($key) { - return "/tmp/bwlp-slxadmin-cache-$key"; // TODO: hash + return "/tmp/bwlp-slxadmin-cache-$key"; } function cache_put($key, $value) @@ -52,7 +52,6 @@ function cache_has($key) } } - function cache_get($key) { $filename = cache_key_to_filename($key); @@ -82,18 +81,6 @@ function cache_get_passthru($key) /** - * Get list of active lectures for given locations. - * - * @return string the raw xml data. - */ -function _getLecturesForLocations($locationIds, $examMode) -{ - $ids = implode('%20', $locationIds); - $url = LIST_URL . "?locations=$ids" . ($examMode ? '&exams' : ''); - return Download::asString($url, 60, $code); -} - -/** * Takes raw lecture list xml, returns array of uuids. * * @param string $responseXML XML from dozmod server @@ -135,7 +122,11 @@ function getListForLocations($locationIds, $raw) return unserialize(cache_get($key)); } // Not in cache - $value = _getLecturesForLocations($locationIds, $examMode); + $url = LIST_URL . "?locations=" . implode('%20', $locationIds); + if ($examMode) { + $url .= '&exams'; + } + $value = Download::asString($url, 60, $code); if ($value === false) return false; cache_put($rawKey, $value); |