summaryrefslogtreecommitdiffstats
path: root/modules-available/exams/install.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-23 17:03:29 +0200
committerSimon Rettberg2016-06-23 17:03:29 +0200
commitaefcaf9c027febdbd9a51869744d7a6a978b4413 (patch)
treed015179fee59eb0ef91ec344dc1604ce219c02f8 /modules-available/exams/install.inc.php
parent[baseconfig] Take dependencies into account when handling API hooks (diff)
downloadslx-admin-aefcaf9c027febdbd9a51869744d7a6a978b4413.tar.gz
slx-admin-aefcaf9c027febdbd9a51869744d7a6a978b4413.tar.xz
slx-admin-aefcaf9c027febdbd9a51869744d7a6a978b4413.zip
[exams] Fix vis.js when an exam is active in more than one location (id collision), complete install hook (missing table), limit max. zoom level for vis.js
Diffstat (limited to 'modules-available/exams/install.inc.php')
-rw-r--r--modules-available/exams/install.inc.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/modules-available/exams/install.inc.php b/modules-available/exams/install.inc.php
index b61a0af2..aa8c9a0d 100644
--- a/modules-available/exams/install.inc.php
+++ b/modules-available/exams/install.inc.php
@@ -3,13 +3,26 @@
$res = array();
$res[] = tableCreate('exams', '
- `examid` int(11) NOT NULL AUTO_INCREMENT,
- `starttime` int(11) NOT NULL,
- `endtime` int(11) NOT NULL,
- `description` varchar(100) DEFAULT NULL,
- PRIMARY KEY (`examid`)
- ');
+ `examid` int(11) NOT NULL AUTO_INCREMENT,
+ `starttime` int(11) NOT NULL,
+ `endtime` int(11) NOT NULL,
+ `description` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`examid`)
+ ');
+$res[] = tableCreate('exams_x_location', '
+ `examid` int(11) NOT NULL,
+ `locationid` int(11) NOT NULL,
+ PRIMARY KEY (`examid`, `locationid`)
+');
+
+if (Database::exec("ALTER TABLE exams ADD INDEX `idx_daterange` ( `starttime` , `endtime` )") === false) {
+ if (!preg_match('/\b1061\b/', Database::lastError())) {
+ finalResponse(UPDATE_FAILED, 'Could not add startdate/enddate index: ' . Database::lastError());
+ }
+} else {
+ $res[] = UPDATE_DONE;
+}
if (in_array(UPDATE_DONE, $res)) {
finalResponse(UPDATE_DONE, 'Tables created successfully');