ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
storeScorm2004.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
22
23//conditions for storing data
24global $DIC;
25$ilDB = $DIC->database();
26
27$packageId = $DIC->http()->wrapper()->query()->retrieve('package_id', $DIC->refinery()->kindlyTo()->int());
28$refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
29$doUnload = false;
30if ($DIC->http()->wrapper()->query()->has('do')) {
31 if ($DIC->http()->wrapper()->query()->retrieve('do', $DIC->refinery()->kindlyTo()->string()) == "unload") {
32 $doUnload = true;
33 }
34}
35
37$comments = true;
41
42$lm_set = $ilDB->queryF(
43 'SELECT default_lesson_mode, interactions, objectives, time_from_lms, comments FROM sahs_lm WHERE id = %s',
44 array('integer'),
45 array($packageId)
46);
47while ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
48 $defaultLessonMode = ($lm_rec["default_lesson_mode"]);
49 $interactions = ilUtil::yn2tf($lm_rec["interactions"]);
50 $objectives = ilUtil::yn2tf($lm_rec["objectives"]);
51 $time_from_lms = ilUtil::yn2tf($lm_rec["time_from_lms"]);
52 $comments = ilUtil::yn2tf($lm_rec["comments"]);
53}
54
55if ($doUnload) {
57} else {
58// $data = file_get_contents('php://input');
60}
const CONTEXT_SCORM
static init(string $a_type)
Init context by type.
static initILIAS()
ilias initialisation
static persistCMIData(int $packageId, int $refId, string $defaultLessonMode, bool $comments, bool $interactions, bool $objectives, bool $time_from_lms, ?string $data=null, ?int $userId=null)
static scormPlayerUnload(int $packageId, int $refId, bool $time_from_lms, ?int $userId=null)
static yn2tf(string $a_yn)
$interactions
$time_from_lms
$comments
$packageId
global $DIC
$doUnload
$lm_set
$refId
$objectives
if($DIC->http() ->wrapper() ->query() ->has('do')) $defaultLessonMode