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