diff options
author | Simon Rettberg | 2019-07-04 13:49:38 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-07-04 13:49:56 +0200 |
commit | ee9ecd4db51299ff1f28488ee77d0eded4ae700d (patch) | |
tree | c1ccac423e00c253390e495a8aa874770a7805a2 | |
parent | [baseconfig_bwlp] Update help text for SLX_ADDONS (diff) | |
download | slx-admin-ee9ecd4db51299ff1f28488ee77d0eded4ae700d.tar.gz slx-admin-ee9ecd4db51299ff1f28488ee77d0eded4ae700d.tar.xz slx-admin-ee9ecd4db51299ff1f28488ee77d0eded4ae700d.zip |
[exams] Fix isExamMode() for global exams
-rw-r--r-- | modules-available/exams/inc/exams.inc.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/modules-available/exams/inc/exams.inc.php b/modules-available/exams/inc/exams.inc.php index dfc38273..da4dec85 100644 --- a/modules-available/exams/inc/exams.inc.php +++ b/modules-available/exams/inc/exams.inc.php @@ -12,10 +12,14 @@ class Exams if (!is_array($locationIds)) { $locationIds = array($locationIds); } - $l = str_repeat(',?', count($locationIds)); + if (empty($locationIds)) { + $locationIds[] = 0; + } $res = Database::queryFirst("SELECT lectureid, autologin FROM exams" . " INNER JOIN exams_x_location USING (examid)" - . " WHERE UNIX_TIMESTAMP() BETWEEN starttime AND endtime AND locationid IN (0$l) LIMIT 1", $locationIds); + . " WHERE UNIX_TIMESTAMP() BETWEEN starttime AND endtime AND (locationid IN (:lids) OR locationid IS NULL) LIMIT 1", [ + 'lids' => array_values($locationIds), + ]); if ($res !== false) { $lectureId = $res['lectureid']; $autoLogin = $res['autologin']; |