ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSCORM13Player Class Reference
+ Collaboration diagram for ilSCORM13Player:

Public Member Functions

 __construct ()
 
executeCommand ()
 execute command More...
 
 getRTEjs ()
 
 getDataDirectory ()
 
 getConfigForPlayer ()
 
 getPlayer ()
 
 getCPData ()
 
 getCPDataInit ()
 
 getADLActDataInit ()
 
 getADLActData ()
 
 pingSession ()
 
 getScope ()
 
 getSuspendDataInit ()
 
 getSuspendData ()
 
 suspendADLActData ()
 
 readGObjectiveInit ()
 
 readGObjective ()
 
 readSharedData ($sco_node_id)
 
 writeSharedData ($sco_node_id)
 
 specialPage ()
 
 fetchCMIData ()
 
 getCMIData ($userId, $packageId)
 
 quoteJSONArray ($a_array)
 
 getMimetype ($filename)
 estimate content type for a filename by extension first do it for common static web files from external list if not found peek into file by slow php function mime_content_type() More...
 
 get_max_attempts ()
 Get max. More...
 
 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 ()
 Get inline css. More...
 

Data Fields

const ENABLE_GZIP = 0
 
const NONE = 0
 
const READONLY = 1
 
const WRITEONLY = 2
 
const READWRITE = 3
 
 $packageId
 
 $jsMode
 
 $ilias
 
 $slm
 
 $tpl
 

Private Member Functions

 normalizeFields ($table, &$node)
 maps API data structure type to internal datatype on a node
and accepts only valid values, dropping invalid ones from input
More...
 
 getNodeData ($sco_id, $fh)
 
 logTmpName ()
 
 summaryFileName ()
 
 logFileName ()
 
 logDirectory ()
 
 getLogFileList ($s_delete, $s_download, $s_open)
 
 getLogTemplate ()
 
 getDebugValues ($test_sco=false)
 
 getStructureFlat ($data)
 
 createSummary ($api_data)
 

Private Attributes

 $userId
 

Static Private Attributes

static $schema
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSCORM13Player::__construct ( )

Definition at line 126 of file ilSCORM13Player.php.

127 {
128
129 global $ilias, $tpl, $ilCtrl, $ilUser, $lng;
130
131 //erase next?
132 if ($_REQUEST['learnerId']) {
133 $this->userId = $_REQUEST['learnerId'];
134 } else {
135 $this->userId = $GLOBALS['USER']['usr_id'];
136 }
137 $this->packageId = (int) $_REQUEST['packageId'];
138 $this->jsMode = strpos($_SERVER['HTTP_ACCEPT'], 'text/javascript')!==false;
139
140 $this->page = $_REQUEST['page'];
141
142 $this->slm = new ilObjSCORM2004LearningModule($_GET["ref_id"], true);
143
144
145 $this->ilias = $ilias;
146 $this->tpl = $tpl;
147 $this->ctrl = $ilCtrl;
148
149 $this->packageId=ilObject::_lookupObjectId($_GET['ref_id']);
150 $this->ref_id = $_GET['ref_id'];
151 $this->userId=$ilUser->getID();
152
153 if ($_GET['envEditor'] != null) {
154 $this->envEditor = $_GET['envEditor'];
155 } else {
156 $this->envEditor = 0;
157 }
158
159 }
$_GET["client_id"]
Class ilObjSCORM2004LearningModule.
static _lookupObjectId($a_ref_id)
lookup object id
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $lng
Definition: privfeed.php:17
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$ilUser
Definition: imgupload.php:18

References $_GET, $_SERVER, $GLOBALS, $ilCtrl, $ilias, $ilUser, $lng, $tpl, and ilObject\_lookupObjectId().

+ Here is the call graph for this function:

Member Function Documentation

◆ createSummary()

ilSCORM13Player::createSummary (   $api_data)
private

Definition at line 2008 of file ilSCORM13Player.php.

2009 {
2010 global $ilDB;
2011
2012 $csv_data = null;
2013 //csv columns
2014 $columns_fixed = array('id','title','type','attempted');
2015
2016 $ini_data = parse_ini_file("./Modules/Scorm2004/scripts/rtemain/debug_default.ini",true);
2017 $ini_array = $ini_data['summary'];
2018 $colums_variable = array();
2019 $api_keys = array();
2020
2021 foreach ($ini_array as $key => $value) {
2022 if ($value == 1) {
2023 array_push($colums_variable,$key);
2024 array_push($api_keys,$key);
2025 array_push($colums_variable,"Status");
2026 }
2027 }
2028
2029 $header_array = array_merge($columns_fixed, $colums_variable);
2030
2031 $csv_header = implode(";",$header_array);
2032
2033 //get strcuture
2034 $res = $ilDB->queryF(
2035 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
2036 array('integer'),
2037 array($this->packageId)
2038 );
2039
2040 $packageData = $ilDB->fetchAssoc($res);
2041
2042 $structure = json_decode($packageData['jsdata'],true);
2043
2044
2045 $this->flat_structure = array(); //used for recursion
2046 $this->getStructureFlat($structure['item']['item']);
2047
2048 foreach ($this->flat_structure as $tree_element) {
2049
2050 $csv_data = $csv_data.$tree_element['id'].";".$tree_element['title'].";".$tree_element['sco'].";";
2051 if ($api_data[$tree_element['id']] != null) {
2052 $csv_data = $csv_data."X".";";
2053 } else {
2054 $csv_data = $csv_data.";";
2055 }
2056
2057 //write api data
2058 $id = $tree_element['id'];
2059 foreach ($api_keys as $api_element) {
2060 if ($api_data[$id]!=null) {
2061 if ($api_data[$id][$api_element]!=null) {
2062 $csv_data = $csv_data.$api_data[$id][$api_element]['value'].";".$api_data[$id][$api_element]['status'].";";
2063 } else {
2064 $csv_data = $csv_data.";;";
2065 }
2066 }
2067 }
2068 $csv_data = $csv_data."\n";
2069 }
2070
2071 $fh = fopen($this->summaryFileName(),"w");
2072 fwrite($fh,$csv_header."\n".$csv_data);
2073 fclose($fh);
2074 unlink($this->logTmpName());
2075 }
global $ilDB

References $fh, $ilDB, and $res.

◆ debugGUI()

ilSCORM13Player::debugGUI ( )

Definition at line 1614 of file ilSCORM13Player.php.

1615 {
1616 global $lng;
1617 $lng->loadLanguageModule("scormdebug");
1618
1619/* if ($_POST['password'] == $this->slm->getDebugPw()) {
1620 $_SESSION["debug_pw"] = $this->slm->getDebugPw();
1621 }
1622 if ($_SESSION["debug_pw"]!=$this->slm->getDebugPw()) {
1623 $this->tpl = new ilTemplate("tpl.scorm2004.debug_pw.html", false, false, "./Modules/Scorm2004");
1624 $this->tpl->setVariable('SUBMIT', $lng->txt("debugwindow_submit"));
1625 $this->tpl->setVariable('CANCEL', $lng->txt("debugwindow_cancel"));
1626 $this->tpl->setVariable('PASSWORD_ENTER', $lng->txt("debugwindow_password_enter"));
1627 $this->tpl->setVariable('DEBUG_URL','ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=debugGUI&ref_id='.$_GET["ref_id"]);
1628 } else {*/
1629 $this->tpl = new ilTemplate("tpl.scorm2004.debug.html", false, false, "./Modules/Scorm2004");
1630 $this->tpl->setVariable('CONSOLE', $lng->txt("debugwindow_console"));
1631 $this->tpl->setVariable('LOGS', $lng->txt("debugwindow_logs"));
1632 $this->tpl->setVariable('COMMENT', $lng->txt("debugwindow_comment"));
1633 $this->tpl->setVariable('COMMENT_ENTER', $lng->txt("debugwindow_comment_enter"));
1634 $this->tpl->setVariable('START_RECORDING', $lng->txt("debugwindow_start_recording"));
1635 $this->tpl->setVariable('STOP_RECORDING', $lng->txt("debugwindow_stop_recording"));
1636 $this->tpl->setVariable('DELETE_LOGFILE', $lng->txt("debugwindow_delete_logfile"));
1637 $this->tpl->setVariable('SUBMISSION_FAILED', $lng->txt("debugwindow_submission_failed"));
1638 $this->tpl->setVariable('SUBMIT', $lng->txt("debugwindow_submit"));
1639 $this->tpl->setVariable('CANCEL', $lng->txt("debugwindow_cancel"));
1640 $this->tpl->setVariable('FILENAME', $lng->txt("debugwindow_filename"));
1641 $this->tpl->setVariable('DATE', $lng->txt("debugwindow_date"));
1642 $this->tpl->setVariable('ACTION', $lng->txt("debugwindow_action"));
1643 $this->tpl->setVariable('RECORD_IMG', ilUtil::getImagePath("record.png","./Modules/Scorm2004"));
1644 $this->tpl->setVariable('STOP_IMG', ilUtil::getImagePath("stop.png","./Modules/Scorm2004"));
1645 $this->tpl->setVariable('COMMENT_IMG', ilUtil::getImagePath("comment.png","./Modules/Scorm2004"));
1646 $logfile = $this->logFileName().".html";
1647 $this->tpl->setVariable('LOGFILE',$this->logFileName().".html");
1648 $this->tpl->setVariable('FILES_DATA', json_encode($this->getLogFileList($lng->txt("debugwindow_delete"), $lng->txt("debugwindow_download"), $lng->txt("debugwindow_open"))));
1649
1650 // path to latest yui distribution
1651 include_once "Services/YUI/classes/class.ilYuiUtil.php";
1652 $this->tpl->setVariable('PATH_YUI', ilYuiUtil::getLocalPath());
1653 //}
1654 echo $this->tpl->get("DEFAULT", true);
1655 }
getLogFileList($s_delete, $s_download, $s_open)
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getLocalPath($a_name="")
Get local path of a YUI js file.

References $lng, ilUtil\getImagePath(), and ilYuiUtil\getLocalPath().

Referenced by executeCommand().

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

◆ downloadLog()

ilSCORM13Player::downloadLog ( )

Definition at line 1564 of file ilSCORM13Player.php.

1564 {
1565 $filename = $_GET['logFile'];
1566 //Header
1567 header("Expires: 0");
1568 header("Cache-Control: private");
1569 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
1570 header("Pragma: cache");
1571 header("Content-Description: File Transfer");
1572 header("Content-Type: application/octet-stream");
1573 header("Content-disposition: attachment; filename=$filename");
1574 echo file_get_contents($this->logDirectory()."/".$filename);
1575 exit;
1576 }

References $_GET, $filename, and exit.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

& ilSCORM13Player::executeCommand ( )

execute command

Definition at line 164 of file ilSCORM13Player.php.

165 {
166 global $ilAccess, $ilLog, $ilUser, $lng, $ilias;
167
168 $next_class = $this->ctrl->getNextClass($this);
169 $cmd = $this->ctrl->getCmd();
170
171 if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
172 {
173 $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
174 }
175
176//$ilLog->write("SCORM2004 Player cmd: ".$cmd);
177
178 switch($cmd){
179
180 case 'getRTEjs':
181 $this->getRTEjs();
182 break;
183
184 case 'cp':
185 $this->getCPData();
186 break;
187
188 case 'adlact':
189 $this->getADLActData();
190 break;
191
192 case 'suspend':
193 $this->suspendADLActData();
194 break;
195
196 case 'getSuspend':
197 $this->getSuspendData();
198 break;
199
200 case 'gobjective':
201// $this->writeGObjective();
202 break;
203
204 case 'getGobjective':
205 $this->readGObjective();
206 break;
207
208 case 'getSharedData':
209 $this->readSharedData($_GET['node_id']);
210 break;
211
212 case 'setSharedData':
213 $this->writeSharedData($_GET['node_id']);
214 break;
215
216 case 'cmi':
217
218 if ($_SERVER['REQUEST_METHOD']=='POST') {
219 include_once './Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
220 ilSCORM2004StoreData::persistCMIData($this->userId, $this->packageId,
221 $this->slm->getDefaultLessonMode(), $this->slm->getComments(),
222 $this->slm->getInteractions(), $this->slm->getObjectives(), $this->slm->getTime_from_lms());
223 //error_log("Saved CMI Data");
224 } else {
225 $this->fetchCMIData();
226 }
227 break;
228
229 case 'specialPage':
230 $this->specialPage();
231 break;
232
233 case 'debugGUI':
234 $this->debugGUI();
235 break;
236 case 'postLogEntry':
237 $this->postLogEntry();
238 break;
239 case 'liveLogContent':
240 $this->liveLogContent();
241 break;
242 case 'downloadLog':
243 $this->downloadLog();
244 break;
245 case 'openLog':
246 $this->openLog();
247 break;
248
249 case 'pingSession':
250 $this->pingSession();
251 break;
252 case 'scormPlayerUnload':
253 include_once './Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php';
254 ilSCORM2004StoreData::scormPlayerUnload($this->userId, $this->packageId, $this->slm->getTime_from_lms());
255 break;
256
257 // case 'getConfigForPlayer':
258 // $this->getConfigForPlayer();
259 // break;
260 default:
261 $this->getPlayer();
262 break;
263 }
264
265 }
writeSharedData($sco_node_id)
readSharedData($sco_node_id)
static persistCMIData($userId=null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $time_from_lms, $data=null)
static scormPlayerUnload($userId=null, $packageId, $time_from_lms)
$cmd
Definition: sahs_server.php:35

References $_GET, $_SERVER, $cmd, $ilias, $ilLog, $ilUser, $lng, debugGUI(), downloadLog(), fetchCMIData(), getADLActData(), getCPData(), getPlayer(), getRTEjs(), getSuspendData(), liveLogContent(), openLog(), ilSCORM2004StoreData\persistCMIData(), pingSession(), postLogEntry(), readGObjective(), readSharedData(), ilSCORM2004StoreData\scormPlayerUnload(), specialPage(), suspendADLActData(), and writeSharedData().

+ Here is the call graph for this function:

◆ fetchCMIData()

ilSCORM13Player::fetchCMIData ( )

Definition at line 1001 of file ilSCORM13Player.php.

1002 {
1003 $data = $this->getCMIData($this->userId, $this->packageId);
1004 if ($this->jsMode)
1005 {
1006 header('Content-Type: text/javascript; charset=UTF-8');
1007 print(json_encode($data));
1008 }
1009 else
1010 {
1011 header('Content-Type: text/plain; charset=UTF-8');
1012 print(var_export($data, true));
1013 }
1014 }
if(! $in) print
getCMIData($userId, $packageId)

References $data, and print.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ get_actual_attempts()

ilSCORM13Player::get_actual_attempts ( )

Get number of actual attempts for the user.

Definition at line 1241 of file ilSCORM13Player.php.

1242 {
1243 global $ilDB, $ilUser;
1244 $val_set = $ilDB->queryF('SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
1245 array('integer','integer'), array($this->packageId,$this->userId));
1246 $val_rec = $ilDB->fetchAssoc($val_set);
1247 $attempts = $val_rec["package_attempts"];
1248 if ($attempts == null) $attempts = 0;
1249 return $attempts;
1250 }

References $ilDB, and $ilUser.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ get_max_attempts()

ilSCORM13Player::get_max_attempts ( )

Get max.

number of attempts allowed for this package

Definition at line 1219 of file ilSCORM13Player.php.

1220 {
1221 include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php";
1222 return ilObjSCORMInitData::get_max_attempts($this->packageId);
1223 }
static get_max_attempts($a_packageId)
Get max.

References ilObjSCORMInitData\get_max_attempts().

Referenced by getPlayer().

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

◆ get_Module_Version()

ilSCORM13Player::get_Module_Version ( )

Definition at line 1225 of file ilSCORM13Player.php.

1226 {
1227 global $ilDB;
1228
1229 $res = $ilDB->queryF(
1230 'SELECT module_version FROM sahs_lm WHERE id = %s',
1231 array('integer'),
1232 array($this->packageId));
1233 $row = $ilDB->fetchAssoc($res);
1234
1235 return $row['module_version'];
1236 }

References $ilDB, $res, and $row.

◆ getADLActData()

ilSCORM13Player::getADLActData ( )

Definition at line 570 of file ilSCORM13Player.php.

571 {
572 $activitytree = $this->getADLActDataInit();
573 if($this->jsMode)
574 {
575 header('Content-Type: text/javascript; charset=UTF-8');
576 print($activitytree);
577 }
578 else
579 {
580 header('Content-Type: text/plain; charset=UTF-8');
581 $activitytree = json_decode($activitytree);
582 print_r($activitytree);
583 }
584 }

References getADLActDataInit(), and print.

Referenced by executeCommand().

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

◆ getADLActDataInit()

ilSCORM13Player::getADLActDataInit ( )

Definition at line 550 of file ilSCORM13Player.php.

551 {
552 global $ilDB;
553
554 $res = $ilDB->queryF(
555 'SELECT activitytree FROM cp_package WHERE obj_id = %s',
556 array('integer'),
557 array($this->packageId)
558 );
559 $data = $ilDB->fetchAssoc($res);
560
561 $activitytree = $data['activitytree'];
562
563 if(!$activitytree)
564 {
565 $activitytree = 'null';
566 }
567 return $activitytree;
568 }

References $data, $ilDB, and $res.

Referenced by getADLActData(), and getPlayer().

+ Here is the caller graph for this function:

◆ getCMIData()

ilSCORM13Player::getCMIData (   $userId,
  $packageId 
)

Definition at line 1034 of file ilSCORM13Player.php.

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

References $ilDB, $packageId, $res, $result, $row, and $schema.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ getConfigForPlayer()

ilSCORM13Player::getConfigForPlayer ( )

Definition at line 289 of file ilSCORM13Player.php.

290 {
292 $initSuspendData = null;
293 $cmi_learner_id = (string) $ilUser->getID();
294 $lm_set = new ilSetting("lm");
295 if($lm_set->get("scorm_login_as_learner_id") == 1) {
296 $cmi_learner_id = (string) $ilUser->getLogin();
297 }
298 $config = array
299 (
300 'scope'=>$this->getScope(),
301 'learner_id' => (string) $ilUser->getID(),
302 'cmi_learner_id' => $cmi_learner_id,
303 'course_id' => (string) $this->packageId,
304 'learner_name' => $ilUser->getFirstname()." ".$ilUser->getLastname(),
305 'mode' => $this->slm->getDefaultLessonMode(),
306 'credit' => $this->slm->getCreditMode(),
307 'auto_review' => $this->slm->getAutoReviewChar(),
308 'hide_navig' => $this->slm->getHideNavig(),
309 'hide_menu' => $this->slm->getNoMenu(),
310 'ie_force_render' => $this->slm->getIe_force_render(),
311 'fourth_edition' => $this->slm->getFourth_edition(),
312 'sequencing_enabled' => $this->slm->getSequencing(),
313 'interactions_storable' => $this->slm->getInteractions(),
314 'objectives_storable' => $this->slm->getObjectives(),
315 'comments_storable' => $this->slm->getComments(),
316 'time_from_lms' => $this->slm->getTime_from_lms(),
317 'auto_last_visited' => $this->slm->getAuto_last_visited(),
318 'lesson_mastery_score' => $this->slm->getMasteryScore(),
319 'checkSetValues' => $this->slm->getCheck_values(),
320 'auto_suspend' => $this->slm->getAutoSuspend(),
321 'suspend_data' => $initSuspendData,
322 'cp_data' => null,
323 'cmi_data' => null,
324 'adlact_data' => null,
325 'globalobj_data' => null
326 );
327 include_once './Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php';
328 $config['status'] = ilObjSCORMInitData::getStatus($this->packageId, $ilUser->getID(), $this->slm->getAuto_last_visited(), "2004");
329 // $status['last_visited']=null;
330 // if($this->slm->getAuto_last_visited())
331 // {
332 // $status['last_visited']=$this->get_last_visited($this->packageId, $ilUser->getID());
333 // }
334 // $config['status'] = $status;
335
336 return $config;
337 }
static getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType="1.2")
ILIAS Setting Class.
global $ilSetting
Definition: privfeed.php:17
$lm_set

References $config, $ilias, $ilSetting, $ilUser, $lm_set, getScope(), and ilObjSCORMInitData\getStatus().

Referenced by getPlayer().

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

◆ getCPData()

ilSCORM13Player::getCPData ( )

Definition at line 517 of file ilSCORM13Player.php.

518 {
519 $jsdata = $this->getCPDataInit();
520 if ($this->jsMode)
521 {
522 header('Content-Type: text/javascript; charset=UTF-8');
523 print($jsdata);
524 }
525 else
526 {
527 header('Content-Type: text/plain; charset=UTF-8');
528 $jsdata = json_decode($jsdata);
529 print_r($jsdata);
530 }
531 }

References getCPDataInit(), and print.

Referenced by executeCommand().

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

◆ getCPDataInit()

ilSCORM13Player::getCPDataInit ( )

Definition at line 532 of file ilSCORM13Player.php.

533 {
534 global $ilDB;
535
536 $res = $ilDB->queryF(
537 'SELECT jsdata FROM cp_package WHERE obj_id = %s',
538 array('integer'),
539 array($this->packageId)
540 );
541 $packageData = $ilDB->fetchAssoc($res);
542
543 $jsdata = $packageData['jsdata'];
544 if (!$jsdata) $jsdata = 'null';
545
546 return $jsdata;
547 }

References $ilDB, and $res.

Referenced by getCPData(), and getPlayer().

+ Here is the caller graph for this function:

◆ getDataDirectory()

ilSCORM13Player::getDataDirectory ( )

Definition at line 280 of file ilSCORM13Player.php.

281 {
282 $webdir=str_replace("/ilias.php","",$_SERVER["SCRIPT_NAME"]);
283 //load ressources always with absolute URL..relative URLS fail on innersco navigation on certain browsers
284 $lm_dir=$webdir."/".ILIAS_WEB_DIR."/".$this->ilias->client_id ."/lm_data"."/lm_".$this->packageId;
285 return $lm_dir;
286 }

References $_SERVER.

Referenced by getPlayer(), and pingSession().

+ Here is the caller graph for this function:

◆ getDataDirectory2()

ilSCORM13Player::getDataDirectory2 ( )

Definition at line 1537 of file ilSCORM13Player.php.

1538 {
1539 $webdir=str_replace("/ilias.php","",$_SERVER["SCRIPT_NAME"]);
1540 //load ressources always with absolute URL..relative URLS fail on innersco navigation on certain browsers
1541 $lm_dir=$webdir."/".ILIAS_WEB_DIR."/".$this->ilias->client_id ."/lm_data"."/lm_".$this->packageId;
1542 return $lm_dir;
1543 }

References $_SERVER.

◆ getDebugValues()

ilSCORM13Player::getDebugValues (   $test_sco = false)
private

Definition at line 1662 of file ilSCORM13Player.php.

1663 {
1664 global $ilDB,$ilLog;
1665 $ini_array = null;
1666 $dvalues = array();
1667/*
1668 $res = $ilDB->queryF('
1669 SELECT debug_fields
1670 FROM sahs_lm
1671 WHERE id = %s',
1672 array('integer'),
1673 array($this->packageId)
1674 );
1675 $row = $ilDB->fetchAssoc($res);
1676 $debug_fields = $row['debug_fields'];
1677 if ($debug_fields == null) {*/
1678 $debug_fields = parse_ini_file("./Modules/Scorm2004/scripts/rtemain/debug_default.ini",true);
1679// }
1680 if ($test_sco) {
1681 $ini_array = $debug_fields['test_sco'];
1682 } else {
1683 $ini_array = $debug_fields['normal_sco'];
1684 }
1685 foreach ($ini_array as $key => $value) {
1686 if ($value == 1) {
1687 array_push($dvalues,$key);
1688 }
1689 }
1690 return $dvalues;
1691 }

References $ilDB, and $ilLog.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ getInlineCSS()

static ilSCORM13Player::getInlineCSS ( )
static

Get inline css.

Definition at line 503 of file ilSCORM13Player.php.

504 {
505 $is_tpl = new ilTemplate("tpl.scorm2004.inlinecss.html", true, true, "Modules/Scorm2004");
506 $is_tpl->setVariable('IC_ASSET', ilUtil::getImagePath("scorm/asset.svg",false));
507 $is_tpl->setVariable('IC_COMPLETED', ilUtil::getImagePath("scorm/completed.svg",false));
508 $is_tpl->setVariable('IC_NOTATTEMPTED', ilUtil::getImagePath("scorm/not_attempted.svg",false));
509 $is_tpl->setVariable('IC_RUNNING', ilUtil::getImagePath("scorm/running.svg",false));
510 $is_tpl->setVariable('IC_INCOMPLETE', ilUtil::getImagePath("scorm/incomplete.svg",false));
511 $is_tpl->setVariable('IC_PASSED', ilUtil::getImagePath("scorm/passed.svg",false));
512 $is_tpl->setVariable('IC_FAILED', ilUtil::getImagePath("scorm/failed.svg",false));
513 $is_tpl->setVariable('IC_BROWSED', ilUtil::getImagePath("scorm/browsed.svg",false));
514 return $is_tpl->get();
515 }

References ilUtil\getImagePath().

+ Here is the call graph for this function:

◆ getLogFileList()

ilSCORM13Player::getLogFileList (   $s_delete,
  $s_download,
  $s_open 
)
private

Definition at line 1578 of file ilSCORM13Player.php.

1579 {
1580 $data = array();
1581 foreach (new DirectoryIterator($this->logDirectory()) as $fileInfo) {
1582 if ($fileInfo->isDot()) {
1583 continue;
1584 }
1585 $item['filename'] = $fileInfo->getFilename();
1586 $parts = pathinfo($item['filename']);
1587 $fnameparts = preg_split('/_/', $parts['filename'], -1, PREG_SPLIT_NO_EMPTY);
1588 $deleteUrl = '&nbsp;<a href=#'." onclick=\"javascript:deleteFile('".$item['filename']."');\">".$s_delete."</a>";
1589 //no delete for most recent file
1590 if ($this->get_actual_attempts()==$fnameparts[1]) {$deleteUrl="";}
1591
1592 $urlDownload = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=downloadLog&ref_id='.$_GET["ref_id"].'&logFile='.$fileInfo->getFilename();
1593 $urlOpen = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=openLog&ref_id='.$_GET["ref_id"].'&logFile='.$fileInfo->getFilename();
1594 $item['date'] = date('Y/m/d H:i:s', $fileInfo->getCTime());
1595 if ($parts['extension'] == "html") {
1596 $item['action'] =$deleteUrl."&nbsp;<a href=".$urlDownload.">".$s_download."</a>&nbsp;<a target=_new href=".$urlOpen.">".$s_open."</a>";
1597 } else {
1598 $item['action'] =$deleteUrl."&nbsp;<a href=".$urlDownload.">".$s_download."</a>";
1599 }
1600 if ($parts['extension'] == "html" || $parts['extension'] == "csv") {
1601 array_push($data,$item);
1602 }
1603 }
1604 usort($data,"datecmp");
1605 return $data;
1606 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
get_actual_attempts()
Get number of actual attempts for the user.

References $_GET, $data, and date.

◆ getLogTemplate()

ilSCORM13Player::getLogTemplate ( )
private

Definition at line 1657 of file ilSCORM13Player.php.

1658 {
1659 return new ilTemplate("tpl.scorm2004.debugtxt.txt", true, true, "Modules/Scorm2004");
1660 }

◆ getMimetype()

ilSCORM13Player::getMimetype (   $filename)

estimate content type for a filename by extension first do it for common static web files from external list if not found peek into file by slow php function mime_content_type()

Parameters
$filenamerequired
Returns
string mimetype name e.g. image/jpeg

Definition at line 1209 of file ilSCORM13Player.php.

1210 {
1211 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1213 }
static getMimeType($a_file, $a_external=false)
get mime type for file

References $filename, and ilObjMediaObject\getMimeType().

+ Here is the call graph for this function:

◆ getNodeData()

ilSCORM13Player::getNodeData (   $sco_id,
  $fh 
)
private

Definition at line 1322 of file ilSCORM13Player.php.

1323 {
1324 global $ilDB,$ilLog;
1325
1326 $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,".
1327 "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";
1328
1329
1330 $res = $ilDB->queryF('
1331 SELECT '.$fieldList.'
1332 FROM cmi_node,cp_node,cp_item
1333 WHERE cp_node.slm_id = %s
1334 AND cp_node.cp_node_id = cp_item.cp_node_id
1335 AND cp_item.id = %s
1336 AND cmi_node.cp_node_id = cp_item.cp_node_id
1337 AND cmi_node.user_id = %s',
1338 array('integer','text','integer'),
1339 array($this->packageId, $sco_id, $this->userId)
1340 );
1341 $row = $ilDB->fetchAssoc($res);
1342 $ilLog->write("DEBUG SQL".$row);
1343 return $row;
1344 }

References $ilDB, $ilLog, $res, and $row.

◆ getPlayer()

ilSCORM13Player::getPlayer ( )

Definition at line 339 of file ilSCORM13Player.php.

340 {
341 global $ilUser,$lng, $ilias, $ilSetting;
342
343 //WAC
344 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
345 ilWACSignedPath::signFolderOfStartFile($this->getDataDirectory().'/imsmanifest.xml');
346
347 // player basic config data
348
349 $initSuspendData = null;
350 $initAdlactData = null;
351 if ($this->slm->getSequencing() == true) {
352 $initSuspendData = json_decode($this->getSuspendDataInit());
353 $initAdlactData = json_decode($this->getADLActDataInit());
354 $initGlobalobjData = $this->readGObjectiveInit();
355 }
356
357 $config = $this->getConfigForPlayer();
358
359 //session
360 if ($this->slm->getSession()) {
361 $session_timeout = (int)ilWACSignedPath::getCookieMaxLifetimeInSeconds();
362 $max_idle = (int)ilSession::getIdleValue();
363 if ($session_timeout > $max_idle) $session_timeout = $max_idle;
364 $min_idle = (int)$ilSetting->get('session_min_idle', ilSessionControl::DEFAULT_MIN_IDLE) * 60;
365 if ($session_timeout > $min_idle) $session_timeout = $min_idle;
366 $session_timeout -= 10; //buffer
367 } else {
368 $session_timeout = 0;
369 }
370 $config['session_ping'] = $session_timeout;
371
372 //url strings
373 $store_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=cmi&ref_id='.$_GET["ref_id"];
374 $unload_url = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=scormPlayerUnload&ref_id='.$_GET["ref_id"];
375 if ($this->slm->getSessionDeactivated()){
376 $store_url = 'storeScorm2004.php?package_id='.$this->packageId.'&ref_id='.$_GET["ref_id"].'&client_id='.$this->ilias->client_id.'&do=store';
377 $unload_url = 'storeScorm2004.php?package_id='.$this->packageId.'&ref_id='.$_GET["ref_id"].'&client_id='.$this->ilias->client_id.'&do=unload';
378 }
379 $config['cp_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=cp&ref_id='.$_GET["ref_id"];
380 $config['cmi_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=cmi&ref_id='.$_GET["ref_id"];
381 $config['store_url'] = $store_url;
382 $config['get_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=getSharedData&ref_id='.$_GET["ref_id"];
383 $config['set_adldata_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' . '&cmd=setSharedData&ref_id=' . $_GET["ref_id"];
384 $config['adlact_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=adlact&ref_id='.$_GET["ref_id"];
385 $config['specialpage_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=specialPage&ref_id='.$_GET["ref_id"];
386 $config['suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=suspend&ref_id='.$_GET["ref_id"];
387 $config['get_suspend_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=getSuspend&ref_id='.$_GET["ref_id"];
388 //next 2 lines could be deleted later
389 $config['gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=gobjective&ref_id='.$_GET["ref_id"];
390 $config['get_gobjective_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=getGobjective&ref_id='.$_GET["ref_id"];
391 $config['ping_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=pingSession&ref_id='.$_GET["ref_id"];
392 $config['scorm_player_unload_url']= $unload_url;
393 $config['post_log_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=postLogEntry&ref_id='.$_GET["ref_id"];
394 $config['livelog_url'] = 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=liveLogContent&ref_id='.$_GET["ref_id"];
395 $config['package_url'] = $this->getDataDirectory()."/";
396
397 //editor
398 $config['envEditor'] = $this->envEditor;
399
400 //debug
401 $config['debug'] = $this->slm->getDebug();
402 $config['debug_fields'] = $this->getDebugValues();
403 $config['debug_fields_test'] = $this->getDebugValues(true);
404
405
406 //language strings
407 $langstrings['btnStart'] = $lng->txt('scplayer_start');
408 $langstrings['btnExit'] = $lng->txt('scplayer_exit');
409 $langstrings['btnExitAll'] = $lng->txt('scplayer_exitall');
410 $langstrings['btnSuspendAll'] = $lng->txt('scplayer_suspendall');
411 $langstrings['btnPrevious'] = $lng->txt('scplayer_previous');
412 $langstrings['btnContinue'] = $lng->txt('scplayer_continue');
413 $langstrings['btnhidetree']=$lng->txt('scplayer_hidetree');
414 $langstrings['btnshowtree']=$lng->txt('scplayer_showtree');
415 $langstrings['linkexpandTree']=$lng->txt('scplayer_expandtree');
416 $langstrings['linkcollapseTree']=$lng->txt('scplayer_collapsetree');
417 $langstrings['contCreditOff']=$lng->txt('cont_credit_off');
418 if ($this->slm->getAutoReviewChar() == "s") {
419 $langstrings['contCreditOff']=$lng->txt('cont_sc_score_was_higher_message');
420 }
421 $config['langstrings'] = $langstrings;
422
423 //template variables
424 //$this->tpl = new ilTemplate("tpl.scorm2004.player.html", false, false, "Modules/Scorm2004");
425 $this->tpl = new ilTemplate("tpl.scorm2004.player.html", true, true, "Modules/Scorm2004");
426
427 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
428 $this->tpl->setVariable("JS_FILE",iljQueryUtil::getLocaljQueryPath());
429
430 // include ilias rte css, if given
431 $rte_css = $this->slm->getDataDirectory()."/ilias_css_4_2/css/style.css";
432 if (is_file($rte_css))
433 {
434 $this->tpl->setCurrentBlock("rte_css");
435 $this->tpl->setVariable("RTE_CSS", $rte_css);
436 $this->tpl->parseCurrentBlock();
437 }
438
439
440 $this->tpl->setVariable('JSON_LANGSTRINGS', json_encode($langstrings));
441 // include_once("./Services/YUI/classes/class.ilYuiUtil.php");
442 // $this->tpl->setVariable('YUI_PATH', ilYuiUtil::getLocalPath());
443 // $this->tpl->setVariable('TREE_JS', "./Services/UIComponent/NestedList/js/ilNestedList.js");
444 $this->tpl->setVariable('TREE_JS', "./Modules/Scorm2004/scripts/ilNestedList.js");
445 $this->tpl->setVariable($langstrings);
446 $this->tpl->setVariable('DOC_TITLE', 'ILIAS SCORM 2004 Player');
447 if ($this->slm->getIe_compatibility()) $this->tpl->setVariable('IE_COMPATIBILITY', '<meta http-equiv="X-UA-Compatible" content="IE=7" />');
448 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
449 $this->tpl->setVariable('INIT_CP_DATA', json_encode(json_decode($this->getCPDataInit())));
450 $this->tpl->setVariable('INIT_CMI_DATA', json_encode($this->getCMIData($this->userId, $this->packageId)));
451 $this->tpl->setVariable('INIT_ADLACT_DATA', json_encode($initAdlactData));
452 $this->tpl->setVariable('INIT_GLOBALOBJ_DATA', json_encode($initGlobalobjData));
453 $this->tpl->setVariable('JS_DATA', json_encode($config));
454 list($tsfrac, $tsint) = explode(' ', microtime());
455 $this->tpl->setVariable('TIMESTAMP', sprintf('%d%03d', $tsint, 1000*(float)$tsfrac));
456 $this->tpl->setVariable('BASE_DIR', './Modules/Scorm2004/');
457 $this->tpl->setVariable('TXT_COLLAPSE',$lng->txt('scplayer_collapsetree'));
458 if ($this->slm->getDebug()) {
459 $this->tpl->setVariable('TXT_DEBUGGER',$lng->txt('scplayer_debugger'));
460 $this->tpl->setVariable('DEBUG_URL',"PopupCenter('ilias.php?baseClass=ilSAHSPresentationGUI&cmd=debugGUI&ref_id=".$_GET["ref_id"]."','Debug',800,600);");
461 } else {
462 $this->tpl->setVariable('TXT_DEBUGGER','');
463 $this->tpl->setVariable('DEBUG_URL','');
464 }
465
466 //set icons path
467 $this->tpl->setVariable('INLINE_CSS', ilSCORM13Player::getInlineCss());
468
469 //include scripts
470 if ($this->slm->getCacheDeactivated()){
471 $this->tpl->setVariable('JS_SCRIPTS', 'ilias.php?baseClass=ilSAHSPresentationGUI' .'&cmd=getRTEjs&ref_id='.$_GET["ref_id"]);
472 } else {
473 $this->tpl->setVariable('JS_SCRIPTS', './Modules/Scorm2004/scripts/buildrte/rte-min.js');
474 }
475
476 //disable top menu
477 if ($this->slm->getNoMenu()=="y") {
478 $this->tpl->setVariable("VAL_DISPLAY", "style=\"display:none;\"");
479 } else {
480 $this->tpl->setVariable("VAL_DISPLAY", "");
481 }
482
483
484 //check for max_attempts and raise error if max_attempts is exceeded
485 if ($this->get_max_attempts()!=0) {
486 if ($this->get_actual_attempts() >= $this->get_max_attempts()) {
487 header('Content-Type: text/html; charset=utf-8');
488 echo($lng->txt("cont_sc_max_attempt_exceed"));
489 exit;
490 }
491 }
492
493 //count attempt
495 $this->resetSharedData();
496
497 $this->tpl->show("DEFAULT", false);
498 }
sprintf('%.4f', $callTime)
getDebugValues($test_sco=false)
increase_attemptAndsave_module_version()
Increases attempts by one and saves module_version for this package.
get_max_attempts()
Get max.
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static signFolderOfStartFile($start_file_path, ilWACCookieInterface $ilWACCookieInterface=null)
static getCookieMaxLifetimeInSeconds()
static getLocaljQueryPath()
Get local path of jQuery file.

References $_GET, $config, $ilias, $ilSetting, $ilUser, $lng, ilSessionControl\DEFAULT_MIN_IDLE, exit, get_actual_attempts(), get_max_attempts(), getADLActDataInit(), getCMIData(), getConfigForPlayer(), ilWACSignedPath\getCookieMaxLifetimeInSeconds(), getCPDataInit(), getDataDirectory(), getDebugValues(), ilSession\getIdleValue(), iljQueryUtil\getLocaljQueryPath(), ilUtil\getStyleSheetLocation(), getSuspendDataInit(), increase_attemptAndsave_module_version(), readGObjectiveInit(), resetSharedData(), ilWACSignedPath\signFolderOfStartFile(), and sprintf.

Referenced by executeCommand().

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

◆ getRTEjs()

ilSCORM13Player::getRTEjs ( )

Definition at line 267 of file ilSCORM13Player.php.

268 {
269 $js_data = file_get_contents("./Modules/Scorm2004/scripts/buildrte/rte.js");
270 if (self::ENABLE_GZIP==1) {
271 ob_start("ob_gzhandler");
272 header('Content-Type: text/javascript; charset=UTF-8');
273 } else {
274 header('Content-Type: text/javascript; charset=UTF-8');
275 }
276 echo $js_data;
277 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ getScope()

ilSCORM13Player::getScope ( )

Definition at line 596 of file ilSCORM13Player.php.

597 {
598 global $ilDB, $ilUser;
599
600 $res = $ilDB->queryF(
601 'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
602 array('integer'),
603 array($this->packageId)
604 );
605 $data = $ilDB->fetchAssoc($res);
606
607 $gystem = $data['global_to_system'];
608 if($gystem == 1)
609 $gsystem = 'null';
610 else
611 $gsystem = $this->packageId;
612
613 return $gsystem;
614 }

References $data, $ilDB, $ilUser, $packageId, and $res.

Referenced by getConfigForPlayer().

+ Here is the caller graph for this function:

◆ getStructureFlat()

ilSCORM13Player::getStructureFlat (   $data)
private

Definition at line 1988 of file ilSCORM13Player.php.

1989 {
1990 for ($i=0; $i <count($data) ; $i++) {
1991 $element = array();
1992 $element['title'] = $data[$i]['title'];
1993 $element['id'] = $data[$i]['id'];
1994 if ($data[$i]['sco'] == 1) {
1995 $element['sco'] = "sco";
1996 } else {
1997 $element['sco'] = "assset";
1998 }
1999 if ( $data[$i]['href'] !=null ) {
2000 array_push($this->flat_structure,$element);
2001 }
2002 if ($data[$i]['item']!=null) {
2003 $this->getStructureFlat($data[$i]['item']);
2004 }
2005 }
2006 }

References $data.

◆ getSuspendData()

ilSCORM13Player::getSuspendData ( )

Definition at line 636 of file ilSCORM13Player.php.

637 {
638 $suspend_data = $this->getSuspendDataInit();
639 if($this->jsMode)
640 {
641 header('Content-Type: text/javascript; charset=UTF-8');
642 print($suspend_data);
643 }
644 else
645 {
646 header('Content-Type: text/plain; charset=UTF-8');
647 $suspend_data = json_decode($suspend_data);
648 print_r($suspend_data);
649 }
650 }

References getSuspendDataInit(), and print.

Referenced by executeCommand().

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

◆ getSuspendDataInit()

ilSCORM13Player::getSuspendDataInit ( )

Definition at line 616 of file ilSCORM13Player.php.

617 {
618 global $ilDB, $ilUser;
619
620 $res = $ilDB->queryF(
621 'SELECT data FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
622 array('integer', 'integer'),
623 array($this->packageId, $ilUser->getId())
624 );
625 $data = $ilDB->fetchAssoc($res);
626
627 //delete delivered suspend data
628 $ilDB->manipulateF(
629 'DELETE FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
630 array('integer', 'integer'),
631 array($this->packageId, $ilUser->getId())
632 );
633 return $data['data'];
634 }

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

Referenced by getPlayer(), and getSuspendData().

+ Here is the caller graph for this function:

◆ increase_attemptAndsave_module_version()

ilSCORM13Player::increase_attemptAndsave_module_version ( )

Increases attempts by one and saves module_version for this package.

Definition at line 1255 of file ilSCORM13Player.php.

1256 {
1257 global $ilDB, $ilUser;
1258 $res = $ilDB->queryF(
1259 'SELECT package_attempts,count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s GROUP BY package_attempts',
1260 array('integer','integer'),
1261 array($this->slm->getId(),$ilUser->getId()));
1262 $val_rec = $ilDB->fetchAssoc($res);
1263 if ($val_rec["cnt"] == 0) { //offline_mode could be inserted
1264 $attempts = 1;
1265 $ilDB->manipulateF(
1266 'INSERT INTO sahs_user (obj_id,user_id,package_attempts,module_version,last_access) VALUES(%s,%s,%s,%s,%s)',
1267 array('integer', 'integer', 'integer', 'integer', 'timestamp'),
1268 array($this->slm->getId(), $ilUser->getId(), $attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s')));
1269 } else {
1270 $attempts = $val_rec["package_attempts"];
1271 if ($attempts == null) $attempts = 0;
1272 $attempts++;
1273 $ilDB->manipulateF(
1274 'UPDATE sahs_user SET package_attempts = %s, module_version = %s, last_access=%s WHERE obj_id = %s AND user_id = %s ',
1275 array('integer', 'integer', 'timestamp', 'integer', 'integer'),
1276 array($attempts, $this->slm->getModuleVersion(), date('Y-m-d H:i:s'), $this->slm->getId(), $ilUser->getId()));
1277 }
1278 }

References $ilDB, $ilUser, $res, and date.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ liveLogContent()

ilSCORM13Player::liveLogContent ( )

Definition at line 1608 of file ilSCORM13Player.php.

1609 {
1610 header('Content-Type: text/html; charset=UTF-8');
1611 print file_get_contents($this->logFileName().".html");
1612 }

References print.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ logDirectory()

ilSCORM13Player::logDirectory ( )
private

Definition at line 1545 of file ilSCORM13Player.php.

1546 {
1547// $logDir=ilUtil::getDataDir()."/SCORMlogs"."/lm_".$this->packageId;
1548// if (!file_exists($logDir)) ilUtil::makeDirParents($logDir);
1549 $logDir=$this->slm->getDataDirectory()."/logs";
1550 if (!file_exists($logDir)) {
1551 ilUtil::makeDir($logDir);
1552 }
1553 return $logDir;
1554 }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...

References ilUtil\makeDir().

+ Here is the call graph for this function:

◆ logFileName()

ilSCORM13Player::logFileName ( )
private

Definition at line 1379 of file ilSCORM13Player.php.

1380 {
1381 global $lng;
1382 $lng->loadLanguageModule("scormdebug");
1383
1384 $filename = $this->logDirectory()."/".$this->packageId."_".$this->get_actual_attempts();
1385 $path_csv = $filename.".csv";
1386 $path_txt = $filename.".html";
1387 if (!file_exists($path_csv)) {
1388 umask(0000);
1389 $fHandle = fopen($path_csv, 'a') or die("can't open file");
1390 $string = '"CourseId";"ScoId";"ScoTitle";"Timestamp";"Action";"Key";"Value";"Return Value";"Errorcode";"Timespan";"ErrorDescription"'."\n";
1391 fwrite($fHandle, $string);
1392 fclose($fHandle);
1393 }
1394 if (!file_exists($path_txt)) {
1395 if (file_exists($this->logTmpName())) {
1396 unlink($this->logTmpName());
1397 }
1398 umask(0000);
1399 $fHandle2 = fopen($path_txt, 'a') or die("can't open file");
1400 $logtpl = $this->getLogTemplate();
1401 $logtpl->setCurrentBlock('NewLog');
1402 $logtpl->setVariable("COURSETITLE", $this->slm->getTitle());
1403 $logtpl->setVariable("COURSEID", $this->packageId);
1404 $logtpl->setVariable("TIMESTAMP", date("d.m.Y H:i",time()));
1405 $logtpl->setVariable("SESSION", $this->get_actual_attempts());
1406 $logtpl->setVariable("error0", $lng->txt("error0"));
1407 $logtpl->setVariable("error101", $lng->txt("error101"));
1408 $logtpl->setVariable("error102", $lng->txt("error102"));
1409 $logtpl->setVariable("error103", $lng->txt("error103"));
1410 $logtpl->setVariable("error104", $lng->txt("error104"));
1411 $logtpl->setVariable("error111", $lng->txt("error111"));
1412 $logtpl->setVariable("error112", $lng->txt("error112"));
1413 $logtpl->setVariable("error113", $lng->txt("error113"));
1414 $logtpl->setVariable("error122", $lng->txt("error122"));
1415 $logtpl->setVariable("error123", $lng->txt("error123"));
1416 $logtpl->setVariable("error132", $lng->txt("error132"));
1417 $logtpl->setVariable("error133", $lng->txt("error133"));
1418 $logtpl->setVariable("error142", $lng->txt("error142"));
1419 $logtpl->setVariable("error143", $lng->txt("error143"));
1420 $logtpl->setVariable("error201", $lng->txt("error201"));
1421 $logtpl->setVariable("error301", $lng->txt("error301"));
1422 $logtpl->setVariable("error351", $lng->txt("error351"));
1423 $logtpl->setVariable("error391", $lng->txt("error391"));
1424 $logtpl->setVariable("error401", $lng->txt("error401"));
1425 $logtpl->setVariable("error402", $lng->txt("error402"));
1426 $logtpl->setVariable("error403", $lng->txt("error403"));
1427 $logtpl->setVariable("error404", $lng->txt("error404"));
1428 $logtpl->setVariable("error405", $lng->txt("error405"));
1429 $logtpl->setVariable("error406", $lng->txt("error406"));
1430 $logtpl->setVariable("error407", $lng->txt("error407"));
1431 $logtpl->setVariable("error408", $lng->txt("error408"));
1432 $logtpl->setVariable("SetValue", $lng->txt("SetValue"));
1433 $logtpl->setVariable("GetValue", $lng->txt("GetValue"));
1434 $logtpl->setVariable("Commit", $lng->txt("Commit"));
1435 $logtpl->setVariable("Initialize", $lng->txt("Initialize"));
1436 $logtpl->setVariable("Terminate", $lng->txt("Terminate"));
1437 $logtpl->setVariable("GetErrorString", $lng->txt("GetErrorString"));
1438 $logtpl->setVariable("GetLastError", $lng->txt("GetLastError"));
1439 $logtpl->setVariable("GetDiagnostic", $lng->txt("GetDiagnostic"));
1440 $logtpl->setVariable("cmi._version", $lng->txt("cmi._version"));
1441 $logtpl->setVariable("cmi.comments_from_learner._children", $lng->txt("cmi.comments_from_learner._children"));
1442 $logtpl->setVariable("cmi.comments_from_learner._count", $lng->txt("cmi.comments_from_learner._count"));
1443 $logtpl->setVariable("cmi.comments_from_learner.n.comment", $lng->txt("cmi.comments_from_learner.n.comment"));
1444 $logtpl->setVariable("cmi.comments_from_learner.n.location", $lng->txt("cmi.comments_from_learner.n.location"));
1445 $logtpl->setVariable("cmi.comments_from_learner.n.timestamp", $lng->txt("cmi.comments_from_learner.n.timestamp"));
1446 $logtpl->setVariable("cmi.comments_from_lms._children", $lng->txt("cmi.comments_from_lms._children"));
1447 $logtpl->setVariable("cmi.comments_from_lms._count", $lng->txt("cmi.comments_from_lms._count"));
1448 $logtpl->setVariable("cmi.comments_from_lms.n.comment", $lng->txt("cmi.comments_from_lms.n.comment"));
1449 $logtpl->setVariable("cmi.comments_from_lms.n.location", $lng->txt("cmi.comments_from_lms.n.location"));
1450 $logtpl->setVariable("cmi.comments_from_lms.n.timestamp", $lng->txt("cmi.comments_from_lms.n.timestamp"));
1451 $logtpl->setVariable("cmi.completion_status", $lng->txt("cmi.completion_status"));
1452 $logtpl->setVariable("cmi.completion_threshold", $lng->txt("cmi.completion_threshold"));
1453 $logtpl->setVariable("cmi.credit", $lng->txt("cmi.credit"));
1454 $logtpl->setVariable("cmi.entry", $lng->txt("cmi.entry"));
1455 $logtpl->setVariable("cmi.exit", $lng->txt("cmi.exit"));
1456 $logtpl->setVariable("cmi.interactions._children", $lng->txt("cmi.interactions._children"));
1457 $logtpl->setVariable("cmi.interactions._count", $lng->txt("cmi.interactions._count"));
1458 $logtpl->setVariable("cmi.interactions.n.id", $lng->txt("cmi.interactions.n.id"));
1459 $logtpl->setVariable("cmi.interactions.n.type", $lng->txt("cmi.interactions.n.type"));
1460 $logtpl->setVariable("cmi.interactions.n.objectives._count", $lng->txt("cmi.interactions.n.objectives._count"));
1461 $logtpl->setVariable("cmi.interactions.n.objectives.n.id", $lng->txt("cmi.interactions.n.objectives.n.id"));
1462 $logtpl->setVariable("cmi.interactions.n.timestamp", $lng->txt("cmi.interactions.n.timestamp"));
1463 $logtpl->setVariable("cmi.interactions.n.correct_responses._count", $lng->txt("cmi.interactions.n.correct_responses._count"));
1464 $logtpl->setVariable("cmi.interactions.n.correct_responses.n.pattern", $lng->txt("cmi.interactions.n.correct_responses.n.pattern"));
1465 $logtpl->setVariable("cmi.interactions.n.weighting", $lng->txt("cmi.interactions.n.weighting"));
1466 $logtpl->setVariable("cmi.interactions.n.learner_response", $lng->txt("cmi.interactions.n.learner_response"));
1467 $logtpl->setVariable("cmi.interactions.n.result", $lng->txt("cmi.interactions.n.result"));
1468 $logtpl->setVariable("cmi.interactions.n.latency", $lng->txt("cmi.interactions.n.latency"));
1469 $logtpl->setVariable("cmi.interactions.n.description", $lng->txt("cmi.interactions.n.description"));
1470 $logtpl->setVariable("cmi.launch_data", $lng->txt("cmi.launch_data"));
1471 $logtpl->setVariable("cmi.learner_id", $lng->txt("cmi.learner_id"));
1472 $logtpl->setVariable("cmi.learner_name", $lng->txt("cmi.learner_name"));
1473 $logtpl->setVariable("cmi.learner_preference._children", $lng->txt("cmi.learner_preference._children"));
1474 $logtpl->setVariable("cmi.learner_preference.audio_level", $lng->txt("cmi.learner_preference.audio_level"));
1475 $logtpl->setVariable("cmi.learner_preference.language", $lng->txt("cmi.learner_preference.language"));
1476 $logtpl->setVariable("cmi.learner_preference.delivery_speed", $lng->txt("cmi.learner_preference.delivery_speed"));
1477 $logtpl->setVariable("cmi.learner_preference.audio_captioning", $lng->txt("cmi.learner_preference.audio_captioning"));
1478 $logtpl->setVariable("cmi.location", $lng->txt("cmi.location"));
1479 $logtpl->setVariable("cmi.max_time_allowed", $lng->txt("cmi.max_time_allowed"));
1480 $logtpl->setVariable("cmi.mode", $lng->txt("cmi.mode"));
1481 $logtpl->setVariable("cmi.objectives._children", $lng->txt("cmi.objectives._children"));
1482 $logtpl->setVariable("cmi.objectives._count", $lng->txt("cmi.objectives._count"));
1483 $logtpl->setVariable("cmi.objectives.n.id", $lng->txt("cmi.objectives.n.id"));
1484 $logtpl->setVariable("cmi.objectives.n.score._children", $lng->txt("cmi.objectives.n.score._children"));
1485 $logtpl->setVariable("cmi.objectives.n.score.scaled", $lng->txt("cmi.objectives.n.score.scaled"));
1486 $logtpl->setVariable("cmi.objectives.n.score.raw", $lng->txt("cmi.objectives.n.score.raw"));
1487 $logtpl->setVariable("cmi.objectives.n.score.min", $lng->txt("cmi.objectives.n.score.min"));
1488 $logtpl->setVariable("cmi.objectives.n.score.max", $lng->txt("cmi.objectives.n.score.max"));
1489 $logtpl->setVariable("cmi.objectives.n.success_status", $lng->txt("cmi.objectives.n.success_status"));
1490 $logtpl->setVariable("cmi.objectives.n.completion_status", $lng->txt("cmi.objectives.n.completion_status"));
1491 $logtpl->setVariable("cmi.objectives.n.progress_measure", $lng->txt("cmi.objectives.n.progress_measure"));
1492 $logtpl->setVariable("cmi.objectives.n.description", $lng->txt("cmi.objectives.n.description"));
1493 $logtpl->setVariable("cmi.progress_measure", $lng->txt("cmi.progress_measure"));
1494 $logtpl->setVariable("cmi.scaled_passing_score", $lng->txt("cmi.scaled_passing_score"));
1495 $logtpl->setVariable("cmi.score._children", $lng->txt("cmi.score._children"));
1496 $logtpl->setVariable("cmi.score.scaled", $lng->txt("cmi.score.scaled"));
1497 $logtpl->setVariable("cmi.score.raw", $lng->txt("cmi.score.raw"));
1498 $logtpl->setVariable("cmi.score.min", $lng->txt("cmi.score.min"));
1499 $logtpl->setVariable("cmi.score.max", $lng->txt("cmi.score.max"));
1500 $logtpl->setVariable("cmi.session_time", $lng->txt("cmi.session_time"));
1501 $logtpl->setVariable("cmi.success_status", $lng->txt("cmi.success_status"));
1502 $logtpl->setVariable("cmi.suspend_data", $lng->txt("cmi.suspend_data"));
1503 $logtpl->setVariable("cmi.time_limit_action", $lng->txt("cmi.time_limit_action"));
1504 $logtpl->setVariable("cmi.total_time", $lng->txt("cmi.total_time"));
1505 $logtpl->setVariable("adl.nav.request", $lng->txt("adl.nav.request"));
1506 $logtpl->setVariable("adl.nav.request_valid.continue", $lng->txt("adl.nav.request_valid.continue"));
1507 $logtpl->setVariable("adl.nav.request_valid.previous", $lng->txt("adl.nav.request_valid.previous"));
1508 $logtpl->setVariable("adl.nav.request_valid.choice", $lng->txt("adl.nav.request_valid.choice"));
1509 $logtpl->setVariable("i_green", $lng->txt("i_green"));
1510 $logtpl->setVariable("i_red", $lng->txt("i_red"));
1511 $logtpl->setVariable("i_orange", $lng->txt("i_orange"));
1512 $logtpl->setVariable("i_fuchsia", $lng->txt("i_fuchsia"));
1513 $logtpl->setVariable("i_gray", $lng->txt("i_gray"));
1514 $logtpl->setVariable("error", $lng->txt("error"));
1515 $logtpl->setVariable("strange_error", $lng->txt("strange_error"));
1516 $logtpl->setVariable("strange_API-Call", $lng->txt("strange_API-Call"));
1517 $logtpl->setVariable("unknown", $lng->txt("unknown"));
1518 $logtpl->setVariable("undefined_color", $lng->txt("undefined_color"));
1519 $logtpl->setVariable("description_for", $lng->txt("description_for"));
1520 $logtpl->setVariable("hide", $lng->txt("hide"));
1521 $logtpl->setVariable("all_API-calls_shown", $lng->txt("all_API-calls_shown"));
1522 $logtpl->setVariable("show_only_important_API-calls", $lng->txt("show_only_important_API-calls"));
1523 $logtpl->setVariable("only_important_API-Calls_shown", $lng->txt("only_important_API-Calls_shown"));
1524 $logtpl->setVariable("show_all_API-calls", $lng->txt("show_all_API-calls"));
1525 $logtpl->setVariable("log_for", $lng->txt("log_for"));
1526 $logtpl->setVariable("started", $lng->txt("started"));
1527 $logtpl->setVariable("nr_session", $lng->txt("nr_session"));
1528 $logtpl->setVariable("id_learning_module", $lng->txt("id_learning_module"));
1529 if($this->slm->getCheck_values()==false) $logtpl->setVariable("CHECK_VALUES", $lng->txt("sent_values_not_checked"));
1530 $logtpl->parseCurrentBlock();
1531 fwrite($fHandle2,$logtpl->get());
1532 fclose($fHandle2);
1533 }
1534 return $filename;
1535 }
PHPExcel root directory.
Definition: PHPExcel.php:30
setVariable($a_group_name, $a_var_name, $a_var_value)
sets a variable in a group @access public
error($a_errmsg)
set error message @access public
comment()
Definition: comment.php:2
get($resource)
Loads and returns the value for the supplied cache key.
Definition: ConfigCache.php:75

References $filename, $lng, and date.

◆ logTmpName()

ilSCORM13Player::logTmpName ( )
private

Definition at line 1346 of file ilSCORM13Player.php.

1347 {
1348 $filename = $this->logDirectory()."/".$this->packageId.".tmp";
1349 if (!file_exists($filename)) {
1350 umask(0000);
1351 $fHandle = fopen($filename, 'a') or die("can't open file");
1352 fwrite($fHandle, $string);
1353 fclose($fHandle);
1354 }
1355 return $filename;
1356 }

References $filename.

◆ normalizeFields()

ilSCORM13Player::normalizeFields (   $table,
$node 
)
private

maps API data structure type to internal datatype on a node
and accepts only valid values, dropping invalid ones from input

Definition at line 1021 of file ilSCORM13Player.php.

1022 {
1023 return;
1024 foreach (self::$schema[$table] as $k => $v)
1025 {
1026 $value = $node->$k;
1027 if (isset($value) && is_string($v) && !preg_match($v, $value))
1028 {
1029 unset($node->$k);
1030 }
1031 }
1032 }

References $schema.

◆ openLog()

ilSCORM13Player::openLog ( )

Definition at line 1556 of file ilSCORM13Player.php.

1556 {
1557 $filename = $_GET['logFile'];
1558 //Header
1559 header('Content-Type: text/html; charset=UTF-8');
1560 echo file_get_contents($this->logDirectory()."/".$filename);
1561 exit;
1562 }

References $_GET, $filename, and exit.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ pingSession()

ilSCORM13Player::pingSession ( )

Definition at line 586 of file ilSCORM13Player.php.

587 {
588 //WAC
589 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
590 ilWACSignedPath::signFolderOfStartFile($this->getDataDirectory().'/imsmanifest.xml');
591 //do nothing except returning header
592 header('Content-Type: text/plain; charset=UTF-8');
593 print("");
594 }

References getDataDirectory(), print, and ilWACSignedPath\signFolderOfStartFile().

Referenced by executeCommand().

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

◆ postLogEntry()

ilSCORM13Player::postLogEntry ( )

Definition at line 1693 of file ilSCORM13Player.php.

1694 {
1695 global $ilLog,$lng;
1696 $lng->loadLanguageModule("scormdebug");
1697
1698 $logdata = json_decode(file_get_contents('php://input'));
1699 $filename = $this->logFileName();
1700 $tmp_name = $this->logTmpName();
1701
1702 $fh_txt = fopen($filename.".html", 'a') or die("can't open txt file");
1703 $fh_csv = fopen($filename.".csv", 'a') or die("can't open csv file");
1704 $fh_tmp = fopen($tmp_name, 'r') or die("can't open tmp file");
1705
1706 //init tmp file
1707 if (filesize($tmp_name)>0) {
1708 $tmp_content = unserialize(fread($fh_tmp,filesize($tmp_name)));
1709 } else {
1710 $tmp_content = null;
1711 }
1712
1713 fclose($fh_tmp);
1714
1715 //reopen for writing
1716 $fh_tmp2 = fopen($tmp_name, 'w') or die("can't open tmp file");
1717
1718
1719 //write tmp
1720 $tmp_content[$logdata->scoid][$logdata->key]['value'] = $logdata->value;
1721 $tmp_content[$logdata->scoid][$logdata->key]['status'] = $logdata->result;
1722 $tmp_content[$logdata->scoid][$logdata->key]['action'] = $logdata->action;
1723
1724 fwrite($fh_tmp2,serialize($tmp_content));
1725 fclose($fh_tmp2);
1726
1727 $timestamp = date("d.m.Y H:i",time());
1728
1729
1730 $errorcode = $logdata->errorcode;
1731 $fixedFailure = false;
1732 $toleratedFailure = false;
1733 $extraErrorDescription = "";
1734 if ($errorcode == 200000) {
1735 $errorcode = 0;
1736 $toleratedFailure = true;
1737 $extraErrorDescription = "tolerated failure";
1738 }
1739 if ($errorcode>99999) {
1740 $errorcode-=100000;
1741 $fixedFailure = true;
1742 $extraErrorDescription = " failure corrected by ILIAS";
1743 }
1744 if (strpos($logdata->action,"ANALYZE")===false)
1745 {
1746 $errorDescriptions = array("0" => "",
1747 "101" => "General Exeption",
1748 "102" => "General Initialization Failure",
1749 "103" => "Already Initialized",
1750 "104" => "Content Instance Terminated",
1751 "111" => "General Termination Failure",
1752 "112" => "Termination Before Initialization",
1753 "113" => "Termination After Termination",
1754 "122" => "Retrieve Data Before Initialization",
1755 "123" => "Retrieve Data After Termination",
1756 "132" => "Store Data Before Initialization",
1757 "133" => "Store Data After Termination",
1758 "142" => "Commit Before Initialization",
1759 "143" => "Commit After Termination",
1760 "201" => "General Argument Error",
1761 "301" => "General Get Failure",
1762 "351" => "General Set Failure",
1763 "391" => "General Commit Failure",
1764 "401" => "Undefined Data Model Element",
1765 "402" => "Unimplemented Data Model Element",
1766 "403" => "Data Model Element Value Not Initialized",
1767 "404" => "Data Model Element Is Read Only",
1768 "405" => "Data Model Element Is Write Only",
1769 "406" => "Data Model Element Type Mismatch",
1770 "407" => "Data Model Element Value Out Of Range",
1771 "408" => "Data Model Dependency Not Established");
1772 $csv_string = $this->packageId.';"'
1773 .$logdata->scoid.'";"'
1774 .$logdata->scotitle.'";'
1775 .date("d.m.Y H:i",time()).';"'
1776 .$logdata->action.'";"'
1777 .$logdata->key.'";"'
1778 .str_replace("\"","\"\"",$logdata->value).'";"'
1779 .str_replace("\"","\"\"",$logdata->result).'";'
1780 .$errorcode.';'
1781 .$logdata->timespan.';"'
1782 .$errorDescriptions[$errorcode].$extraErrorDescription.'"'."\n";
1783 fwrite($fh_csv,$csv_string);
1784 }
1785
1786 $sqlwrite = false;
1787 if($logdata->action == "Commit" || $logdata->action == "Terminate")
1788 {
1789 $sqlwrite = true;
1790 $sql_data = $this->getNodeData($logdata->scoid,$fh_csv);
1791 foreach ($sql_data as $key => $value) {
1792 $sql_string = $this->packageId.';"'
1793 .$logdata->scoid.'";"'
1794 .$logdata->scotitle.'";'
1795 .$timestamp.';"SQL";"'
1796 .$key.'";"'
1797 .str_replace("\"","\"\"",$value).'";;;;'."\n";
1798 fwrite($fh_csv,$sql_string);
1799 }
1800 }
1801
1802 //delete files
1803 if ($logdata->action == "DELETE")
1804 {
1805 $filename = $logdata->value;
1806 $path = $this->logDirectory()."/".$filename;
1807 unlink($path);
1808 return;
1809 }
1810
1811 //write TXT
1812 $logtpl = $this->getLogTemplate();
1813 $color = "red";
1814 $importantkey=1;
1815 $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');
1816
1817 switch ($logdata->action) {
1818 case 'SetValue':
1819 if ($logdata->result == "true" && $errorcode == 0) $color = "green";
1820 if ($color=="green" && $logdata->key == "cmi.exit" && $logdata->value!="suspend") $color = "orange";
1821 if ($fixedFailure == false && $errorcode!=406) $logdata->value = '"'.$logdata->value.'"';
1822 if ($toleratedFailure == true) $color = "fuchsia";
1823 if ($fixedFailure == true) $color = "gray";
1824 break;
1825 case 'GetValue':
1826 if ($errorcode == 0) $color = "green";
1827 break;
1828 case 'Initialize':
1829 if ($errorcode == 0)
1830 {
1831 $color = "green";
1832 $logtpl->setCurrentBlock("InitializeStart");
1833 $logtpl->setVariable("SCO-title", $lng->txt("SCO-title"));
1834 $logtpl->setVariable("SCO_TITLE", $logdata->scotitle);
1835 $logtpl->setVariable("SCO-name", $lng->txt("SCO-name"));
1836 $logtpl->setVariable("SCO_NAME", $logdata->scoid);
1837 $logtpl->setVariable("started", $lng->txt("started"));
1838 $logtpl->setVariable("TIMESTAMP", $timestamp);
1839 $logtpl->setVariable("milliseconds", $lng->txt("milliseconds"));
1840 $logtpl->setVariable("API-call", $lng->txt("API-call"));
1841 $logtpl->setVariable("return_value", $lng->txt("return_value"));
1842 $logtpl->setVariable("error", $lng->txt("error"));
1843 $logtpl->parseCurrentBlock();
1844 }
1845 break;
1846 case 'Commit':
1847 if ($errorcode == 0) $color = "green";
1848 if ($fixedFailure == true) $color = "gray";
1849 break;
1850 case 'Terminate':
1851 if ($errorcode == 0) $color = "green";
1852 break;
1853 case 'GetErrorString':
1854 $importantkey=0;
1855 if ($errorcode == 0) $color = "green";
1856 break;
1857 case 'GetLastError':
1858 $logtpl->setCurrentBlock("GetLastError");
1859 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1860 $logtpl->setVariable("RESULT", $logdata->result);
1861 $logtpl->parseCurrentBlock();
1862 break;
1863 case 'GetDiagnostic':
1864 $logtpl->setCurrentBlock("GetDiagnostic");
1865 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1866 $logtpl->setVariable("KEY", $logdata->key);
1867 $logtpl->setVariable("RESULT", $logdata->result);
1868 $logtpl->parseCurrentBlock();
1869 break;
1870 case 'INFO':
1871 $logtpl->setCurrentBlock("INFO");
1872 $logtpl->setVariable("hint", $lng->txt("hint"));
1873 $logtpl->setVariable("KEY", $lng->txt($logdata->key));
1874 $logtpl->setVariable("VALUE", $logdata->value);
1875 $logtpl->parseCurrentBlock();
1876 break;
1877 case 'COMMENT':
1878 $logtpl->setCurrentBlock("COMMENT");
1879 $logtpl->setVariable("comment", $lng->txt("comment"));
1880 $logtpl->setVariable("generated", $lng->txt("generated"));
1881 $logtpl->setVariable("TIMESTAMP", $timestamp);
1882 $logtpl->setVariable("VALUE", $logdata->value);
1883 $logtpl->parseCurrentBlock();
1884 break;
1885 case 'ANALYZE':
1886 $logtpl->setCurrentBlock("ANALYZE");
1887 if (count($logdata->value) == 0) {
1888 $color = "green";
1889 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("no_missing_API-calls"));
1890 $logtpl->setVariable("VALUE", "");
1891 } else {
1892 $tmpvalue = "SetValue(\"".implode("\", ... ),<br/>SetValue(\"",$logdata->value)."\", ... )";
1893 for ($i=0; $i <count($ArGetValues); $i++){
1894 $tmpvalue = str_replace("SetValue(\"cmi.".$ArGetValues[$i]."\", ... )","GetValue(\"cmi.".$ArGetValues[$i]."\")",$tmpvalue);
1895 }
1896 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("missing_API-calls"));
1897 $logtpl->setVariable("VALUE", $tmpvalue);
1898 }
1899 $logtpl->setVariable("summary_for_SCO_without_test", $lng->txt("summary_for_SCO_without_test"));
1900 $logtpl->setVariable("generated", $lng->txt("generated"));
1901 $logtpl->setVariable("TIMESTAMP", $timestamp);
1902 $logtpl->setVariable("COLOR", $color);
1903 $logtpl->parseCurrentBlock();
1904 break;
1905 case 'ANALYZETEST':
1906 $logtpl->setCurrentBlock("ANALYZETEST");
1907 if (count($logdata->value) == 0) {
1908 $color = "green";
1909 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("no_missing_API-calls"));
1910 $logtpl->setVariable("VALUE", "");
1911 } else {
1912 $tmpvalue = "SetValue(\"".implode("\", ... ),<br/>SetValue(\"",$logdata->value)."\", ... )";
1913 for ($i=0; $i <count($ArGetValues); $i++){
1914 $tmpvalue = str_replace("SetValue(\"cmi.".$ArGetValues[$i]."\", ... )","GetValue(\"cmi.".$ArGetValues[$i]."\")",$tmpvalue);
1915 }
1916 $logtpl->setVariable("ANALYZE_SUMMARY", $lng->txt("missing_API-calls"));
1917 $logtpl->setVariable("VALUE", $tmpvalue);
1918 }
1919 $logtpl->setVariable("summary_for_SCO_with_test", $lng->txt("summary_for_SCO_with_test"));
1920 $logtpl->setVariable("generated", $lng->txt("generated"));
1921 $logtpl->setVariable("TIMESTAMP", $timestamp);
1922 $logtpl->setVariable("COLOR", $color);
1923 $logtpl->parseCurrentBlock();
1924 break;
1925 case 'SUMMARY':
1926 $logtpl->setCurrentBlock("SUMMARY");
1927 $logtpl->setVariable("summary_csv", $lng->txt("summary_csv"));
1928 $logtpl->setVariable("TIMESTAMP", $timestamp);
1929 $logtpl->setVariable("summary_download", $lng->txt("summary_download"));
1930 $logtpl->parseCurrentBlock();
1931 break;
1932 default:
1933 $importantkey=0;
1934 $color = "orange";
1935 break;
1936 }
1937 if ($logdata->action == 'SetValue' || $logdata->action == 'GetValue')
1938 {
1939 $logtpl->setCurrentBlock($logdata->action);
1940 $logtpl->setVariable("ACTION", $logdata->action);
1941 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1942 $logtpl->setVariable("KEY", $logdata->key);
1943 $logtpl->setVariable("VALUE", $logdata->value);
1944 $logtpl->setVariable("RESULT", $logdata->result);
1945 $logtpl->setVariable("ERRORCODE", $errorcode);
1946 $debugfields=$this->getDebugValues(true);
1947 $importantkey=0;
1948 for ($i=0; $i <count($debugfields) ; $i++){
1949 if ($logdata->key == $debugfields[$i]) $importantkey=1;
1950 }
1951 $logtpl->setVariable("IMPORTANTKEY", "".$importantkey);
1952 $logtpl->setVariable("COLOR", $color);
1953 $logtpl->parseCurrentBlock();
1954 }
1955 else if ($logdata->action != 'INFO' && $logdata->action != 'ANALYZE' && $logdata->action != 'ANALYZETEST' && $logdata->action != 'SUMMARY' && $logdata->action != 'COMMENT' && $logdata->action != 'GetDiagnostic' && $logdata->action != 'GetLastError')
1956 {
1957 $logtpl->setCurrentBlock("defaultCall");
1958 $logtpl->setVariable("ACTION", $logdata->action);
1959 $logtpl->setVariable("TIMESPAN", $logdata->timespan);
1960 $logtpl->setVariable("KEY", $logdata->key);
1961 $logtpl->setVariable("VALUE", $logdata->value);
1962 $logtpl->setVariable("RESULT", $logdata->result);
1963 $logtpl->setVariable("ERRORCODE", $errorcode);
1964 $logtpl->setVariable("IMPORTANTKEY", "".$importantkey);
1965 $logtpl->setVariable("COLOR", $color);
1966 $logtpl->parseCurrentBlock();
1967 }
1968
1969 /*
1970 if ($sqlwrite == true) {
1971 $ilLog->write("SQL WRITE");
1972 $logtpl->setCurrentBlock("SqlLog");
1973 $logtpl->setVariable("SQL_STRING", $sql_text);
1974 $logtpl->parseCurrentBlock();
1975 }
1976 */
1977
1978 //create summary
1979 if ($logdata->action == "SUMMARY") {
1980 $this->createSummary($tmp_content);
1981 }
1982
1983 fwrite($fh_txt,$logtpl->get());
1984 fclose($fh_txt);
1985 fclose($fh_csv);
1986 }
$path
Definition: aliased.php:25
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
getNodeData($sco_id, $fh)
createSummary($api_data)

References $filename, $ilLog, $lng, $path, $timestamp, and date.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ quoteJSONArray()

ilSCORM13Player::quoteJSONArray (   $a_array)

Definition at line 1181 of file ilSCORM13Player.php.

1182 {
1183 global $ilDB;
1184
1185 if(!is_array($a_array) or !count($a_array))
1186 {
1187 return array("''");
1188 }
1189
1190 foreach($a_array as $k => $item)
1191 {
1192 if ($item != null) {
1193 $a_array[$k] = $ilDB->quote($item);
1194 } else {
1195 $a_array[$k] = "NULL";
1196 }
1197 }
1198
1199 return $a_array;
1200 }

References $ilDB.

◆ readGObjective()

ilSCORM13Player::readGObjective ( )

Definition at line 778 of file ilSCORM13Player.php.

779 {
780
781 $gobjective_data = json_encode($this->readGObjectiveInit());
782 if ($this->jsMode)
783 {
784 header('Content-Type: text/javascript; charset=UTF-8');
785 print($gobjective_data);
786 }
787 else
788 {
789 header('Content-Type: text/plain; charset=UTF-8');
790 $gobjective_data = json_decode($gobjective_data);
791 print_r($gobjective_data);
792 }
793 }

References print.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ readGObjectiveInit()

ilSCORM13Player::readGObjectiveInit ( )

Definition at line 684 of file ilSCORM13Player.php.

685 {
686 global $ilDB, $ilUser;
687
688 //get json string
689 $g_data = new stdClass();
690
691 $global_to_system = 1;
692
693 $res = $ilDB->queryF('SELECT global_to_system FROM cp_package WHERE obj_id = %s',
694 array('integer'),
695 array($this->packageId)
696 );
697 while($data = $ilDB->fetchAssoc($res))
698 {
699 $global_to_system = $data['global_to_system'];
700 }
701
702 $query = 'SELECT objective_id, scope_id, satisfied, measure, user_id,
703 score_min, score_max, score_raw, completion_status,
704 progress_measure '
705 . 'FROM cmi_gobjective, cp_node, cp_mapinfo '
706 . 'WHERE (cmi_gobjective.objective_id <> %s AND cmi_gobjective.status IS NULL '
707 . 'AND cp_node.slm_id = %s AND cp_node.nodename = %s '
708 . 'AND cp_node.cp_node_id = cp_mapinfo.cp_node_id '
709 . 'AND cmi_gobjective.objective_id = cp_mapinfo.targetobjectiveid) '
710 . 'GROUP BY objective_id, scope_id, satisfied, measure, user_id,
711 score_min, score_max, score_raw, completion_status,
712 progress_measure';
713 $res = $ilDB->queryF(
714 $query,
715 array('text', 'integer', 'text'),
716 array('-course_overall_status-', $this->packageId, 'mapInfo')
717 );
718 while($row = $ilDB->fetchAssoc($res))
719 {
720 if (($global_to_system == 1 && $row['scope_id'] == 0) || ($global_to_system == 0 && $row['scope_id'] == $this->packageId)) {
721 $learner = $row['user_id'];
722 $objective_id = $row['objective_id'];
723 if($row['scope_id'] == 0)
724 {
725 $scope = "null";
726 }
727 else
728 {
729 $scope = $row['scope_id'];
730 }
731
732 if($row['satisfied'] != NULL)
733 {
734 $toset = $row['satisfied'];
735 $g_data->{"satisfied"}->{$objective_id}->{$learner}->{$scope} = $toset;
736 }
737
738 if($row['measure'] != NULL)
739 {
740 $toset = $row['measure'];
741 $g_data->{"measure"}->{$objective_id}->{$learner}->{$scope} = $toset;
742 }
743
744 if($row['score_raw'] != NULL)
745 {
746 $toset = $row['score_raw'];
747 $g_data->{"score_raw"}->{$objective_id}->{$learner}->{$scope} = $toset;
748 }
749
750 if($row['score_min'] != NULL)
751 {
752 $toset = $row['score_min'];
753 $g_data->{"score_min"}->{$objective_id}->{$learner}->{$scope} = $toset;
754 }
755
756 if($row['score_max'] != NULL)
757 {
758 $toset = $row['score_max'];
759 $g_data->{"score_max"}->{$objective_id}->{$learner}->{$scope} = $toset;
760 }
761
762 if($row['progress_measure'] != NULL)
763 {
764 $toset = $row['progress_measure'];
765 $g_data->{"progress_measure"}->{$objective_id}->{$learner}->{$scope} = $toset;
766 }
767
768 if($row['completion_status'] != NULL)
769 {
770 $toset = $row['completion_status'];
771 $g_data->{"completion_status"}->{$objective_id}->{$learner}->{$scope} = $toset;
772 }
773 }
774 }
775 return $g_data;
776 }

References $data, $ilDB, $ilUser, $query, $res, and $row.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ readSharedData()

ilSCORM13Player::readSharedData (   $sco_node_id)

Definition at line 797 of file ilSCORM13Player.php.

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

References $ilDB, $ilUser, $params, $query, $res, $row, and exit.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ resetSharedData()

ilSCORM13Player::resetSharedData ( )

Definition at line 1280 of file ilSCORM13Player.php.

1281 {
1282 global $ilDB;
1283 //Reset the shared data stores if sharedDataGlobalToSystem is false
1284 $res = $ilDB->queryF('
1285 SELECT shared_data_global_to_system
1286 FROM cp_package
1287 WHERE obj_id = %s',
1288 array('integer'),
1289 array($this->packageId)
1290 );
1291
1292 $shared_global_to_sys = $ilDB->fetchObject($res)->shared_data_global_to_system;
1293
1294 $res = $ilDB->queryF('
1295 SELECT data
1296 FROM cp_suspend
1297 WHERE obj_id = %s
1298 AND user_id = %s',
1299 array('integer', 'integer'),
1300 array($this->packageId, $this->userId)
1301 );
1302
1303 $suspended = false;
1304
1305 $dat = $ilDB->fetchObject($res)->data;
1306 if($dat != null && $dat != '' ) $suspended = true;
1307
1308 if($shared_global_to_sys == 0 && !$suspended)
1309 {
1310 $ilDB->manipulateF('
1311 DELETE FROM adl_shared_data
1312 WHERE slm_id = %s
1313 AND user_id = %s',
1314 array('integer', 'integer'),
1315 array($this->packageId, $this->userId)
1316 );
1317 }
1318 }

References $ilDB, and $res.

Referenced by getPlayer().

+ Here is the caller graph for this function:

◆ specialPage()

ilSCORM13Player::specialPage ( )

Definition at line 972 of file ilSCORM13Player.php.

972 {
973
974 global $lng;
975
976 $specialpages = array (
977 "_COURSECOMPLETE_" => "seq_coursecomplete",
978 "_ENDSESSION_" => "seq_endsession",
979 "_SEQBLOCKED_" => "seq_blocked",
980 "_NOTHING_" => "seq_nothing",
981 "_ERROR_" => "seq_error",
982 "_DEADLOCK_" => "seq_deadlock",
983 "_INVALIDNAVREQ_" => "seq_invalidnavreq",
984 "_SEQABANDON_" => "seq_abandon",
985 "_SEQABANDONALL_" => "seq_abandonall",
986 "_TOC_" => "seq_toc"
987 );
988
989 $this->tpl = new ilTemplate("tpl.scorm2004.specialpages.html", false, false, "Modules/Scorm2004");
990 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
991 $this->tpl->setVariable('TXT_SPECIALPAGE',$lng->txt($specialpages[$this->page]));
992 if ($this->page!="_TOC_" && $this->page!="_SEQABANDON_" && $this->page!="_SEQABANDONALL_" ) {
993 $this->tpl->setVariable('CLOSE_WINDOW',$lng->txt('seq_close'));
994 } else {
995 $this->tpl->setVariable('CLOSE_WINDOW',"");
996 }
997 $this->tpl->show("DEFAULT", false);
998 }

References $lng, and ilUtil\getStyleSheetLocation().

Referenced by executeCommand().

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

◆ summaryFileName()

ilSCORM13Player::summaryFileName ( )
private

Definition at line 1358 of file ilSCORM13Player.php.

1359 {
1360 $filename = $this->logDirectory()."/".$this->packageId."_summary_".$this->get_actual_attempts();
1361 $adder = "0";
1362 $suffix = ".csv";
1363 $i = 0;
1364 while (file_exists($filename."_".$adder.$suffix)) {
1365 $i++;
1366 $adder = (string) $i;
1367 }
1368 $retname = $filename."_".$adder.$suffix;
1369
1370 if (!file_exists($retname)) {
1371 umask(0000);
1372 $fHandle = fopen($retname, 'a') or die("can't open file");
1373 fwrite($fHandle, $string);
1374 fclose($fHandle);
1375 }
1376 return $retname;
1377 }

References $filename.

◆ suspendADLActData()

ilSCORM13Player::suspendADLActData ( )

Definition at line 652 of file ilSCORM13Player.php.

653 {
654 global $ilDB, $ilUser;
655
656 $res = $ilDB->queryF(
657 'SELECT * FROM cp_suspend WHERE obj_id = %s AND user_id = %s',
658 array('integer', 'integer'),
659 array($this->packageId, $ilUser->getId())
660 );
661
662 if(!$ilDB->numRows($res))
663 {
664 $ilDB->insert('cp_suspend', array(
665 'data' => array('clob', file_get_contents('php://input')),
666 'obj_id' => array('integer', $this->packageId),
667 'user_id' => array('integer', $ilUser->getId())
668 ));
669 }
670 else
671 {
672 $ilDB->update('cp_suspend',
673 array(
674 'data' => array('clob', file_get_contents('php://input'))
675 ),
676 array(
677 'obj_id' => array('integer', $this->packageId),
678 'user_id' => array('integer', $ilUser->getId())
679 )
680 );
681 }
682 }

References $ilDB, $ilUser, and $res.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ writeSharedData()

ilSCORM13Player::writeSharedData (   $sco_node_id)

Definition at line 891 of file ilSCORM13Player.php.

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

References $ilDB, $ilUser, $query, $res, and $row.

Referenced by executeCommand().

+ Here is the caller graph for this function:

Field Documentation

◆ $ilias

ilSCORM13Player::$ilias

Definition at line 122 of file ilSCORM13Player.php.

Referenced by __construct(), executeCommand(), getConfigForPlayer(), and getPlayer().

◆ $jsMode

ilSCORM13Player::$jsMode

Definition at line 120 of file ilSCORM13Player.php.

◆ $packageId

ilSCORM13Player::$packageId

Definition at line 119 of file ilSCORM13Player.php.

Referenced by getScope().

◆ $schema

ilSCORM13Player::$schema
staticprivate

Definition at line 23 of file ilSCORM13Player.php.

◆ $slm

ilSCORM13Player::$slm

Definition at line 123 of file ilSCORM13Player.php.

◆ $tpl

ilSCORM13Player::$tpl

Definition at line 124 of file ilSCORM13Player.php.

Referenced by __construct().

◆ $userId

ilSCORM13Player::$userId
private

Definition at line 118 of file ilSCORM13Player.php.

◆ ENABLE_GZIP

const ilSCORM13Player::ENABLE_GZIP = 0

Definition at line 16 of file ilSCORM13Player.php.

◆ NONE

const ilSCORM13Player::NONE = 0

Definition at line 18 of file ilSCORM13Player.php.

◆ READONLY

const ilSCORM13Player::READONLY = 1

Definition at line 19 of file ilSCORM13Player.php.

◆ READWRITE

const ilSCORM13Player::READWRITE = 3

Definition at line 21 of file ilSCORM13Player.php.

◆ WRITEONLY

const ilSCORM13Player::WRITEONLY = 2

Definition at line 20 of file ilSCORM13Player.php.


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