diff options
author | Christian Klinger | 2016-06-10 17:19:50 +0200 |
---|---|---|
committer | Christian Klinger | 2016-06-10 17:19:50 +0200 |
commit | cab4355fec9928639e688d096d9ad5e77cb28493 (patch) | |
tree | 79aa7dc308c4c877bef87f89cf2b88fbe917ef74 /modules-available/exams/inc | |
parent | use Module:: instead of require (diff) | |
download | slx-admin-cab4355fec9928639e688d096d9ad5e77cb28493.tar.gz slx-admin-cab4355fec9928639e688d096d9ad5e77cb28493.tar.xz slx-admin-cab4355fec9928639e688d096d9ad5e77cb28493.zip |
first rough version of exams-module.
Diffstat (limited to 'modules-available/exams/inc')
-rw-r--r-- | modules-available/exams/inc/exams.inc.php | 17 |
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']; + } +} |