ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
storeScorm2004.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
20 require_once("Services/Init/classes/class.ilInitialisation.php");
23 
24 //conditions for storing data
25 global $DIC;
26 $ilDB = $DIC->database();
27 
28 $packageId = $DIC->http()->wrapper()->query()->retrieve('package_id', $DIC->refinery()->kindlyTo()->int());
29 $refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
30 $doUnload = false;
31 if ($DIC->http()->wrapper()->query()->has('do')) {
32  if ($DIC->http()->wrapper()->query()->retrieve('do', $DIC->refinery()->kindlyTo()->string()) == "unload") {
33  $doUnload = true;
34  }
35 }
36 
37 $defaultLessonMode = "normal";
38 $comments = true;
40 $objectives = true;
42 
43 $lm_set = $ilDB->queryF(
44  'SELECT default_lesson_mode, interactions, objectives, time_from_lms, comments FROM sahs_lm WHERE id = %s',
45  array('integer'),
46  array($packageId)
47 );
48 while ($lm_rec = $ilDB->fetchAssoc($lm_set)) {
49  $defaultLessonMode = ($lm_rec["default_lesson_mode"]);
50  $interactions = ilUtil::yn2tf($lm_rec["interactions"]);
51  $objectives = ilUtil::yn2tf($lm_rec["objectives"]);
52  $time_from_lms = ilUtil::yn2tf($lm_rec["time_from_lms"]);
53  $comments = ilUtil::yn2tf($lm_rec["comments"]);
54 }
55 
56 if ($doUnload) {
58 } else {
59 // $data = file_get_contents('php://input');
61 }
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