forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storeScorm.php
28 lines (24 loc) · 1001 Bytes
/
storeScorm.php
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
<?php
declare(strict_types=1);
ilContext::init(ilContext::CONTEXT_SCORM);
ilInitialisation::initILIAS();
global $DIC;
$packageId = $DIC->http()->wrapper()->query()->retrieve('package_id', $DIC->refinery()->kindlyTo()->int());
$doUnload = false;
if ($DIC->http()->wrapper()->query()->has('do')) {
if ($DIC->http()->wrapper()->query()->retrieve('do', $DIC->refinery()->kindlyTo()->string()) == "unload") {
$doUnload = true;
}
}
if ($doUnload) {
$p = $DIC->http()->wrapper()->query()->retrieve('p', $DIC->refinery()->kindlyTo()->int());
$hash = $DIC->http()->wrapper()->query()->retrieve('hash', $DIC->refinery()->kindlyTo()->int());
ilObjSCORMTracking::checkIfAllowed($packageId, $p, $hash);
ilObjSCORMTracking::scorm12PlayerUnload();
} else {
global $ilUser;
$data = file_get_contents('php://input');
$ilUser->setId($data->p);
ilObjSCORMTracking::checkIfAllowed($packageId, (int) $data->p, (int) $data->hash);
ilObjSCORMTracking::storeJsApi();
}