ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilSCORM13PlayerGUI Class Reference
+ Collaboration diagram for ilSCORM13PlayerGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 execute command More...
 
 getRTEjs ()
 
 getDataDirectory ()
 
 getConfigForPlayer ()
 
 getPlayer ()
 
 getCPData ()
 
 getCPDataInit ()
 
 getADLActDataInit ()
 
 getADLActData ()
 
 pingSession ()
 
 getScope ()
 
 getSuspendDataInit ()
 
 getSuspendData ()
 
 suspendADLActData ()
 
 readGObjectiveInit ()
 
 readGObjective ()
 
 readSharedData (int $sco_node_id)
 
 writeSharedData (int $sco_node_id)
 
 specialPage ()
 
 fetchCMIData ()
 
 getCMIData (int $userId, int $packageId)
 
 quoteJSONArray (?array $a_array)
 
 get_Module_Version ()
 
 get_actual_attempts ()
 Get number of actual attempts for the user. More...
 
 increase_attemptAndsave_module_version ()
 Increases attempts by one and saves module_version for this package. More...
 
 resetSharedData ()
 
 getDataDirectory2 ()
 
 openLog ()
 
 downloadLog ()
 
 liveLogContent ()
 
 debugGUI ()
 
 postLogEntry ()
 

Static Public Member Functions

static getInlineCSS ()
 

Data Fields

const ENABLE_GZIP = 0
 
const NONE = 0
 
const READONLY = 1
 
const WRITEONLY = 2
 
const READWRITE = 3
 
int $packageId
 
bool $jsMode
 
ilObjSCORM2004LearningModule $slm
 
ilGlobalTemplate $tpl
 
int $ref_id
 
ilCtrl $ctrl
 

Protected Attributes

ilLanguage $lng
 
string $page = ""
 

Private Member Functions

 getNodeData (string $sco_id)
 
 logTmpName ()
 
 summaryFileName ()
 
 logFileName ()
 
 logDirectory ()
 
 getLogFileList (string $s_delete, string $s_download, string $s_open)
 
 getLogTemplate ()
 
 getDebugValues (?bool $test_sco=false)
 
 getStructureFlat (array $data)
 
 createSummary (array $api_data)
 

Private Attributes

int $userId
 
array $flat_structure
 

Static Private Attributes

static array $schema
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSCORM13PlayerGUI::__construct ( )

Definition at line 148 of file class.ilSCORM13PlayerGUI.php.

149 {
150 global $DIC;
151 $this->ctrl = $DIC->ctrl();
152 $this->userId = $DIC->user()->getId();
153 $this->lng = $DIC->language();
154
155 // $this->packageId = (int) $_REQUEST['packageId'];
156 $this->jsMode = strpos($_SERVER['HTTP_ACCEPT'], 'text/javascript') !== false;
157
158 if ($DIC->http()->wrapper()->query()->has('page')) {
159 $this->page = $DIC->http()->wrapper()->query()->retrieve('page', $DIC->refinery()->kindlyTo()->string());
160 }
161
162 $this->ref_id = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
163 $this->slm = new ilObjSCORM2004LearningModule($this->ref_id, true);
164
165 $this->packageId = ilObject::_lookupObjectId($this->ref_id);
166 }
Class ilObjSCORM2004LearningModule.
static _lookupObjectId(int $ref_id)
global $DIC
Definition: shib_login.php:26

References $DIC, ilObject\_lookupObjectId(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ createSummary()

ilSCORM13PlayerGUI::createSummary ( array  $api_data)
private

Definition at line 2088 of file class.ilSCORM13PlayerGUI.php.

2088 : void
2089 {
2090 global $DIC;
2091 $ilDB = $DIC->database();
2092
2093 $csv_data = null;
2094 //csv columns
2095 $columns_fixed = array('id','title','type','attempted');
2096
2097 $ini_data = parse_ini_file("./components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini", true);
2098 $ini_array = $ini_data['summary'];
2099 $colums_variable = array();
2100 $api_keys = array();
2101
2102 foreach ($ini_array as $key => $value) {
2103 if ($value == 1) {
2104 $colums_variable[] = $key;
2105 $api_keys[] = $key;
2106 $colums_variable[] = "Status";
2107 }
2108 }
2109
2110 $header_array = array_merge($columns_fixed, $colums_variable);
2111
2112 $csv_header = implode(";", $header_array);
2113
2114 //get strcuture
2115 $res = $ilDB->queryF(
2116 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
2117 array('integer'),
2118 array($this->packageId)
2119 );
2120
2121 $packageData = $ilDB->fetchAssoc($res);
2122
2123 $structure = json_decode($packageData['jsdata'], true);
2124
2125
2126 $this->flat_structure = array(); //used for recursion
2127 if (isset($structure['item']) && isset($structure['item']['item'])) {
2128 $this->getStructureFlat($structure['item']['item']);
2129
2130 foreach ($this->flat_structure as $tree_element) {
2131 $csv_data = $csv_data . $tree_element['id'] . ";" . $tree_element['title'] . ";" . $tree_element['sco'] . ";";
2132 if (isset($api_data[$tree_element['id']])) {
2133 $csv_data = $csv_data . "X" . ";";
2134 } else {
2135 $csv_data = $csv_data . ";";
2136 }
2137
2138 //write api data
2139 $id = $tree_element['id'];
2140 foreach ($api_keys as $api_element) {
2141 if (isset($api_data[$id])) {
2142 if (isset($api_data[$id][$api_element])) {
2143 $csv_data = $csv_data . $api_data[$id][$api_element]['value'] . ";" . $api_data[$id][$api_element]['status'] . ";";
2144 } else {
2145 $csv_data = $csv_data . ";;";
2146 }
2147 }
2148 }
2149 $csv_data = $csv_data . "\n";
2150 }
2151 }
2152 $fh = fopen($this->summaryFileName(), "wb"); //changed from w to wb
2153 fwrite($fh, $csv_header . "\n" . $csv_data);
2154 fclose($fh);
2155 unlink($this->logTmpName());
2156 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$structure
TOTAL STRUCTURE.
foreach($_POST as $key=> $value) $res

References $DIC, $id, $ilDB, $res, and $structure.

◆ debugGUI()

ilSCORM13PlayerGUI::debugGUI ( )

Definition at line 1671 of file class.ilSCORM13PlayerGUI.php.

1671 : void
1672 {
1673 global $DIC;
1674 $lng = $DIC->language();
1675 $lng->loadLanguageModule("scormdebug");
1676
1677 /* if ($_POST['password'] == $this->slm->getDebugPw()) {
1678 $_SESSION["debug_pw"] = $this->slm->getDebugPw();
1679 }
1680 if ($_SESSION["debug_pw"]!=$this->slm->getDebugPw()) {
1681 $this->tpl = new ilTemplate("tpl.scorm2004.debug_pw.html", false, false, "../components/ILIAS/Scorm2004");
1682 $this->tpl->setVariable('SUBMIT', $lng->txt("debugwindow_submit"));
1683 $this->tpl->setVariable('CANCEL', $lng->txt("debugwindow_cancel"));
1684 $this->tpl->setVariable('PASSWORD_ENTER', $lng->txt("debugwindow_password_enter"));
1685 $this->tpl->setVariable('DEBUG_URL','ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=debugGUI&ref_id='.$this->ref_id);
1686 } else {*/
1687 $this->tpl = new ilGlobalTemplate("tpl.scorm2004.debug.html", false, false, "components/ILIAS/Scorm2004");
1688 $this->tpl->setVariable('CONSOLE', $lng->txt("debugwindow_console"));
1689 $this->tpl->setVariable('LOGS', $lng->txt("debugwindow_logs"));
1690 $this->tpl->setVariable('COMMENT', $lng->txt("debugwindow_comment"));
1691 $this->tpl->setVariable('COMMENT_ENTER', $lng->txt("debugwindow_comment_enter"));
1692 $this->tpl->setVariable('START_RECORDING', $lng->txt("debugwindow_start_recording"));
1693 $this->tpl->setVariable('STOP_RECORDING', $lng->txt("debugwindow_stop_recording"));
1694 $this->tpl->setVariable('DELETE_LOGFILE', $lng->txt("debugwindow_delete_logfile"));
1695 $this->tpl->setVariable('SUBMISSION_FAILED', $lng->txt("debugwindow_submission_failed"));
1696 $this->tpl->setVariable('SUBMIT', $lng->txt("debugwindow_submit"));
1697 $this->tpl->setVariable('CANCEL', $lng->txt("debugwindow_cancel"));
1698 $this->tpl->setVariable('FILENAME', $lng->txt("debugwindow_filename"));
1699 $this->tpl->setVariable('DATE', $lng->txt("debugwindow_date"));
1700 $this->tpl->setVariable('ACTION', $lng->txt("debugwindow_action"));
1701 $this->tpl->setVariable('RECORD_IMG', "components/ILIAS/Scorm2004/templates/default/images/record.png");
1702 $this->tpl->setVariable('STOP_IMG', "components/ILIAS/Scorm2004/templates/default/images/stop.png");
1703 $this->tpl->setVariable('COMMENT_IMG', "components/ILIAS/Scorm2004/templates/default/images/comment.png");
1704 $logfile = $this->logFileName() . ".html";
1705 $this->tpl->setVariable('LOGFILE', $this->logFileName() . ".html");
1706 $this->tpl->setVariable('FILES_DATA', json_encode($this->getLogFileList($lng->txt("debugwindow_delete"), $lng->txt("debugwindow_download"), $lng->txt("debugwindow_open"))));
1707 //}
1708 echo $this->tpl->get("DEFAULT", true);
1709 }
special template class to simplify handling of ITX/PEAR
loadLanguageModule(string $a_module)
Load language module.
txt(string|LanguageIdentifier $a_topic, ?int $n=null)
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getLogFileList(string $s_delete, string $s_download, string $s_open)

References $DIC, and $lng.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ downloadLog()

ilSCORM13PlayerGUI::downloadLog ( )

Definition at line 1611 of file class.ilSCORM13PlayerGUI.php.

1611 : void
1612 {
1613 global $DIC;
1614 $filename = ilUtil::stripSlashes($DIC->http()->wrapper()->query()->retrieve('logFile', $DIC->refinery()->kindlyTo()->string()));
1615 $filename = str_replace('/', '', $filename);
1616 //Header
1617 header("Expires: 0");
1618 header("Cache-Control: private");
1619 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
1620 header("Pragma: cache");
1621 header("Content-Description: File Transfer");
1622 header("Content-Type: application/octet-stream");
1623 header("Content-disposition: attachment; filename=$filename");
1624 echo file_get_contents($this->logDirectory() . "/" . $filename);
1625 exit;
1626 }
$filename
Definition: buildRTE.php:78
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, $filename, exit, ILIAS\UI\examples\Symbol\Glyph\Header\header(), and ilUtil\stripSlashes().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilSCORM13PlayerGUI::executeCommand ( )

execute command

Definition at line 171 of file class.ilSCORM13PlayerGUI.php.

171 : void
172 {
173 global $DIC;
174 $ilAccess = $DIC->access();
175 $lng = $DIC->language();
176 $ilErr = $DIC['ilErr'];
177
178 $next_class = $this->ctrl->getNextClass($this);
179 $cmd = $this->ctrl->getCmd();
180
181 if (!$ilAccess->checkAccess("read", "", $this->ref_id)) {
182 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
183 }
184
185 $nodeId = 0;
186 if ($DIC->http()->wrapper()->query()->has('node_id')) {
187 $nodeId = $DIC->http()->wrapper()->query()->retrieve('node_id', $DIC->refinery()->kindlyTo()->int());
188 }
189
190
191 //$ilLog->write("SCORM2004 Player cmd: ".$cmd);
192
193 switch ($cmd) {
194 case 'getRTEjs':
195 $this->getRTEjs();
196 break;
197
198 case 'cp':
199 $this->getCPData();
200 break;
201
202 case 'adlact':
203 $this->getADLActData();
204 break;
205
206 case 'suspend':
207 $this->suspendADLActData();
208 break;
209
210 case 'getSuspend':
211 $this->getSuspendData();
212 break;
213
214 case 'gobjective':
215 // $this->writeGObjective();
216 break;
217
218 case 'getGobjective':
219 $this->readGObjective();
220 break;
221
222 case 'getSharedData':
223 $this->readSharedData($nodeId);
224 break;
225
226 case 'setSharedData':
227 $this->writeSharedData($nodeId);
228 break;
229
230 case 'cmi':
231 if ($_SERVER['REQUEST_METHOD'] === 'POST') {
233 $this->packageId,
234 $this->ref_id,
235 $this->slm->getDefaultLessonMode(),
236 $this->slm->getComments(),
237 $this->slm->getInteractions(),
238 $this->slm->getObjectives(),
239 $this->slm->getTime_from_lms(),
240 null,
241 $this->userId
242 );
243 //error_log("Saved CMI Data");
244 } else {
245 $this->fetchCMIData();
246 }
247 break;
248
249 case 'specialPage':
250 $this->specialPage();
251 break;
252
253 case 'debugGUI':
254 $this->debugGUI();
255 break;
256
257 case 'postLogEntry':
258 $this->postLogEntry();
259 break;
260
261 case 'liveLogContent':
262 $this->liveLogContent();
263 break;
264 case 'downloadLog':
265 $this->downloadLog();
266 break;
267
268 case 'openLog':
269 $this->openLog();
270 break;
271
272 case 'pingSession':
273 $this->pingSession();
274 break;
275
276 case 'scormPlayerUnload':
277 ilSCORM2004StoreData::scormPlayerUnload($this->packageId, $this->ref_id, $this->slm->getTime_from_lms(), $this->userId);
278 break;
279
280 // case 'getConfigForPlayer':
281 // $this->getConfigForPlayer();
282 // break;
283
284 default:
285 $this->getPlayer();
286 break;
287 }
288 }
writeSharedData(int $sco_node_id)
readSharedData(int $sco_node_id)
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)

References $DIC, $lng, ILIAS\Repository\ctrl(), debugGUI(), downloadLog(), fetchCMIData(), getADLActData(), getCPData(), getPlayer(), getRTEjs(), getSuspendData(), liveLogContent(), openLog(), ilSCORM2004StoreData\persistCMIData(), pingSession(), postLogEntry(), readGObjective(), readSharedData(), ilSCORM2004StoreData\scormPlayerUnload(), specialPage(), suspendADLActData(), ilLanguage\txt(), and writeSharedData().

+ Here is the call graph for this function:

◆ fetchCMIData()

ilSCORM13PlayerGUI::fetchCMIData ( )

Definition at line 1021 of file class.ilSCORM13PlayerGUI.php.

1021 : void
1022 {
1023 $data = $this->getCMIData($this->userId, $this->packageId);
1024 if ($this->jsMode) {
1025 header('Content-Type: text/javascript; charset=UTF-8');
1026 print(json_encode($data));
1027 } else {
1028 header('Content-Type: text/plain; charset=UTF-8');
1029 print(var_export($data, true));
1030 }
1031 }
getCMIData(int $userId, int $packageId)
$data
Definition: storeScorm.php:45

References $data, and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_actual_attempts()

ilSCORM13PlayerGUI::get_actual_attempts ( )

Get number of actual attempts for the user.

Definition at line 1268 of file class.ilSCORM13PlayerGUI.php.

1268 : int
1269 {
1270 global $DIC;
1271 $ilDB = $DIC->database();
1272 $ilUser = $DIC->user();
1273 $val_set = $ilDB->queryF(
1274 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
1275 array('integer','integer'),
1276 array($this->packageId,$this->userId)
1277 );
1278 $val_rec = $ilDB->fetchAssoc($val_set);
1279 $attempts = $val_rec["package_attempts"];
1280 if ($attempts == null) {
1281 $attempts = 0;
1282 }
1283 return (int) $attempts;
1284 }

References $DIC, and $ilDB.

◆ get_Module_Version()

ilSCORM13PlayerGUI::get_Module_Version ( )

Definition at line 1250 of file class.ilSCORM13PlayerGUI.php.

1250 : int
1251 {
1252 global $DIC;
1253 $ilDB = $DIC->database();
1254
1255 $res = $ilDB->queryF(
1256 'SELECT module_version FROM sahs_lm WHERE id = %s',
1257 array('integer'),
1258 array($this->packageId)
1259 );
1260 $row = $ilDB->fetchAssoc($res);
1261
1262 return (int) $row['module_version'];
1263 }

References $DIC, $ilDB, and $res.

◆ getADLActData()

ilSCORM13PlayerGUI::getADLActData ( )

Definition at line 600 of file class.ilSCORM13PlayerGUI.php.

600 : void
601 {
602 $activitytree = $this->getADLActDataInit();
603 if ($this->jsMode) {
604 header('Content-Type: text/javascript; charset=UTF-8');
605 print($activitytree);
606 } else {
607 header('Content-Type: text/plain; charset=UTF-8');
608 $activitytree = json_decode($activitytree);
609 print_r($activitytree);
610 }
611 }

References getADLActDataInit(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getADLActDataInit()

ilSCORM13PlayerGUI::getADLActDataInit ( )

Definition at line 580 of file class.ilSCORM13PlayerGUI.php.

580 : string
581 {
582 global $DIC;
583 $ilDB = $DIC->database();
584
585 $res = $ilDB->queryF(
586 'SELECT activitytree FROM cp_package WHERE obj_id = %s',
587 array('integer'),
588 array($this->packageId)
589 );
590 $data = $ilDB->fetchAssoc($res);
591
592 $activitytree = $data['activitytree'] ?? false;
593
594 if (!$activitytree) {
595 $activitytree = 'null';
596 }
597 return $activitytree;
598 }

References $data, $DIC, $ilDB, and $res.

Referenced by getADLActData(), and getPlayer().

+ Here is the caller graph for this function:

◆ getCMIData()

ilSCORM13PlayerGUI::getCMIData ( int  $userId,
int  $packageId 
)
Returns
array<string, array<int|string, array<array|int|string>>>

Definition at line 1052 of file class.ilSCORM13PlayerGUI.php.

1052 : array
1053 {
1054 global $DIC;
1055 $ilDB = $DIC->database();
1056
1057 $i_check = 0;
1058 $result = array(
1059 'schema' => array(),
1060 'data' => array()
1061 );
1062
1063 foreach (self::$schema as $k => &$v) {
1064 $result['schema'][$k] = array_keys($v);
1065 $q = '';
1066 switch ($k) {
1067 case "node":
1068 $q = 'SELECT cmi_node.*
1069 FROM cmi_node
1070 INNER JOIN cp_node ON cmi_node.cp_node_id = cp_node.cp_node_id
1071 WHERE cmi_node.user_id = %s
1072 AND cp_node.slm_id = %s';
1073
1074 break;
1075
1076 case "comment":
1077 if ($i_check > 7) {
1078 $i_check -= 8;
1079 if ($this->slm->getComments()) {
1080 $q = 'SELECT
1081 cmi_comment.cmi_comment_id,
1082 cmi_comment.cmi_node_id,
1083 cmi_comment.c_comment,
1084 cmi_comment.c_timestamp,
1085 cmi_comment.location,
1086 cmi_comment.sourceislms
1087 FROM cmi_comment
1088 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_comment.cmi_node_id
1089 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1090 WHERE cmi_node.user_id = %s
1091 AND cp_node.slm_id = %s
1092 ORDER BY cmi_comment.cmi_comment_id';
1093 }
1094 }
1095
1096 break;
1097
1098 case "correct_response":
1099 if ($i_check > 3) {
1100 $i_check -= 4;
1101 if ($this->slm->getInteractions()) {
1102 $q = 'SELECT cmi_correct_response.*
1103 FROM cmi_correct_response
1104 INNER JOIN cmi_interaction
1105 ON cmi_interaction.cmi_interaction_id = cmi_correct_response.cmi_interaction_id
1106 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id
1107 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1108 WHERE cmi_node.user_id = %s
1109 AND cp_node.slm_id = %s
1110 ORDER BY cmi_correct_response.cmi_correct_resp_id';
1111 }
1112 }
1113 break;
1114
1115 case "interaction":
1116 if ($i_check > 1) {
1117 $i_check -= 2;
1118 if ($this->slm->getInteractions()) {
1119 $q = 'SELECT
1120 cmi_interaction.cmi_interaction_id,
1121 cmi_interaction.cmi_node_id,
1122 cmi_interaction.description,
1123 cmi_interaction.id,
1124 cmi_interaction.latency,
1125 cmi_interaction.learner_response,
1126 cmi_interaction.result,
1127 cmi_interaction.c_timestamp,
1128 cmi_interaction.c_type,
1129 cmi_interaction.weighting
1130 FROM cmi_interaction
1131 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_interaction.cmi_node_id
1132 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1133 WHERE cmi_node.user_id = %s
1134 AND cp_node.slm_id = %s
1135 ORDER BY cmi_interaction.cmi_interaction_id';
1136 }
1137 }
1138 break;
1139
1140 case "objective":
1141 if ($i_check > 0) {
1142 if ($this->slm->getObjectives()) {
1143 $q = 'SELECT
1144 cmi_objective.cmi_interaction_id,
1145 cmi_objective.cmi_node_id,
1146 cmi_objective.cmi_objective_id,
1147 cmi_objective.completion_status,
1148 cmi_objective.description,
1149 cmi_objective.id,
1150 cmi_objective.c_max,
1151 cmi_objective.c_min,
1152 cmi_objective.c_raw,
1153 cmi_objective.scaled,
1154 cmi_objective.progress_measure,
1155 cmi_objective.success_status,
1156 cmi_objective.scope
1157 FROM cmi_objective
1158 INNER JOIN cmi_node ON cmi_node.cmi_node_id = cmi_objective.cmi_node_id
1159 INNER JOIN cp_node ON cp_node.cp_node_id = cmi_node.cp_node_id
1160 WHERE cmi_node.user_id = %s
1161 AND cp_node.slm_id = %s
1162 ORDER BY cmi_objective.cmi_objective_id';
1163 }
1164 }
1165 break;
1166
1167 case "package"://delete because data exist except of learner_name
1168 $q = 'SELECT usr_data.usr_id user_id,
1169 CONCAT(CONCAT(COALESCE(usr_data.firstname, \'\'), \' \'), COALESCE(usr_data.lastname, \'\')) learner_name,
1170 sahs_lm.id slm_id , sahs_lm.default_lesson_mode "mode", sahs_lm.credit
1171 FROM usr_data, cp_package
1172 INNER JOIN sahs_lm ON cp_package.obj_id = sahs_lm.id
1173 WHERE usr_data.usr_id = %s
1174 AND sahs_lm.id = %s';
1175
1176 break;
1177 }
1178
1179 $result['data'][$k] = array();
1180 if ($q != '') {
1181 $types = array('integer', 'integer');
1182 $values = array($userId, $packageId);
1183 $res = $ilDB->queryF($q, $types, $values);
1184
1185 while ($row = $ilDB->fetchAssoc($res)) {
1186 $tmp_result = array();
1187 foreach ($row as $key => $value) {
1188 if ($k === "comment" && $key === "c_timestamp" && strpos($value, ' ') == 10) {
1189 $value = str_replace(' ', 'T', $value);
1190 }
1191 $tmp_result[] = $value;
1192 if ($k === "node" && $key === "additional_tables" && $i_check < $value) {
1193 $i_check = $value;
1194 // $GLOBALS['DIC']['ilLog']->write($i_check);
1195 }
1196 }
1197 $result['data'][$k][] = $tmp_result;
1198 }
1199 }
1200 }
1201 return $result;
1202 }

References $DIC, $ilDB, $packageId, and $res.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ getConfigForPlayer()

ilSCORM13PlayerGUI::getConfigForPlayer ( )
Returns
array<string, mixed>

Definition at line 313 of file class.ilSCORM13PlayerGUI.php.

313 : array
314 {
315 global $DIC;
316 $ilUser = $DIC->user();
317
318 $initSuspendData = null;
319 $config = array(
320 'scope' => $this->getScope(),
321 'learner_id' => (string) $ilUser->getID(),
322 'cmi_learner_id' => (string) $this->slm->getApiStudentId(),
323 'course_id' => (string) $this->packageId,
324 'learner_name' => (string) $this->slm->getApiStudentName(),
325 'mode' => $this->slm->getDefaultLessonMode(),
326 'credit' => $this->slm->getCreditMode(),
327 'auto_review' => $this->slm->getAutoReviewChar(),
328 'hide_navig' => $this->slm->getHideNavig(),
329 'hide_menu' => $this->slm->getNoMenu(),
330 'ie_force_render' => $this->slm->getIe_force_render(),
331 'fourth_edition' => $this->slm->getFourth_edition(),
332 'sequencing_enabled' => $this->slm->getSequencing(),
333 'interactions_storable' => $this->slm->getInteractions(),
334 'objectives_storable' => $this->slm->getObjectives(),
335 'comments_storable' => $this->slm->getComments(),
336 'time_from_lms' => $this->slm->getTime_from_lms(),
337 'auto_last_visited' => $this->slm->getAuto_last_visited(),
338 'lesson_mastery_score' => $this->slm->getMasteryScore(),
339 'checkSetValues' => $this->slm->getCheck_values(),
340 'auto_suspend' => $this->slm->getAutoSuspend(),
341 'suspend_data' => $initSuspendData,
342 'cp_data' => null,
343 'cmi_data' => null,
344 'adlact_data' => null,
345 'globalobj_data' => null
346 );
347 $config['status'] = ilObjSCORMInitData::getStatus($this->packageId, $ilUser->getID(), $this->slm->getAuto_last_visited(), "2004");
348 // $status['last_visited']=null;
349 // if($this->slm->getAuto_last_visited())
350 // {
351 // $status['last_visited']=$this->get_last_visited($this->packageId, $ilUser->getID());
352 // }
353 // $config['status'] = $status;
354
355 return $config;
356 }
static getStatus(int $a_packageId, int $a_user_id, bool $auto_last_visited, string $scormType="1.2")

References $DIC, getScope(), and ilObjSCORMInitData\getStatus().

Referenced by getPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCPData()

ilSCORM13PlayerGUI::getCPData ( )

Definition at line 546 of file class.ilSCORM13PlayerGUI.php.

546 : void
547 {
548 $jsdata = $this->getCPDataInit();
549 if ($this->jsMode) {
550 header('Content-Type: text/javascript; charset=UTF-8');
551 print($jsdata);
552 } else {
553 header('Content-Type: text/plain; charset=UTF-8');
554 $jsdata = json_decode($jsdata);
555 print_r($jsdata);
556 }
557 }

References getCPDataInit(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCPDataInit()

ilSCORM13PlayerGUI::getCPDataInit ( )

Definition at line 559 of file class.ilSCORM13PlayerGUI.php.

559 : string
560 {
561 global $DIC;
562 $ilDB = $DIC->database();
563
564 $res = $ilDB->queryF(
565 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
566 array('integer'),
567 array($this->packageId)
568 );
569 $packageData = $ilDB->fetchAssoc($res);
570
571 $jsdata = $packageData['jsdata'] ?? false;
572 if (!$jsdata) {
573 $jsdata = 'null';
574 }
575
576 return $jsdata;
577 }

References $DIC, $ilDB, and $res.

Referenced by getCPData(), and getPlayer().

+ Here is the caller graph for this function:

◆ getDataDirectory()

ilSCORM13PlayerGUI::getDataDirectory ( )

Definition at line 301 of file class.ilSCORM13PlayerGUI.php.

301 : string
302 {
303 $webdir = str_replace("/ilias.php", "", $_SERVER["SCRIPT_NAME"]);
304 //load ressources always with absolute URL..relative URLS fail on innersco navigation on certain browsers
305 $lm_dir = $webdir . "/" . ILIAS_WEB_DIR . "/" . CLIENT_ID . "/lm_data" . "/lm_" . (string) $this->packageId;
306 return $lm_dir;
307 }
const CLIENT_ID
Definition: constants.php:41
const ILIAS_WEB_DIR
Definition: constants.php:45

References CLIENT_ID, and ILIAS_WEB_DIR.

Referenced by getPlayer(), and pingSession().

+ Here is the caller graph for this function:

◆ getDataDirectory2()

ilSCORM13PlayerGUI::getDataDirectory2 ( )

Definition at line 1581 of file class.ilSCORM13PlayerGUI.php.

1581 : string
1582 {
1583 $webdir = str_replace("/ilias.php", "", $_SERVER["SCRIPT_NAME"]);
1584 //load ressources always with absolute URL..relative URLS fail on innersco navigation on certain browsers
1585 $lm_dir = $webdir . "/" . ILIAS_WEB_DIR . "/" . CLIENT_ID . "/lm_data" . "/lm_" . $this->packageId;
1586 return $lm_dir;
1587 }

References $packageId, CLIENT_ID, and ILIAS_WEB_DIR.

◆ getDebugValues()

ilSCORM13PlayerGUI::getDebugValues ( ?bool  $test_sco = false)
private
Returns
mixed[]

Definition at line 1719 of file class.ilSCORM13PlayerGUI.php.

1719 : array
1720 {
1721 global $DIC;
1722 $ilDB = $DIC->database();
1723 $ilLog = ilLoggerFactory::getLogger('sc13');
1724 $ini_array = null;
1725 $dvalues = array();
1726 /*
1727 $res = $ilDB->queryF('
1728 SELECT debug_fields
1729 FROM sahs_lm
1730 WHERE id = %s',
1731 array('integer'),
1732 array($this->packageId)
1733 );
1734 $row = $ilDB->fetchAssoc($res);
1735 $debug_fields = $row['debug_fields'];
1736 if ($debug_fields == null) {*/
1737 $debug_fields = parse_ini_file("../components/ILIAS/Scorm2004/scripts/rtemain/debug_default.ini", true);
1738 // }
1739 if ($test_sco) {
1740 $ini_array = $debug_fields['test_sco'];
1741 } else {
1742 $ini_array = $debug_fields['normal_sco'];
1743 }
1744 foreach ($ini_array as $key => $value) {
1745 if ($value == 1) {
1746 $dvalues[] = $key;
1747 }
1748 }
1749 return $dvalues;
1750 }
static getLogger(string $a_component_id)
Get component logger.

References $DIC, $ilDB, and ilLoggerFactory\getLogger().

Referenced by getPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInlineCSS()

static ilSCORM13PlayerGUI::getInlineCSS ( )
static

Definition at line 532 of file class.ilSCORM13PlayerGUI.php.

532 : string
533 {
534 $is_tpl = new ilTemplate("tpl.scorm2004.inlinecss.html", true, true, "components/ILIAS/Scorm2004");
535 $is_tpl->setVariable('IC_ASSET', ilUtil::getImagePath("scorm/asset.svg", ""));
536 $is_tpl->setVariable('IC_COMPLETED', ilUtil::getImagePath("scorm/completed.svg", ""));
537 $is_tpl->setVariable('IC_NOTATTEMPTED', ilUtil::getImagePath("scorm/not_attempted.svg", ""));
538 $is_tpl->setVariable('IC_RUNNING', ilUtil::getImagePath("scorm/running.svg", ""));
539 $is_tpl->setVariable('IC_INCOMPLETE', ilUtil::getImagePath("scorm/incomplete.svg", ""));
540 $is_tpl->setVariable('IC_PASSED', ilUtil::getImagePath("scorm/passed.svg", ""));
541 $is_tpl->setVariable('IC_FAILED', ilUtil::getImagePath("scorm/failed.svg", ""));
542 $is_tpl->setVariable('IC_BROWSED', ilUtil::getImagePath("scorm/browsed.svg", ""));
543 return $is_tpl->get();
544 }
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath().

+ Here is the call graph for this function:

◆ getLogFileList()

ilSCORM13PlayerGUI::getLogFileList ( string  $s_delete,
string  $s_download,
string  $s_open 
)
private
Returns
array<int, array<string, string>>
Exceptions
ilCtrlException

Definition at line 1632 of file class.ilSCORM13PlayerGUI.php.

1632 : array
1633 {
1634 global $DIC;
1635 $data = array();
1636 foreach (new DirectoryIterator($this->logDirectory()) as $fileInfo) {
1637 if ($fileInfo->isDot()) {
1638 continue;
1639 }
1640 $item['filename'] = $fileInfo->getFilename();
1641 $parts = pathinfo($item['filename']);
1642 $fnameparts = preg_split('/_/', $parts['filename'], -1, PREG_SPLIT_NO_EMPTY);
1643 $deleteUrl = '&nbsp;<a href=#' . " onclick=\"javascript:deleteFile('" . $item['filename'] . "');\">" . $s_delete . "</a>";
1644 //no delete for most recent file
1645 if (isset($fnameparts[1]) && (string) $this->get_actual_attempts() == $fnameparts[1]) {
1646 $deleteUrl = "";
1647 }
1648
1649 $urlDownload = $DIC->ctrl()->getLinkTarget($this, 'downloadLog') . '&logFile=' . $fileInfo->getFilename();
1650 $urlOpen = $DIC->ctrl()->getLinkTarget($this, 'openLog') . '&logFile=' . $fileInfo->getFilename();
1651 $item['date'] = date('Y/m/d H:i:s', $fileInfo->getCTime());
1652 if ($parts['extension'] === "html") {
1653 $item['action'] = $deleteUrl . "&nbsp;<a href=" . $urlDownload . ">" . $s_download . "</a>&nbsp;<a target=_new href=" . $urlOpen . ">" . $s_open . "</a>";
1654 } else {
1655 $item['action'] = $deleteUrl . "&nbsp;<a href=" . $urlDownload . ">" . $s_download . "</a>";
1656 }
1657 if ($parts['extension'] === "html" || $parts['extension'] === "csv") {
1658 $data[] = $item;
1659 }
1660 }
1661 usort($data, "datecmp");
1662 return $data;
1663 }
get_actual_attempts()
Get number of actual attempts for the user.

References $data, $DIC, and ILIAS\UI\examples\Symbol\Glyph\Date\date().

+ Here is the call graph for this function:

◆ getLogTemplate()

ilSCORM13PlayerGUI::getLogTemplate ( )
private

Definition at line 1711 of file class.ilSCORM13PlayerGUI.php.

1711 : \ilTemplate
1712 {
1713 return new ilTemplate("tpl.scorm2004.debugtxt.txt", true, true, "components/ILIAS/Scorm2004");
1714 }

◆ getNodeData()

ilSCORM13PlayerGUI::getNodeData ( string  $sco_id)
private
Returns
mixed[]

Definition at line 1361 of file class.ilSCORM13PlayerGUI.php.

1361 : array
1362 {
1363 global $DIC;
1364 $ilDB = $DIC->database();
1365 $ilLog = ilLoggerFactory::getLogger('sc13');
1366
1367 $fieldList = "cmi_node.cp_node_id, cmi_node.completion_threshold, cmi_node.c_exit, cmi_node.completion_status, cmi_node.progress_measure, cmi_node.success_status, cmi_node.scaled, cmi_node.session_time," .
1368 "cmi_node.c_min, cmi_node.c_max, cmi_node.c_raw, cmi_node.location, cmi_node.suspend_data, cmi_node.scaled_passing_score, cmi_node.total_time";
1369
1370
1371 $res = $ilDB->queryF(
1372 '
1373 SELECT ' . $fieldList . '
1374 FROM cmi_node,cp_node,cp_item
1375 WHERE cp_node.slm_id = %s
1376 AND cp_node.cp_node_id = cp_item.cp_node_id
1377 AND cp_item.id = %s
1378 AND cmi_node.cp_node_id = cp_item.cp_node_id
1379 AND cmi_node.user_id = %s',
1380 array('integer','text','integer'),
1381 array($this->packageId, $sco_id, $this->userId)
1382 );
1383 // $ilLog->write("DEBUG SQL" . $row);
1384 return $ilDB->fetchAssoc($res);
1385 }

References $DIC, $ilDB, $res, and ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

◆ getPlayer()

ilSCORM13PlayerGUI::getPlayer ( )
Exceptions
ilCtrlException
ilTemplateException

Definition at line 362 of file class.ilSCORM13PlayerGUI.php.

362 : void
363 {
364 global $DIC;
365 $lng = $DIC->language();
366 $ilSetting = $DIC->settings();
367 if (!$this->slm->hasContainerResource()) {
368 ilWACSignedPath::signFolderOfStartFile($this->getDataDirectory() . '/imsmanifest.xml');
369 }
370
371 // player basic config data
372
373 $initSuspendData = null;
374 $initAdlactData = null;
375 $initGlobalobjData = null;
376 if ($this->slm->getSequencing() == true) {
377 $initSuspendData = json_decode($this->getSuspendDataInit());
378 $initAdlactData = json_decode($this->getADLActDataInit());
379 $initGlobalobjData = $this->readGObjectiveInit();
380 }
381
382 $config = $this->getConfigForPlayer();
383
384 //session
385 if ($this->slm->getSession()) {
387 $max_idle = (int) ilSession::getIdleValue();
388 if ($session_timeout > $max_idle) {
389 $session_timeout = $max_idle;
390 }
391 $min_idle = ilSessionControl::DEFAULT_MIN_IDLE * 60;
392 if ($session_timeout > $min_idle) {
393 $session_timeout = $min_idle;
394 }
395 $session_timeout -= 10; //buffer
396 } else {
397 $session_timeout = 0;
398 }
399 $config['session_ping'] = $session_timeout;
400
401 //url strings
402 $store_url = $DIC->ctrl()->getLinkTarget($this, 'cmi');
403 $unload_url = $DIC->ctrl()->getLinkTarget($this, 'scormPlayerUnload');
404 if ($this->slm->getSessionDeactivated()) {
405 $store_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $this->ref_id . '&client_id=' . CLIENT_ID . '&do=store';
406 $unload_url = 'storeScorm2004.php?package_id=' . $this->packageId . '&ref_id=' . $this->ref_id . '&client_id=' . CLIENT_ID . '&do=unload';
407 }
408 $config['cp_url'] = $DIC->ctrl()->getLinkTarget($this, 'cp');
409 $config['cmi_url'] = $DIC->ctrl()->getLinkTarget($this, 'cmi');
410 $config['store_url'] = $store_url;
411 $config['get_adldata_url'] = $DIC->ctrl()->getLinkTarget($this, 'getSharedData');
412 $config['set_adldata_url'] = $DIC->ctrl()->getLinkTarget($this, 'setSharedData');
413 $config['adlact_url'] = $DIC->ctrl()->getLinkTarget($this, 'adlact');
414 $config['specialpage_url'] = $DIC->ctrl()->getLinkTarget($this, 'specialPage');
415 $config['suspend_url'] = $DIC->ctrl()->getLinkTarget($this, 'suspend');
416 $config['get_suspend_url'] = $DIC->ctrl()->getLinkTarget($this, 'getSuspend');
417 //next 2 lines could be deleted later
418 $config['gobjective_url'] = $DIC->ctrl()->getLinkTarget($this, 'gobjective');
419 $config['get_gobjective_url'] = $DIC->ctrl()->getLinkTarget($this, 'getGobjective');
420 $config['ping_url'] = $DIC->ctrl()->getLinkTarget($this, 'pingSession');
421 $config['scorm_player_unload_url'] = $unload_url;
422 $config['post_log_url'] = $DIC->ctrl()->getLinkTarget($this, 'postLogEntry');
423 $config['livelog_url'] = $DIC->ctrl()->getLinkTarget($this, 'liveLogContent');
424 $config['package_url'] = $this->slm->getContainerBaseUri() ?? ($this->getDataDirectory() . "/");
425
426 //editor
427 $config['envEditor'] = 0;
428
429 //debug
430 $config['debug'] = $this->slm->getDebug();
431 $config['debug_fields'] = $this->getDebugValues();
432 $config['debug_fields_test'] = $this->getDebugValues(true);
433
434 //language strings
435 $langstrings['btnStart'] = $lng->txt('scplayer_start');
436 $langstrings['btnExit'] = $lng->txt('scplayer_exit');
437 $langstrings['btnExitAll'] = $lng->txt('scplayer_exitall');
438 $langstrings['btnSuspendAll'] = $lng->txt('scplayer_suspendall');
439 $langstrings['btnPrevious'] = $lng->txt('scplayer_previous');
440 $langstrings['btnContinue'] = $lng->txt('scplayer_continue');
441 $langstrings['btnhidetree'] = $lng->txt('scplayer_hidetree');
442 $langstrings['btnshowtree'] = $lng->txt('scplayer_showtree');
443 $langstrings['linkexpandTree'] = $lng->txt('scplayer_expandtree');
444 $langstrings['linkcollapseTree'] = $lng->txt('scplayer_collapsetree');
445 $langstrings['contCreditOff'] = $lng->txt('cont_credit_off');
446 if ($this->slm->getAutoReviewChar() === "s") {
447 $langstrings['contCreditOff'] = $lng->txt('cont_sc_score_was_higher_message');
448 }
449 $config['langstrings'] = $langstrings;
450
451 //template variables
452 //$this->tpl = new ilTemplate("tpl.scorm2004.player.html", false, false, "components/ILIAS/Scorm2004");
453 $this->tpl = new ilGlobalTemplate("tpl.scorm2004.player.html", true, true, "components/ILIAS/Scorm2004");
454
455 // TODO should work with jquery.min.js
456 $jQueryPath = str_replace('.min', '', iljQueryUtil::getLocaljQueryPath());
457 $this->tpl->setVariable("JS_FILE", $jQueryPath);
458
459 // include ilias rte css, if given (only legacy on-disk modules carry the
460 // ilias_css_4_2 editor stylesheet; imported/migrated packages do not)
461 if (!$this->slm->hasContainerResource()) {
462 $rte_css = $this->slm->getDataDirectory() . "/ilias_css_4_2/css/style.css";
463 if (is_file($rte_css)) {
464 $this->tpl->setCurrentBlock("rte_css");
465 $this->tpl->setVariable("RTE_CSS", $rte_css);
466 $this->tpl->parseCurrentBlock();
467 }
468 }
469
470
471 $this->tpl->setVariable('JSON_LANGSTRINGS', json_encode($langstrings));
472 // $this->tpl->setVariable('TREE_JS', "../components/ILIAS/UIComponent/NestedList/js/ilNestedList.js");
473 $this->tpl->setVariable('TREE_JS', "components/ILIAS/Scorm2004/scripts/ilNestedList.js");
474 foreach ($langstrings as $key => $value) {
475 $this->tpl->setVariable($key, $value);
476 }
477 $this->tpl->setVariable('DOC_TITLE', 'ILIAS: ' . $this->slm->getTitle());
478 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
479 $this->tpl->setVariable('INIT_CP_DATA', json_encode(json_decode($this->getCPDataInit())));
480 $this->tpl->setVariable('INIT_CMI_DATA', json_encode($this->getCMIData($this->userId, $this->packageId)));
481 $this->tpl->setVariable('INIT_ADLACT_DATA', json_encode($initAdlactData));
482 $this->tpl->setVariable('INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData));
483 $this->tpl->setVariable('JS_DATA', json_encode($config));
484 list($tsfrac, $tsint) = explode(' ', microtime());
485 $this->tpl->setVariable('TIMESTAMP', sprintf('%d%03d', $tsint, 1000 * (float) $tsfrac));
486 $this->tpl->setVariable('BASE_DIR', './components/ILIAS/Scorm2004/');
487 $this->tpl->setVariable('TXT_COLLAPSE', $lng->txt('scplayer_collapsetree'));
488 if ($this->slm->getDebug()) {
489 $this->tpl->setVariable('TXT_DEBUGGER', $lng->txt('scplayer_debugger'));
490 $debug_url = $DIC->ctrl()->getLinkTarget($this, 'debugGUI');
491 $this->tpl->setVariable('DEBUG_URL', "PopupCenter('" . $debug_url . "','Debug',800,600);");
492 } else {
493 $this->tpl->setVariable('TXT_DEBUGGER', '');
494 $this->tpl->setVariable('DEBUG_URL', '');
495 }
496
497 //set icons path
498 $this->tpl->setVariable('INLINE_CSS', ilSCORM13PlayerGUI::getInlineCss());
499
500 //include scripts
501 if ($this->slm->getCacheDeactivated()) {
502 $rtejs_url = $DIC->ctrl()->getLinkTarget($this, 'getRTEjs');
503 $this->tpl->setVariable('JS_SCRIPTS', $rtejs_url);
504 } else {
505 $this->tpl->setVariable('JS_SCRIPTS', 'components/ILIAS/Scorm2004/scripts/buildrte/rte-min.js');
506 }
507
508 //disable top menu
509 if ($this->slm->getNoMenu() === true) {
510 $this->tpl->setVariable("VAL_DISPLAY", "style=\"display:none;\"");
511 } else {
512 $this->tpl->setVariable("VAL_DISPLAY", "");
513 }
514
515
516 //check for max_attempts and raise error if max_attempts is exceeded
517 // if ($this->get_max_attempts() != 0) {
518 // if ($this->get_actual_attempts() >= $this->get_max_attempts()) {
519 // header('Content-Type: text/html; charset=utf-8');
520 // echo($lng->txt("cont_sc_max_attempt_exceed"));
521 // exit;
522 // }
523 // }
524
525 //count attempt
527 $this->resetSharedData();
528
529 $this->tpl->printToStdout("DEFAULT", false);
530 }
getDebugValues(?bool $test_sco=false)
increase_attemptAndsave_module_version()
Increases attempts by one and saves module_version for this package.
const int DEFAULT_MIN_IDLE
default value for settings that have not been defined in setup or administration yet
static getIdleValue()
Returns the idle time in seconds.
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
static signFolderOfStartFile(string $start_file_path)
static getCookieMaxLifetimeInSeconds()
static getLocaljQueryPath()
global $ilSetting
Definition: privfeed.php:26

References $DIC, $ilSetting, $lng, CLIENT_ID, ilSessionControl\DEFAULT_MIN_IDLE, getADLActDataInit(), getCMIData(), getConfigForPlayer(), ilWACSignedPath\getCookieMaxLifetimeInSeconds(), getCPDataInit(), getDataDirectory(), getDebugValues(), ilSession\getIdleValue(), iljQueryUtil\getLocaljQueryPath(), ilUtil\getStyleSheetLocation(), getSuspendDataInit(), increase_attemptAndsave_module_version(), ILIAS\Repository\int(), readGObjectiveInit(), resetSharedData(), ilWACSignedPath\signFolderOfStartFile(), and ilLanguage\txt().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRTEjs()

ilSCORM13PlayerGUI::getRTEjs ( )

Definition at line 290 of file class.ilSCORM13PlayerGUI.php.

290 : void
291 {
292 $js_data = file_get_contents("../components/ILIAS/Scorm2004/scripts/buildrte/rte.js");
293 if (self::ENABLE_GZIP == 1) {
294 ob_start("ob_gzhandler");
295 }
296 header('Content-Type: text/javascript; charset=UTF-8');
297 echo $js_data;
298 }

References ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScope()

ilSCORM13PlayerGUI::getScope ( )

Definition at line 623 of file class.ilSCORM13PlayerGUI.php.

623 : string
624 {
625 global $DIC;
626 $ilDB = $DIC->database();
627 $ilUser = $DIC->user();
628
629 $res = $ilDB->queryF(
630 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
631 array('integer'),
632 array($this->packageId)
633 );
634 $data = $ilDB->fetchAssoc($res);
635
636 $gystem = $data['global_to_system'] ?? 1;
637 if ($gystem == 1) {
638 $gsystem = 'null';
639 } else {
640 $gsystem = (string) $this->packageId;
641 }
642
643 return $gsystem;
644 }

References $data, $DIC, $ilDB, and $res.

Referenced by getConfigForPlayer().

+ Here is the caller graph for this function:

◆ getStructureFlat()

ilSCORM13PlayerGUI::getStructureFlat ( array  $data)
private

Definition at line 2068 of file class.ilSCORM13PlayerGUI.php.

2068 : void
2069 {
2070 foreach ($data as $i => $value) {
2071 $element = array();
2072 $element['title'] = $value['title'];
2073 $element['id'] = $value['id'];
2074 if ($value['sco'] == 1) {
2075 $element['sco'] = "sco";
2076 } else {
2077 $element['sco'] = "asset";
2078 }
2079 if ($value['href'] != null) {
2080 $this->flat_structure[] = $element;
2081 }
2082 if (isset($value['item']) && $value['item'] != null) {
2083 $this->getStructureFlat($value['item']);
2084 }
2085 }
2086 }

References $data.

◆ getSuspendData()

ilSCORM13PlayerGUI::getSuspendData ( )

Definition at line 671 of file class.ilSCORM13PlayerGUI.php.

671 : void
672 {
673 $suspend_data = $this->getSuspendDataInit();
674 if ($this->jsMode) {
675 header('Content-Type: text/javascript; charset=UTF-8');
676 print($suspend_data);
677 } else {
678 header('Content-Type: text/plain; charset=UTF-8');
679 $suspend_data = json_decode($suspend_data);
680 print_r($suspend_data);
681 }
682 }

References getSuspendDataInit(), and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuspendDataInit()

ilSCORM13PlayerGUI::getSuspendDataInit ( )

Definition at line 646 of file class.ilSCORM13PlayerGUI.php.

646 : string
647 {
648 global $DIC;
649 $ilDB = $DIC->database();
650 $ilUser = $DIC->user();
651
652 $res = $ilDB->queryF(
653 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
654 array('integer', 'integer'),
655 array($this->packageId, $ilUser->getId())
656 );
657 $data = $ilDB->fetchAssoc($res);
658
659 //delete delivered suspend data
660 $ilDB->manipulateF(
661 'DELETE FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
662 array('integer', 'integer'),
663 array($this->packageId, $ilUser->getId())
664 );
665 if (is_array($data)) {
666 return $data['data'];
667 }
668 return "";
669 }

References $data, $DIC, $ilDB, and $res.

Referenced by getPlayer(), and getSuspendData().

+ Here is the caller graph for this function:

◆ increase_attemptAndsave_module_version()

ilSCORM13PlayerGUI::increase_attemptAndsave_module_version ( )

Increases attempts by one and saves module_version for this package.

Definition at line 1289 of file class.ilSCORM13PlayerGUI.php.

1289 : void
1290 {
1291 global $DIC;
1292 $ilDB = $DIC->database();
1293 $ilUser = $DIC->user();
1294 $res = $ilDB->queryF(
1295 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
1296 array('integer','integer'),
1297 array($this->slm->getId(),$ilUser->getId())
1298 );
1299 $val_rec = $ilDB->fetchAssoc($res);
1300 if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
1301 $attempts = 1;
1302 $ilDB->manipulateF(
1303 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
1304 array('integer', 'integer', 'integer', 'integer', 'timestamp'),
1305 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'))
1306 );
1307 } else {
1308 $attempts = $val_rec["package_attempts"];
1309 if ($attempts == null) {
1310 $attempts = 0;
1311 }
1312 $attempts++;
1313 $ilDB->manipulateF(
1314 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
1315 array('integer', 'integer', 'timestamp', 'integer', 'integer'),
1316 array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId())
1317 );
1318 }
1319 }

References $DIC, $ilDB, $res, and ILIAS\UI\examples\Symbol\Glyph\Date\date().

Referenced by getPlayer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ liveLogContent()

ilSCORM13PlayerGUI::liveLogContent ( )

Definition at line 1665 of file class.ilSCORM13PlayerGUI.php.

1665 : void
1666 {
1667 header('Content-Type: text/html; charset=UTF-8');
1668 print file_get_contents($this->logFileName() . ".html");
1669 }

References ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logDirectory()

ilSCORM13PlayerGUI::logDirectory ( )
private

Definition at line 1589 of file class.ilSCORM13PlayerGUI.php.

1589 : string
1590 {
1591 // $logDir=ilUtil::getDataDir()."/SCORMlogs"."/lm_".$this->packageId;
1592 // if (!file_exists($logDir)) ilUtil::makeDirParents($logDir);
1593 $logDir = $this->slm->getDataDirectory() . "/logs";
1594 if (!file_exists($logDir)) {
1595 ilFileUtils::makeDir($logDir);
1596 }
1597 return $logDir;
1598 }
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ logFileName()

ilSCORM13PlayerGUI::logFileName ( )
private

Definition at line 1420 of file class.ilSCORM13PlayerGUI.php.

1420 : string
1421 {
1422 global $DIC;
1423 $lng = $DIC->language();
1424 $lng->loadLanguageModule("scormdebug");
1425
1426 $filename = $this->logDirectory() . "/" . $this->packageId . "_" . $this->get_actual_attempts();
1427 $path_csv = $filename . ".csv";
1428 $path_txt = $filename . ".html";
1429 if (!file_exists($path_csv)) {
1430 umask(0000);
1431 $fHandle = fopen($path_csv, 'a') or die("can't open file");
1432 $string = '"CourseId";"ScoId";"ScoTitle";"Timestamp";"Action";"Key";"Value";"Return Value";"Errorcode";"Timespan";"ErrorDescription"' . "\n";
1433 fwrite($fHandle, $string);
1434 fclose($fHandle);
1435 }
1436 if (!file_exists($path_txt)) {
1437 if (file_exists($this->logTmpName())) {
1438 unlink($this->logTmpName());
1439 }
1440 umask(0000);
1441 $fHandle2 = fopen($path_txt, 'a') or die("can't open file");
1442 $logtpl = $this->getLogTemplate();
1443 $logtpl->setCurrentBlock('NewLog');
1444 $logtpl->setVariable("COURSETITLE", $this->slm->getTitle());
1445 $logtpl->setVariable("COURSEID", $this->packageId);
1446 $logtpl->setVariable("TIMESTAMP", date("d.m.Y H:i", time()));
1447 $logtpl->setVariable("SESSION", $this->get_actual_attempts());
1448 $logtpl->setVariable("error0", $lng->txt("error0"));
1449 $logtpl->setVariable("error101", $lng->txt("error101"));
1450 $logtpl->setVariable("error102", $lng->txt("error102"));
1451 $logtpl->setVariable("error103", $lng->txt("error103"));
1452 $logtpl->setVariable("error104", $lng->txt("error104"));
1453 $logtpl->setVariable("error111", $lng->txt("error111"));
1454 $logtpl->setVariable("error112", $lng->txt("error112"));
1455 $logtpl->setVariable("error113", $lng->txt("error113"));
1456 $logtpl->setVariable("error122", $lng->txt("error122"));
1457 $logtpl->setVariable("error123", $lng->txt("error123"));
1458 $logtpl->setVariable("error132", $lng->txt("error132"));
1459 $logtpl->setVariable("error133", $lng->txt("error133"));
1460 $logtpl->setVariable("error142", $lng->txt("error142"));
1461 $logtpl->setVariable("error143", $lng->txt("error143"));
1462 $logtpl->setVariable("error201", $lng->txt("error201"));
1463 $logtpl->setVariable("error301", $lng->txt("error301"));
1464 $logtpl->setVariable("error351", $lng->txt("error351"));
1465 $logtpl->setVariable("error391", $lng->txt("error391"));
1466 $logtpl->setVariable("error401", $lng->txt("error401"));
1467 $logtpl->setVariable("error402", $lng->txt("error402"));
1468 $logtpl->setVariable("error403", $lng->txt("error403"));
1469 $logtpl->setVariable("error404", $lng->txt("error404"));
1470 $logtpl->setVariable("error405", $lng->txt("error405"));
1471 $logtpl->setVariable("error406", $lng->txt("error406"));
1472 $logtpl->setVariable("error407", $lng->txt("error407"));
1473 $logtpl->setVariable("error408", $lng->txt("error408"));
1474 $logtpl->setVariable("SetValue", $lng->txt("SetValue"));
1475 $logtpl->setVariable("GetValue", $lng->txt("GetValue"));
1476 $logtpl->setVariable("Commit", $lng->txt("Commit"));
1477 $logtpl->setVariable("Initialize", $lng->txt("Initialize"));
1478 $logtpl->setVariable("Terminate", $lng->txt("Terminate"));
1479 $logtpl->setVariable("GetErrorString", $lng->txt("GetErrorString"));
1480 $logtpl->setVariable("GetLastError", $lng->txt("GetLastError"));
1481 $logtpl->setVariable("GetDiagnostic", $lng->txt("GetDiagnostic"));
1482 $logtpl->setVariable("cmi._version", $lng->txt("cmi._version"));
1483 $logtpl->setVariable("cmi.comments_from_learner._children", $lng->txt("cmi.comments_from_learner._children"));
1484 $logtpl->setVariable("cmi.comments_from_learner._count", $lng->txt("cmi.comments_from_learner._count"));
1485 $logtpl->setVariable("cmi.comments_from_learner.n.comment", $lng->txt("cmi.comments_from_learner.n.comment"));
1486 $logtpl->setVariable("cmi.comments_from_learner.n.location", $lng->txt("cmi.comments_from_learner.n.location"));
1487 $logtpl->setVariable("cmi.comments_from_learner.n.timestamp", $lng->txt("cmi.comments_from_learner.n.timestamp"));
1488 $logtpl->setVariable("cmi.comments_from_lms._children", $lng->txt("cmi.comments_from_lms._children"));
1489 $logtpl->setVariable("cmi.comments_from_lms._count", $lng->txt("cmi.comments_from_lms._count"));
1490 $logtpl->setVariable("cmi.comments_from_lms.n.comment", $lng->txt("cmi.comments_from_lms.n.comment"));
1491 $logtpl->setVariable("cmi.comments_from_lms.n.location", $lng->txt("cmi.comments_from_lms.n.location"));
1492 $logtpl->setVariable("cmi.comments_from_lms.n.timestamp", $lng->txt("cmi.comments_from_lms.n.timestamp"));
1493 $logtpl->setVariable("cmi.completion_status", $lng->txt("cmi.completion_status"));
1494 $logtpl->setVariable("cmi.completion_threshold", $lng->txt("cmi.completion_threshold"));
1495 $logtpl->setVariable("cmi.credit", $lng->txt("cmi.credit"));
1496 $logtpl->setVariable("cmi.entry", $lng->txt("cmi.entry"));
1497 $logtpl->setVariable("cmi.exit", $lng->txt("cmi.exit"));
1498 $logtpl->setVariable("cmi.interactions._children", $lng->txt("cmi.interactions._children"));
1499 $logtpl->setVariable("cmi.interactions._count", $lng->txt("cmi.interactions._count"));
1500 $logtpl->setVariable("cmi.interactions.n.id", $lng->txt("cmi.interactions.n.id"));
1501 $logtpl->setVariable("cmi.interactions.n.type", $lng->txt("cmi.interactions.n.type"));
1502 $logtpl->setVariable("cmi.interactions.n.objectives._count", $lng->txt("cmi.interactions.n.objectives._count"));
1503 $logtpl->setVariable("cmi.interactions.n.objectives.n.id", $lng->txt("cmi.interactions.n.objectives.n.id"));
1504 $logtpl->setVariable("cmi.interactions.n.timestamp", $lng->txt("cmi.interactions.n.timestamp"));
1505 $logtpl->setVariable("cmi.interactions.n.correct_responses._count", $lng->txt("cmi.interactions.n.correct_responses._count"));
1506 $logtpl->setVariable("cmi.interactions.n.correct_responses.n.pattern", $lng->txt("cmi.interactions.n.correct_responses.n.pattern"));
1507 $logtpl->setVariable("cmi.interactions.n.weighting", $lng->txt("cmi.interactions.n.weighting"));
1508 $logtpl->setVariable("cmi.interactions.n.learner_response", $lng->txt("cmi.interactions.n.learner_response"));
1509 $logtpl->setVariable("cmi.interactions.n.result", $lng->txt("cmi.interactions.n.result"));
1510 $logtpl->setVariable("cmi.interactions.n.latency", $lng->txt("cmi.interactions.n.latency"));
1511 $logtpl->setVariable("cmi.interactions.n.description", $lng->txt("cmi.interactions.n.description"));
1512 $logtpl->setVariable("cmi.launch_data", $lng->txt("cmi.launch_data"));
1513 $logtpl->setVariable("cmi.learner_id", $lng->txt("cmi.learner_id"));
1514 $logtpl->setVariable("cmi.learner_name", $lng->txt("cmi.learner_name"));
1515 $logtpl->setVariable("cmi.learner_preference._children", $lng->txt("cmi.learner_preference._children"));
1516 $logtpl->setVariable("cmi.learner_preference.audio_level", $lng->txt("cmi.learner_preference.audio_level"));
1517 $logtpl->setVariable("cmi.learner_preference.language", $lng->txt("cmi.learner_preference.language"));
1518 $logtpl->setVariable("cmi.learner_preference.delivery_speed", $lng->txt("cmi.learner_preference.delivery_speed"));
1519 $logtpl->setVariable("cmi.learner_preference.audio_captioning", $lng->txt("cmi.learner_preference.audio_captioning"));
1520 $logtpl->setVariable("cmi.location", $lng->txt("cmi.location"));
1521 $logtpl->setVariable("cmi.max_time_allowed", $lng->txt("cmi.max_time_allowed"));
1522 $logtpl->setVariable("cmi.mode", $lng->txt("cmi.mode"));
1523 $logtpl->setVariable("cmi.objectives._children", $lng->txt("cmi.objectives._children"));
1524 $logtpl->setVariable("cmi.objectives._count", $lng->txt("cmi.objectives._count"));
1525 $logtpl->setVariable("cmi.objectives.n.id", $lng->txt("cmi.objectives.n.id"));
1526 $logtpl->setVariable("cmi.objectives.n.score._children", $lng->txt("cmi.objectives.n.score._children"));
1527 $logtpl->setVariable("cmi.objectives.n.score.scaled", $lng->txt("cmi.objectives.n.score.scaled"));
1528 $logtpl->setVariable("cmi.objectives.n.score.raw", $lng->txt("cmi.objectives.n.score.raw"));
1529 $logtpl->setVariable("cmi.objectives.n.score.min", $lng->txt("cmi.objectives.n.score.min"));
1530 $logtpl->setVariable("cmi.objectives.n.score.max", $lng->txt("cmi.objectives.n.score.max"));
1531 $logtpl->setVariable("cmi.objectives.n.success_status", $lng->txt("cmi.objectives.n.success_status"));
1532 $logtpl->setVariable("cmi.objectives.n.completion_status", $lng->txt("cmi.objectives.n.completion_status"));
1533 $logtpl->setVariable("cmi.objectives.n.progress_measure", $lng->txt("cmi.objectives.n.progress_measure"));
1534 $logtpl->setVariable("cmi.objectives.n.description", $lng->txt("cmi.objectives.n.description"));
1535 $logtpl->setVariable("cmi.progress_measure", $lng->txt("cmi.progress_measure"));
1536 $logtpl->setVariable("cmi.scaled_passing_score", $lng->txt("cmi.scaled_passing_score"));
1537 $logtpl->setVariable("cmi.score._children", $lng->txt("cmi.score._children"));
1538 $logtpl->setVariable("cmi.score.scaled", $lng->txt("cmi.score.scaled"));
1539 $logtpl->setVariable("cmi.score.raw", $lng->txt("cmi.score.raw"));
1540 $logtpl->setVariable("cmi.score.min", $lng->txt("cmi.score.min"));
1541 $logtpl->setVariable("cmi.score.max", $lng->txt("cmi.score.max"));
1542 $logtpl->setVariable("cmi.session_time", $lng->txt("cmi.session_time"));
1543 $logtpl->setVariable("cmi.success_status", $lng->txt("cmi.success_status"));
1544 $logtpl->setVariable("cmi.suspend_data", $lng->txt("cmi.suspend_data"));
1545 $logtpl->setVariable("cmi.time_limit_action", $lng->txt("cmi.time_limit_action"));
1546 $logtpl->setVariable("cmi.total_time", $lng->txt("cmi.total_time"));
1547 $logtpl->setVariable("adl.nav.request", $lng->txt("adl.nav.request"));
1548 $logtpl->setVariable("adl.nav.request_valid.continue", $lng->txt("adl.nav.request_valid.continue"));
1549 $logtpl->setVariable("adl.nav.request_valid.previous", $lng->txt("adl.nav.request_valid.previous"));
1550 $logtpl->setVariable("adl.nav.request_valid.choice", $lng->txt("adl.nav.request_valid.choice"));
1551 $logtpl->setVariable("i_green", $lng->txt("i_green"));
1552 $logtpl->setVariable("i_red", $lng->txt("i_red"));
1553 $logtpl->setVariable("i_orange", $lng->txt("i_orange"));
1554 $logtpl->setVariable("i_fuchsia", $lng->txt("i_fuchsia"));
1555 $logtpl->setVariable("i_gray", $lng->txt("i_gray"));
1556 $logtpl->setVariable("error", $lng->txt("error"));
1557 $logtpl->setVariable("strange_error", $lng->txt("strange_error"));
1558 $logtpl->setVariable("strange_API-Call", $lng->txt("strange_API-Call"));
1559 $logtpl->setVariable("unknown", $lng->txt("unknown"));
1560 $logtpl->setVariable("undefined_color", $lng->txt("undefined_color"));
1561 $logtpl->setVariable("description_for", $lng->txt("description_for"));
1562 $logtpl->setVariable("hide", $lng->txt("hide"));
1563 $logtpl->setVariable("all_API-calls_shown", $lng->txt("all_API-calls_shown"));
1564 $logtpl->setVariable("show_only_important_API-calls", $lng->txt("show_only_important_API-calls"));
1565 $logtpl->setVariable("only_important_API-Calls_shown", $lng->txt("only_important_API-Calls_shown"));
1566 $logtpl->setVariable("show_all_API-calls", $lng->txt("show_all_API-calls"));
1567 $logtpl->setVariable("log_for", $lng->txt("log_for"));
1568 $logtpl->setVariable("started", $lng->txt("started"));
1569 $logtpl->setVariable("nr_session", $lng->txt("nr_session"));
1570 $logtpl->setVariable("id_learning_module", $lng->txt("id_learning_module"));
1571 if ($this->slm->getCheck_values() == false) {
1572 $logtpl->setVariable("CHECK_VALUES", $lng->txt("sent_values_not_checked"));
1573 }
1574 $logtpl->parseCurrentBlock();
1575 fwrite($fHandle2, $logtpl->get());
1576 fclose($fHandle2);
1577 }
1578 return $filename;
1579 }
continue
if(!file_exists('../ilias.ini.php'))

References $DIC, $filename, $lng, and ILIAS\UI\examples\Symbol\Glyph\Date\date().

+ Here is the call graph for this function:

◆ logTmpName()

ilSCORM13PlayerGUI::logTmpName ( )
private

Definition at line 1387 of file class.ilSCORM13PlayerGUI.php.

1387 : string
1388 {
1389 $filename = $this->logDirectory() . "/" . $this->packageId . ".tmp";
1390 if (!file_exists($filename)) {
1391 umask(0000);
1392 $fHandle = fopen($filename, 'a') or die("can't open file");
1393 fwrite($fHandle, "");
1394 fclose($fHandle);
1395 }
1397 }
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'vtt', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $filename.

◆ openLog()

ilSCORM13PlayerGUI::openLog ( )

Definition at line 1600 of file class.ilSCORM13PlayerGUI.php.

1600 : void
1601 {
1602 global $DIC;
1603 $filename = ilUtil::stripSlashes($DIC->http()->wrapper()->query()->retrieve('logFile', $DIC->refinery()->kindlyTo()->string()));
1604 $filename = str_replace('/', '', $filename);
1605 //Header
1606 header('Content-Type: text/html; charset=UTF-8');
1607 echo file_get_contents($this->logDirectory() . "/" . $filename);
1608 exit;
1609 }

References $DIC, $filename, exit, ILIAS\UI\examples\Symbol\Glyph\Header\header(), and ilUtil\stripSlashes().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pingSession()

ilSCORM13PlayerGUI::pingSession ( )

Definition at line 613 of file class.ilSCORM13PlayerGUI.php.

613 : void
614 {
615 if (!$this->slm->hasContainerResource()) {
616 ilWACSignedPath::signFolderOfStartFile($this->getDataDirectory() . '/imsmanifest.xml');
617 }
618 //do nothing except returning header
619 header('Content-Type: text/plain; charset=UTF-8');
620 print("");
621 }

References getDataDirectory(), ILIAS\UI\examples\Symbol\Glyph\Header\header(), and ilWACSignedPath\signFolderOfStartFile().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postLogEntry()

ilSCORM13PlayerGUI::postLogEntry ( )

Definition at line 1752 of file class.ilSCORM13PlayerGUI.php.

1752 : void
1753 {
1754 global $DIC;
1755 $ilLog = ilLoggerFactory::getLogger('sc13');
1756 $lng = $DIC->language();
1757 $lng->loadLanguageModule("scormdebug");
1758
1759 $logdata = json_decode(file_get_contents('php://input'));
1760 $filename = $this->logFileName();
1761 $tmp_name = $this->logTmpName();
1762
1763 $fh_txt = fopen($filename . ".html", 'a') or die("can't open txt file");
1764 $fh_csv = fopen($filename . ".csv", 'a') or die("can't open csv file");
1765 $fh_tmp = fopen($tmp_name, 'r') or die("can't open tmp file");
1766
1767 //init tmp file
1768 if (filesize($tmp_name) > 0) {
1769 $tmp_content = unserialize(fread($fh_tmp, filesize($tmp_name)));//Check Options - This may causes security issues if the serialized classess arent specified.
1770 } else {
1771 $tmp_content = null;
1772 }
1773
1774 fclose($fh_tmp);
1775
1776 $timestamp = date("d.m.Y H:i", time());
1777
1778 if ($logdata->action != "SUMMARY") {
1779 //reopen for writing
1780 $fh_tmp2 = fopen($tmp_name, 'w') or die("can't open tmp file");
1781
1782 //write tmp
1783 $tmp_content[$logdata->scoid][$logdata->key]['value'] = $logdata->value;
1784 $tmp_content[$logdata->scoid][$logdata->key]['status'] = $logdata->result;
1785 $tmp_content[$logdata->scoid][$logdata->key]['action'] = $logdata->action;
1786
1787 fwrite($fh_tmp2, serialize($tmp_content));
1788 fclose($fh_tmp2);
1789
1790 $errorcode = (int) $logdata->errorcode;
1791 $fixedFailure = false;
1792 $toleratedFailure = false;
1793 $extraErrorDescription = "";
1794 if ($errorcode == 200000) {
1795 $errorcode = 0;
1796 $toleratedFailure = true;
1797 $extraErrorDescription = "tolerated failure";
1798 }
1799 if ($errorcode > 99999) {
1800 $errorcode -= 100000;
1801 $fixedFailure = true;
1802 $extraErrorDescription = " failure corrected by ILIAS";
1803 }
1804 if (strpos($logdata->action, "ANALYZE") === false) {
1805 $errorDescriptions = array("0" => "",
1806 "101" => "General Exeption",
1807 "102" => "General Initialization Failure",
1808 "103" => "Already Initialized",
1809 "104" => "Content Instance Terminated",
1810 "111" => "General Termination Failure",
1811 "112" => "Termination Before Initialization",
1812 "113" => "Termination After Termination",
1813 "122" => "Retrieve Data Before Initialization",
1814 "123" => "Retrieve Data After Termination",
1815 "132" => "Store Data Before Initialization",
1816 "133" => "Store Data After Termination",
1817 "142" => "Commit Before Initialization",
1818 "143" => "Commit After Termination",
1819 "201" => "General Argument Error",
1820 "301" => "General Get Failure",
1821 "351" => "General Set Failure",
1822 "391" => "General Commit Failure",
1823 "401" => "Undefined Data Model Element",
1824 "402" => "Unimplemented Data Model Element",
1825 "403" => "Data Model Element Value Not Initialized",
1826 "404" => "Data Model Element Is Read Only",
1827 "405" => "Data Model Element Is Write Only",
1828 "406" => "Data Model Element Type Mismatch",
1829 "407" => "Data Model Element Value Out Of Range",
1830 "408" => "Data Model Dependency Not Established"
1831 );
1832 $csv_string = $this->packageId . ';"'
1833 . $logdata->scoid . '";"'
1834 . $logdata->scotitle . '";'
1835 . date("d.m.Y H:i", time()) . ';"'
1836 . $logdata->action . '";"'
1837 . $logdata->key . '";"'
1838 . str_replace("\"", "\"\"", $logdata->value) . '";"'
1839 . str_replace("\"", "\"\"", $logdata->result) . '";'
1840 . $errorcode . ';'
1841 . $logdata->timespan . ';"'
1842 . $errorDescriptions[(string) $errorcode] . $extraErrorDescription . '"' . "\n";
1843 fwrite($fh_csv, $csv_string);
1844 }
1845 }
1846
1847 $sqlwrite = false;
1848 if ($logdata->action === "Commit" || $logdata->action === "Terminate") {
1849 $sqlwrite = true;
1850 $sql_data = $this->getNodeData($logdata->scoid);
1851 if (count($sql_data) != 0) {
1852 foreach ($sql_data as $key => $value) {
1853 $sql_string = $this->packageId . ';"'
1854 . $logdata->scoid . '";"'
1855 . $logdata->scotitle . '";'
1856 . $timestamp . ';"SQL";"'
1857 . $key . '";"'
1858 . str_replace("\"", "\"\"", (string) $value) . '";;;;' . "\n";
1859 fwrite($fh_csv, $sql_string);
1860 }
1861 }
1862 }
1863
1864 //delete files
1865 if ($logdata->action === "DELETE") {
1866 $filename = $logdata->value;
1867 $filename = str_replace('/', '', $filename);
1868 $path = $this->logDirectory() . "/" . $filename;
1869 unlink($path);
1870 return;
1871 }
1872
1873 //write TXT
1874 $logtpl = $this->getLogTemplate();
1875 $color = "red";
1876 $importantkey = 1;
1877 $ArGetValues = array('comments_from_lms','completion_threshold','credit','entry','launch_data','learner_id','learner_name','max_time_allowed','mode','scaled_passing_score','time_limit_action','total_time');
1878
1879 switch ($logdata->action) {
1880 case 'SetValue':
1881 if ($logdata->result === "true" && $errorcode == 0) {
1882 $color = "green";
1883 }
1884 if ($color === "green" && $logdata->key === "cmi.exit" && $logdata->value !== "suspend") {
1885 $color = "orange";
1886 }
1887 if ($fixedFailure == false && $errorcode != 406) {
1888 $logdata->value = '"' . $logdata->value . '"';
1889 }
1890 if ($toleratedFailure == true) {
1891 $color = "fuchsia";
1892 }
1893 if ($fixedFailure == true) {
1894 $color = "gray";
1895 }
1896 break;
1897 case 'GetValue':
1898 if ($errorcode == 0) {
1899 $color = "green";
1900 }
1901 break;
1902 case 'Initialize':
1903 if ($errorcode == 0) {
1904 $color = "green";
1905 $logtpl->setCurrentBlock("InitializeStart");
1906 $logtpl->setVariable("SCO-title", $lng->txt("SCO-title"));
1907 $logtpl->setVariable("SCO_TITLE", $logdata->scotitle);
1908 $logtpl->setVariable("SCO-name", $lng->txt("SCO-name"));
1909 $logtpl->setVariable("SCO_NAME", $logdata->scoid);
1910 $logtpl->setVariable("started", $lng->txt("started"));
1911 $logtpl->setVariable("TIMESTAMP", $timestamp);
1912 $logtpl->setVariable("milliseconds", $lng->txt("milliseconds"));
1913 $logtpl->setVariable("API-call", $lng->txt("API-call"));
1914 $logtpl->setVariable("return_value", $lng->txt("return_value"));
1915 $logtpl->setVariable("error", $lng->txt("error"));
1916 $logtpl->parseCurrentBlock();
1917 }
1918 break;
1919 case 'Commit':
1920 if ($errorcode == 0) {
1921 $color = "green";
1922 }
1923 if ($fixedFailure == true) {
1924 $color = "gray";
1925 }
1926 break;
1927 case 'Terminate':
1928 if ($errorcode == 0) {
1929 $color = "green";
1930 }
1931 break;
1932 case 'GetErrorString':
1933 $importantkey = 0;
1934 if ($errorcode == 0) {
1935 $color = "green";
1936 }
1937 break;
1938 case 'GetLastError':
1939 $logtpl->setCurrentBlock("GetLastError");
1940 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1941 $logtpl->setVariable("RESULT", $logdata->result);
1942 $logtpl->parseCurrentBlock();
1943 break;
1944 case 'GetDiagnostic':
1945 $logtpl->setCurrentBlock("GetDiagnostic");
1946 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1947 $logtpl->setVariable("KEY", $logdata->key);
1948 $logtpl->setVariable("RESULT", $logdata->result);
1949 $logtpl->parseCurrentBlock();
1950 break;
1951 case 'INFO':
1952 $logtpl->setCurrentBlock("INFO");
1953 $logtpl->setVariable("hint", $lng->txt("hint"));
1954 $logtpl->setVariable("KEY", $lng->txt($logdata->key));
1955 $logtpl->setVariable("VALUE", $logdata->value);
1956 $logtpl->parseCurrentBlock();
1957 break;
1958 case 'COMMENT':
1959 $logtpl->setCurrentBlock("COMMENT");
1960 $logtpl->setVariable("comment", $lng->txt("comment"));
1961 $logtpl->setVariable("generated", $lng->txt("generated"));
1962 $logtpl->setVariable("TIMESTAMP", $timestamp);
1963 $logtpl->setVariable("VALUE", $logdata->value);
1964 $logtpl->parseCurrentBlock();
1965 break;
1966 case 'ANALYZE':
1967 $logtpl->setCurrentBlock("ANALYZE");
1968 if (count($logdata->value) == 0) {
1969 $color = "green";
1970 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("no_missing_API-calls"));
1971 $logtpl->setVariable("VALUE", "");
1972 } else {
1973 $tmpvalue = "SetValue(\"" . implode("\", ... ),<br/>SetValue(\"", $logdata->value) . "\", ... )";
1974 foreach ($ArGetValues as $value) {
1975 $tmpvalue = str_replace("SetValue(\"cmi." . $value . "\", ... )", "GetValue(\"cmi." . $value . "\")", $tmpvalue);
1976 }
1977 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("missing_API-calls"));
1978 $logtpl->setVariable("VALUE", $tmpvalue);
1979 }
1980 $logtpl->setVariable("summary_for_SCO_without_test", $lng->txt("summary_for_SCO_without_test"));
1981 $logtpl->setVariable("generated", $lng->txt("generated"));
1982 $logtpl->setVariable("TIMESTAMP", $timestamp);
1983 $logtpl->setVariable("COLOR", $color);
1984 $logtpl->parseCurrentBlock();
1985 break;
1986 case 'ANALYZETEST':
1987 $logtpl->setCurrentBlock("ANALYZETEST");
1988 if (count($logdata->value) == 0) {
1989 $color = "green";
1990 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("no_missing_API-calls"));
1991 $logtpl->setVariable("VALUE", "");
1992 } else {
1993 $tmpvalue = "SetValue(\"" . implode("\", ... ),<br/>SetValue(\"", $logdata->value) . "\", ... )";
1994 foreach ($ArGetValues as $value) {
1995 $tmpvalue = str_replace("SetValue(\"cmi." . $value . "\", ... )", "GetValue(\"cmi." . $value . "\")", $tmpvalue);
1996 }
1997 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("missing_API-calls"));
1998 $logtpl->setVariable("VALUE", $tmpvalue);
1999 }
2000 $logtpl->setVariable("summary_for_SCO_with_test", $lng->txt("summary_for_SCO_with_test"));
2001 $logtpl->setVariable("generated", $lng->txt("generated"));
2002 $logtpl->setVariable("TIMESTAMP", $timestamp);
2003 $logtpl->setVariable("COLOR", $color);
2004 $logtpl->parseCurrentBlock();
2005 break;
2006 case 'SUMMARY':
2007 $logtpl->setCurrentBlock("SUMMARY");
2008 $logtpl->setVariable("summary_csv", $lng->txt("summary_csv"));
2009 $logtpl->setVariable("TIMESTAMP", $timestamp);
2010 $logtpl->setVariable("summary_download", $lng->txt("summary_download"));
2011 $logtpl->parseCurrentBlock();
2012 break;
2013 default:
2014 $importantkey = 0;
2015 $color = "orange";
2016 break;
2017 }
2018 if ($logdata->action === 'SetValue' || $logdata->action === 'GetValue') {
2019 $logtpl->setCurrentBlock($logdata->action);
2020 $logtpl->setVariable("ACTION", $logdata->action);
2021 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
2022 $logtpl->setVariable("KEY", $logdata->key);
2023 $logtpl->setVariable("VALUE", $logdata->value);
2024 $logtpl->setVariable("RESULT", $logdata->result);
2025 $logtpl->setVariable("ERRORCODE", $errorcode);
2026 $debugfields = $this->getDebugValues(true);
2027 $importantkey = 0;
2028 foreach ($debugfields as $value) {
2029 if ($logdata->key == $value) {
2030 $importantkey = 1;
2031 }
2032 }
2033 $logtpl->setVariable("IMPORTANTKEY", "" . $importantkey);
2034 $logtpl->setVariable("COLOR", $color);
2035 $logtpl->parseCurrentBlock();
2036 } elseif ($logdata->action !== 'INFO' && $logdata->action !== 'ANALYZE' && $logdata->action !== 'ANALYZETEST' && $logdata->action !== 'SUMMARY' && $logdata->action !== 'COMMENT' && $logdata->action !== 'GetDiagnostic' && $logdata->action !== 'GetLastError') {
2037 $logtpl->setCurrentBlock("defaultCall");
2038 $logtpl->setVariable("ACTION", $logdata->action);
2039 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
2040 $logtpl->setVariable("KEY", $logdata->key);
2041 $logtpl->setVariable("VALUE", $logdata->value);
2042 $logtpl->setVariable("RESULT", $logdata->result);
2043 $logtpl->setVariable("ERRORCODE", $errorcode);
2044 $logtpl->setVariable("IMPORTANTKEY", "" . $importantkey);
2045 $logtpl->setVariable("COLOR", $color);
2046 $logtpl->parseCurrentBlock();
2047 }
2048
2049 /*
2050 if ($sqlwrite == true) {
2051 $ilLog->write("SQL WRITE");
2052 $logtpl->setCurrentBlock("SqlLog");
2053 $logtpl->setVariable("SQL_STRING", $sql_text);
2054 $logtpl->parseCurrentBlock();
2055 }
2056 */
2057
2058 //create summary
2059 if ($logdata->action === "SUMMARY") {
2060 $this->createSummary($tmp_content);
2061 }
2062
2063 fwrite($fh_txt, $logtpl->get());
2064 fclose($fh_txt);
2065 fclose($fh_csv);
2066 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70

References $DIC, $filename, $lng, $timestamp, ILIAS\UI\examples\Symbol\Glyph\Date\date(), ilLoggerFactory\getLogger(), if, and ILIAS\Repository\int().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quoteJSONArray()

ilSCORM13PlayerGUI::quoteJSONArray ( ?array  $a_array)
Returns
mixed[]|string[]

Definition at line 1207 of file class.ilSCORM13PlayerGUI.php.

1207 : array
1208 {
1209 global $DIC;
1210 $ilDB = $DIC->database();
1211
1212 if (!is_array($a_array) or !count($a_array)) {
1213 return array("''");
1214 }
1215
1216 foreach ($a_array as $k => $item) {
1217 if ($item != null) {
1218 $a_array[$k] = $ilDB->quote($item);
1219 } else {
1220 $a_array[$k] = "NULL";
1221 }
1222 }
1223
1224 return $a_array;
1225 }

References $DIC, and $ilDB.

◆ readGObjective()

ilSCORM13PlayerGUI::readGObjective ( )

Definition at line 801 of file class.ilSCORM13PlayerGUI.php.

801 : void
802 {
803 $gobjective_data = json_encode($this->readGObjectiveInit());
804 if ($this->jsMode) {
805 header('Content-Type: text/javascript; charset=UTF-8');
806 print($gobjective_data);
807 } else {
808 header('Content-Type: text/plain; charset=UTF-8');
809 $gobjective_data = json_decode($gobjective_data);
810 print_r($gobjective_data);
811 }
812 }

References ILIAS\UI\examples\Symbol\Glyph\Header\header(), and readGObjectiveInit().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readGObjectiveInit()

ilSCORM13PlayerGUI::readGObjectiveInit ( )

Definition at line 716 of file class.ilSCORM13PlayerGUI.php.

716 : array
717 {
718 global $DIC;
719 $ilDB = $DIC->database();
720 $ilUser = $DIC->user();
721
722 //get json string
723 $g_data = [];
724
725 $global_to_system = 1;
726
727 $res = $ilDB->queryF(
728 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
729 array('integer'),
730 array($this->packageId)
731 );
732 while ($data = $ilDB->fetchAssoc($res)) {
733 $global_to_system = $data['global_to_system'];
734 }
735
736 $query = 'SELECT objective_id, scope_id, satisfied, measure, user_id,
737 score_min, score_max, score_raw, completion_status,
738 progress_measure '
739 . 'FROM cmi_gobjective, cp_node, cp_mapinfo '
740 . 'WHERE (cmi_gobjective.objective_id <> %s AND cmi_gobjective.status IS NULL '
741 . 'AND cp_node.slm_id = %s AND cp_node.nodename = %s '
742 . 'AND cp_node.cp_node_id = cp_mapinfo.cp_node_id '
743 . 'AND cmi_gobjective.objective_id = cp_mapinfo.targetobjectiveid) '
744 . 'GROUP BY objective_id, scope_id, satisfied, measure, user_id,
745 score_min, score_max, score_raw, completion_status,
746 progress_measure';
747 $res = $ilDB->queryF(
748 $query,
749 array('text', 'integer', 'text'),
750 array('-course_overall_status-', $this->packageId, 'mapInfo')
751 );
752 while ($row = $ilDB->fetchAssoc($res)) {
753 if (($global_to_system == 1 && $row['scope_id'] == 0) || ($global_to_system == 0 && $row['scope_id'] == $this->packageId)) {
754 $learner = $row['user_id'];
755 $objective_id = $row['objective_id'];
756 if ($row['scope_id'] == 0) {
757 $scope = "null";
758 } else {
759 $scope = $row['scope_id'];
760 }
761
762 if ($row['satisfied'] != null) {
763 $toset = $row['satisfied'];
764 $g_data["satisfied"][$objective_id][$learner][$scope] = $toset;
765 }
766
767 if ($row['measure'] != null) {
768 $toset = $row['measure'];
769 $g_data["measure"][$objective_id][$learner][$scope] = $toset;
770 }
771
772 if ($row['score_raw'] != null) {
773 $toset = $row['score_raw'];
774 $g_data["score_raw"][$objective_id][$learner][$scope] = $toset;
775 }
776
777 if ($row['score_min'] != null) {
778 $toset = $row['score_min'];
779 $g_data["score_min"][$objective_id][$learner][$scope] = $toset;
780 }
781
782 if ($row['score_max'] != null) {
783 $toset = $row['score_max'];
784 $g_data["score_max"][$objective_id][$learner][$scope] = $toset;
785 }
786
787 if ($row['progress_measure'] != null) {
788 $toset = $row['progress_measure'];
789 $g_data["progress_measure"][$objective_id][$learner][$scope] = $toset;
790 }
791
792 if ($row['completion_status'] != null) {
793 $toset = $row['completion_status'];
794 $g_data["completion_status"][$objective_id][$learner][$scope] = $toset;
795 }
796 }
797 }
798 return $g_data;
799 }

References $data, $DIC, $ilDB, and $res.

Referenced by getPlayer(), and readGObjective().

+ Here is the caller graph for this function:

◆ readSharedData()

ilSCORM13PlayerGUI::readSharedData ( int  $sco_node_id)

Definition at line 816 of file class.ilSCORM13PlayerGUI.php.

816 : void
817 {
818 global $DIC;
819 $ilDB = $DIC->database();
820 $ilUser = $DIC->user();
821 $dataStores = array( "data" => array(),
822 "permissions" => array());
823 $readPermissions = array();
824
825 $query = 'SELECT target_id, read_shared_data, write_shared_data '
826 . 'FROM cp_datamap '
827 . 'WHERE slm_id = %s '
828 . 'AND sco_node_id = %s '
829 . 'GROUP BY target_id, read_shared_data, write_shared_data';
830
831
832 $res = $ilDB->queryF(
833 $query,
834 array('integer', 'integer'),
835 array($this->packageId, $sco_node_id)
836 );
837
838 //Pass 1: Get all the shared data target_ids
839 // for this content package
840 while ($row = $ilDB->fetchAssoc($res)) {
841 $storeVal = ($row['read_shared_data'] == 0 && $row['write_shared_data'] == 1)
842 ? 'notWritten'
843 : null;
844
845 $dataStores["data"][$row['target_id']] = array( "store" => $storeVal,
846 "readSharedData" => $row['read_shared_data'],
847 "writeSharedData" => $row['write_shared_data']);
848 $dataStores["readPermissions"][$row['target_id']] = $row['read_shared_data'];
849 }
850
851 if (count($dataStores) < 1) {
852 //If there are no datastores, then return nothing
853 echo "";
854 exit();
855 }
856
857 if (isset($dataStores["readPermissions"]) && $dataStores["readPermissions"] != null && array_sum($dataStores["readPermissions"]) != 0) {
858 //If there exists at least one readSharedData permission, then
859 //fill in the existing values (if any) already in the store.
860
861 //Create the params to add to the Pass 2 query (get existing values)
862 $params = array("types" => array("integer", "integer"),
863 "values" => array($this->userId, $this->packageId));
864
865 $paramTemplate = '';
866
867 //See if readSharedData is set for each datamap.
868 //If set to true, then add it to the search query
869 foreach ($dataStores["data"] as $key => $val) {
870 if ($dataStores["readPermissions"][(string) $key] == 1
871 && $dataStores["data"][(string) $key]["store"] !== 'notWritten') {
872 $params["types"][] = "text";
873 $params["values"][] = $key;
874 $paramTemplate .= '%s, ';
875 }
876 }
877
878 //Get rid of the trailing ', '
879 $paramTemplate = substr($paramTemplate, 0, -2);
880
881 //Pass 2: Query for values previously saved by the user
882 $query = 'SELECT target_id, store '
883 . 'FROM adl_shared_data '
884 . 'WHERE user_id = %s '
885 . 'AND slm_id = %s '
886 . 'AND target_id IN (' . $paramTemplate . ')';
887
888
889 $res = $ilDB->queryF(
890 $query,
891 $params["types"],
892 $params["values"]
893 );
894
895 while ($row = $ilDB->fetchAssoc($res)) {
896 $dataStores["data"][$row['target_id']]["store"] = $row['store'];
897 }
898 }
899
900 header('Content-Type: text/javascript; charset=UTF-8');
901
902 echo json_encode($dataStores["data"]);
903 }

References $DIC, $ilDB, $res, exit, and ILIAS\UI\examples\Symbol\Glyph\Header\header().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetSharedData()

ilSCORM13PlayerGUI::resetSharedData ( )

Definition at line 1321 of file class.ilSCORM13PlayerGUI.php.

1321 : void
1322 {
1323 global $DIC;
1324 $ilDB = $DIC->database();
1325 //Reset the shared data stores if sharedDataGlobalToSystem is false
1326 $res = $ilDB->queryF(
1327 'SELECT shared_data_global_to_system FROM cp_package WHERE obj_id = %s',
1328 array('integer'),
1329 array($this->packageId)
1330 );
1331
1332 $shared_global_to_sys = $ilDB->fetchObject($res)->shared_data_global_to_system ?? 0;
1333
1334 $res = $ilDB->queryF(
1335 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
1336 array('integer', 'integer'),
1337 array($this->packageId, $this->userId)
1338 );
1339
1340 $suspended = false;
1341 while ($data = $ilDB->fetchAssoc($res)) {
1342 $dat = $data['data'];
1343 if ($dat != null && $dat != '') {
1344 $suspended = true;
1345 }
1346 }
1347
1348 if ($shared_global_to_sys == 0 && !$suspended) {
1349 $ilDB->manipulateF(
1350 'DELETE FROM adl_shared_data WHERE slm_id = %s AND user_id = %s',
1351 array('integer', 'integer'),
1352 array($this->packageId, $this->userId)
1353 );
1354 }
1355 }

References $data, $DIC, $ilDB, and $res.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ specialPage()

ilSCORM13PlayerGUI::specialPage ( )

Definition at line 990 of file class.ilSCORM13PlayerGUI.php.

990 : void
991 {
992 global $DIC;
993 $lng = $DIC->language();
994
995 $specialpages = array(
996 "_COURSECOMPLETE_" => "seq_coursecomplete",
997 "_ENDSESSION_" => "seq_endsession",
998 "_SEQBLOCKED_" => "seq_blocked",
999 "_NOTHING_" => "seq_nothing",
1000 "_ERROR_" => "seq_error",
1001 "_DEADLOCK_" => "seq_deadlock",
1002 "_INVALIDNAVREQ_" => "seq_invalidnavreq",
1003 "_SEQABANDON_" => "seq_abandon",
1004 "_SEQABANDONALL_" => "seq_abandonall",
1005 "_TOC_" => "seq_toc",
1006 "" => ""
1007 );
1008
1009 $this->tpl = new ilGlobalTemplate("tpl.scorm2004.specialpages.html", false, false, "components/ILIAS/Scorm2004");
1010 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1011 $this->tpl->setVariable('TXT_SPECIALPAGE', $lng->txt($specialpages[$this->page]));
1012 if ($this->page !== "_TOC_" && $this->page !== "_SEQABANDON_" && $this->page !== "_SEQABANDONALL_") {
1013 $this->tpl->setVariable('CLOSE_WINDOW', $lng->txt('seq_close'));
1014 } else {
1015 $this->tpl->setVariable('CLOSE_WINDOW', "");
1016 }
1017 $this->tpl->printToStdout("DEFAULT", false);
1018 }

References $DIC, $lng, and ilUtil\getStyleSheetLocation().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ summaryFileName()

ilSCORM13PlayerGUI::summaryFileName ( )
private

Definition at line 1399 of file class.ilSCORM13PlayerGUI.php.

1399 : string
1400 {
1401 $filename = $this->logDirectory() . "/" . $this->packageId . "_summary_" . $this->get_actual_attempts();
1402 $adder = "0";
1403 $suffix = ".csv";
1404 $i = 0;
1405 while (file_exists($filename . "_" . $adder . $suffix)) {
1406 $i++;
1407 $adder = (string) $i;
1408 }
1409 $retname = $filename . "_" . $adder . $suffix;
1410
1411 if (!file_exists($retname)) {
1412 umask(0000);
1413 $fHandle = fopen($retname, 'a') or die("can't open file");
1414 fwrite($fHandle, "");
1415 fclose($fHandle);
1416 }
1417 return $retname;
1418 }

References $filename.

◆ suspendADLActData()

ilSCORM13PlayerGUI::suspendADLActData ( )

Definition at line 684 of file class.ilSCORM13PlayerGUI.php.

684 : void
685 {
686 global $DIC;
687 $ilDB = $DIC->database();
688 $ilUser = $DIC->user();
689
690 $res = $ilDB->queryF(
691 'SELECT * FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
692 array('integer', 'integer'),
693 array($this->packageId, $ilUser->getId())
694 );
695
696 if (!$ilDB->numRows($res)) {
697 $ilDB->insert('cp_suspend', array(
698 'data' => array('clob', file_get_contents('php://input')),
699 'obj_id' => array('integer', $this->packageId),
700 'user_id' => array('integer', $ilUser->getId())
701 ));
702 } else {
703 $ilDB->update(
704 'cp_suspend',
705 array(
706 'data' => array('clob', file_get_contents('php://input'))
707 ),
708 array(
709 'obj_id' => array('integer', $this->packageId),
710 'user_id' => array('integer', $ilUser->getId())
711 )
712 );
713 }
714 }

References $DIC, $ilDB, and $res.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ writeSharedData()

ilSCORM13PlayerGUI::writeSharedData ( int  $sco_node_id)

Definition at line 905 of file class.ilSCORM13PlayerGUI.php.

905 : void
906 {
907 global $DIC;
908 $ilDB = $DIC->database();
909 $ilUser = $DIC->user();
910 $g_data = json_decode(file_get_contents('php://input'));
911
912 if ($g_data == null) {
913 return;
914 }
915
916 //Step 1: Get the writeable stores for this SCO that already have values
917 $query = 'SELECT dm.target_id, sd.store '
918 . 'FROM cp_datamap dm '
919 . 'LEFT JOIN adl_shared_data sd '
920 . 'ON(dm.slm_id = sd.slm_id AND dm.target_id = sd.target_id) '
921 . 'WHERE sco_node_id = %s '
922 . 'AND dm.slm_id = %s '
923 . 'AND write_shared_data = 1 '
924 . 'AND user_id = %s';
925
926 $res = $ilDB->QueryF(
927 $query,
928 array('integer', 'integer', 'integer'),
929 array($sco_node_id, $this->packageId, $this->userId)
930 );
931
932 $dataStores = array();
933 $originalVals = array();
934 while ($row = $ilDB->fetchAssoc($res)) {
935 $id = $row['target_id'];
936 $dataStores[$id] = $g_data->{$id};
937 $originalVals[$id] = $row['store'];
938 }
939
940
941 //Step 2: Add the writeable stores
942 foreach ($g_data as $key => $obj) {
943 //If it's already created in adl_shared_data, we
944 //need to update it.
945 if (array_key_exists($key, $dataStores)) {
946 if ($obj === 'notWritten') {
947 continue;
948 }
949
950 $query = 'UPDATE adl_shared_data '
951 . 'SET store = %s '
952 . 'WHERE user_id = %s '
953 . 'AND target_id = %s '
954 . 'AND slm_id = %s ';
955
956 $ilDB->manipulateF(
957 $query,
958 array('text', 'integer', 'text', 'integer'),
959 array($dataStores[$key], $this->userId, $key, $this->packageId)
960 );
961 } else {
962 //Check for writability
963 $res = $ilDB->queryF(
964 'SELECT write_shared_data, cp_node_id '
965 . 'FROM cp_datamap '
966 . 'WHERE target_id = %s '
967 . 'AND slm_id = %s '
968 . 'AND sco_node_id = %s',
969 array('text', 'integer', 'integer'),
970 array($key, $this->packageId, $sco_node_id)
971 );
972
973 $row = $ilDB->fetchAssoc($res);
974 if ($row["write_shared_data"] != 1) {
975 continue;
976 }
977
978 //If it's writeable, then add the new value into the database
979 $res = $ilDB->manipulateF(
980 'INSERT INTO adl_shared_data (slm_id, user_id, target_id, store, cp_node_id) VALUES (%s, %s, %s, %s, %s)',
981 array('integer', 'integer', 'text', 'text', 'integer'),
982 array($this->packageId, $this->userId, $key, $obj, $row["cp_node_id"])
983 );
984 }
985 }
986 echo "1";
987 exit;
988 }

References $DIC, $id, $ilDB, and $res.

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSCORM13PlayerGUI::$ctrl

Definition at line 144 of file class.ilSCORM13PlayerGUI.php.

◆ $flat_structure

array ilSCORM13PlayerGUI::$flat_structure
private

Definition at line 137 of file class.ilSCORM13PlayerGUI.php.

◆ $jsMode

bool ilSCORM13PlayerGUI::$jsMode

Definition at line 139 of file class.ilSCORM13PlayerGUI.php.

◆ $lng

ilLanguage ilSCORM13PlayerGUI::$lng
protected

Definition at line 145 of file class.ilSCORM13PlayerGUI.php.

Referenced by executeCommand(), and getPlayer().

◆ $packageId

int ilSCORM13PlayerGUI::$packageId

Definition at line 138 of file class.ilSCORM13PlayerGUI.php.

◆ $page

string ilSCORM13PlayerGUI::$page = ""
protected

Definition at line 146 of file class.ilSCORM13PlayerGUI.php.

◆ $ref_id

int ilSCORM13PlayerGUI::$ref_id

Definition at line 143 of file class.ilSCORM13PlayerGUI.php.

◆ $schema

array ilSCORM13PlayerGUI::$schema
staticprivate

Definition at line 41 of file class.ilSCORM13PlayerGUI.php.

◆ $slm

ilObjSCORM2004LearningModule ilSCORM13PlayerGUI::$slm

Definition at line 141 of file class.ilSCORM13PlayerGUI.php.

◆ $tpl

ilGlobalTemplate ilSCORM13PlayerGUI::$tpl

Definition at line 142 of file class.ilSCORM13PlayerGUI.php.

◆ $userId

int ilSCORM13PlayerGUI::$userId
private

Definition at line 136 of file class.ilSCORM13PlayerGUI.php.

◆ ENABLE_GZIP

const ilSCORM13PlayerGUI::ENABLE_GZIP = 0

Definition at line 31 of file class.ilSCORM13PlayerGUI.php.

◆ NONE

const ilSCORM13PlayerGUI::NONE = 0

Definition at line 33 of file class.ilSCORM13PlayerGUI.php.

◆ READONLY

const ilSCORM13PlayerGUI::READONLY = 1

Definition at line 34 of file class.ilSCORM13PlayerGUI.php.

◆ READWRITE

const ilSCORM13PlayerGUI::READWRITE = 3

Definition at line 36 of file class.ilSCORM13PlayerGUI.php.

◆ WRITEONLY

const ilSCORM13PlayerGUI::WRITEONLY = 2

Definition at line 35 of file class.ilSCORM13PlayerGUI.php.


The documentation for this class was generated from the following file: