summaryrefslogtreecommitdiffstats
path: root/modules-available/exams/baseconfig/getconfig.inc.php
blob: 120bdbffc05ff91585d9391d7bdc7fcbe81f241b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php

$foofoo = function($machineUuid) {
	// Leave clients in any runmode alone
	$res = Database::queryFirst('SELECT machineuuid FROM runmode WHERE machineuuid = :uuid',
		array('uuid' => $machineUuid), true);
	if (is_array($res))
		return;
	// Check if exam mode should apply
	$locations = ConfigHolder::get('SLX_LOCATIONS');
	if ($locations === false) {
		$locationIds = [];
	} else {
		$locationIds = explode(' ', $locations);
	}
	if (Exams::isInExamMode($locationIds, $lectureId, $autoLogin)) {
		ConfigHolder::add('SLX_EXAM', 'yes', 10000);
		if (strlen($lectureId) > 0) {
			ConfigHolder::add('SLX_EXAM_START', $lectureId, 10000);
		}
		if (strlen($autoLogin) > 0) {
			ConfigHolder::add('SLX_AUTOLOGIN', $autoLogin, 10000);
		}
		ConfigHolder::add('SLX_SYSTEMD_TARGET', 'exam-mode', 10000);
		ConfigHolder::add('SLX_RUNMODE_MODULE', 'exams', 10000);
		// No saver
		ConfigHolder::add('SLX_SCREEN_SAVER_TIMEOUT', '0', 1000);
	}
};

$foofoo($uuid);