summaryrefslogblamecommitdiffstats
path: root/modules-available/exams/inc/exams.inc.php
blob: 9e5833bab4204000034169f21839197d1e39082f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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'];
    }
}