From 1fe7c76c21d24184706775d18cd34c379f8f863d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 6 Sep 2016 15:50:08 +0200 Subject: [exams] Implement autostart checkbox --- modules-available/exams/inc/exams.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules-available/exams/inc') diff --git a/modules-available/exams/inc/exams.inc.php b/modules-available/exams/inc/exams.inc.php index 5fc497c7..dfc38273 100644 --- a/modules-available/exams/inc/exams.inc.php +++ b/modules-available/exams/inc/exams.inc.php @@ -7,17 +7,18 @@ 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, &$lectureId) + public static function isInExamMode($locationIds, &$lectureId = false, &$autoLogin = false) { if (!is_array($locationIds)) { $locationIds = array($locationIds); } $l = str_repeat(',?', count($locationIds)); - $res = Database::queryFirst("SELECT lectureid FROM exams" + $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); if ($res !== false) { $lectureId = $res['lectureid']; + $autoLogin = $res['autologin']; } return $res !== false; } -- cgit v1.2.3-55-g7522