diff options
author | Simon Rettberg | 2016-07-28 17:30:44 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-07-28 17:30:44 +0200 |
commit | 71d3d4efb61d9171b5a5ec1120c1aa3cdd572366 (patch) | |
tree | 711a31835830739c72bede0605d93d5df76fb8af /modules-available/exams/inc/exams.inc.php | |
parent | [dozmod] API: Implement netrules and runscript fetching for lectures (diff) | |
download | slx-admin-71d3d4efb61d9171b5a5ec1120c1aa3cdd572366.tar.gz slx-admin-71d3d4efb61d9171b5a5ec1120c1aa3cdd572366.tar.xz slx-admin-71d3d4efb61d9171b5a5ec1120c1aa3cdd572366.zip |
[exams] Add autostart lecture feature
Diffstat (limited to 'modules-available/exams/inc/exams.inc.php')
-rw-r--r-- | modules-available/exams/inc/exams.inc.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules-available/exams/inc/exams.inc.php b/modules-available/exams/inc/exams.inc.php index f781fc1e..e95a9392 100644 --- a/modules-available/exams/inc/exams.inc.php +++ b/modules-available/exams/inc/exams.inc.php @@ -7,7 +7,7 @@ class Exams * @param int[] of location ids. must bot be an associative array. * @return: bool true iff for any of the given location ids an exam is scheduled. **/ - public static function isInExamMode($locationIds) + public static function isInExamMode($locationIds, &$lectureId) { if (!is_array($locationIds)) { $locationIds = array($locationIds); @@ -15,9 +15,12 @@ class Exams return false; } $l = str_repeat(',?', count($locationIds)); - $res = Database::queryFirst("SELECT examid FROM exams" + $res = Database::queryFirst("SELECT lectureid FROM exams" . " INNER JOIN exams_x_location USING (examid)" . " WHERE UNIX_TIMESTAMP() BETWEEN starttime AND endtime AND locationid IN (0$l) LIMIT 1", $locationIds); + if ($res !== false) { + $lectureId = $res['lectureid']; + } return $res !== false; } |