summaryrefslogtreecommitdiffstats
path: root/modules-available/exams/inc/exams.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/exams/inc/exams.inc.php')
-rw-r--r--modules-available/exams/inc/exams.inc.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules-available/exams/inc/exams.inc.php b/modules-available/exams/inc/exams.inc.php
new file mode 100644
index 00000000..9e5833ba
--- /dev/null
+++ b/modules-available/exams/inc/exams.inc.php
@@ -0,0 +1,17 @@
+<?php
+
+class Exams {
+
+
+ /**
+ * @param: array of location ids
+ * @return: true iff for any of the given location ids an exam is scheduled
+ **/
+ public static function isInExamMode($locationIds) {
+ // TODO: Better use prepared statement
+ $l = '(' . implode(', ', $locationIds) . ')';
+ $res = Database::queryFirst("SELECT (COUNT(examid) > 0) as examMode FROM exams WHERE starttime < NOW() AND endtime > NOW() AND locationid IN $l", []);
+
+ return $res['examMode'];
+ }
+}