From 71d3d4efb61d9171b5a5ec1120c1aa3cdd572366 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 28 Jul 2016 17:30:44 +0200 Subject: [exams] Add autostart lecture feature --- modules-available/exams/inc/exams.inc.php | 7 +++++-- 1 file changed, 5 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 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; } -- cgit v1.2.3-55-g7522