19 $revert =
array(
'%21'=>
'!',
'%2A'=>
'*',
'%27'=>
"'",
'%28'=>
'(',
'%29'=>
')',
'%7E'=>
'~');
20 return strtr(rawurlencode($str), $revert);
28 $b_storeObjectives=
'false';
29 if ($slm_obj->getObjectives()) $b_storeObjectives=
'true';
30 $b_storeInteractions=
'false';
31 if ($slm_obj->getInteractions()) $b_storeInteractions=
'true';
32 $b_readInteractions=
'false';
33 $c_storeSessionTime=
's';
34 if ($slm_obj->getTime_from_lms()) $c_storeSessionTime=
'i';
35 $i_lessonScoreMax=
'-1';
36 $i_lessonMasteryScore=$slm_obj->getMasteryScore();
39 $b_messageLog=
'false';
40 if ($ilLog->current_log_level == 30) $b_messageLog=
'true';
42 if (
$_GET[
"autolaunch"] !=
"") $launchId=
$_GET[
"autolaunch"];
44 if ($slm_obj->getSession()) {
45 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
48 if ($session_timeout > $max_idle) $session_timeout = $max_idle;
50 if ($session_timeout > $min_idle) $session_timeout = $min_idle;
51 $session_timeout -= 10;
53 $b_autoReview=
'false';
54 if ($slm_obj->getAutoReview()) $b_autoReview=
'true';
56 if ($slm_obj->getDebug()) $b_debug=
'true';
57 $b_autoContinue=
'false';
58 if ($slm_obj->getAutoContinue()) $b_autoContinue=
'true';
59 $b_checkSetValues=
'false';
60 if ($slm_obj->getCheck_values()) $b_checkSetValues=
'true';
61 $b_autoLastVisited=
'false';
62 if ($slm_obj->getAuto_last_visited()) {
63 $b_autoLastVisited=
'true';
64 if ($launchId ==
'0') $launchId=$slm_obj->getLastVisited($ilUser->getID());
67 $b_sessionDeactivated=
'false';
68 if ($slm_obj->getSessionDeactivated()) $b_sessionDeactivated=
'true';
73 $val_set = $ilDB->queryF(
' 74 SELECT sc_item.obj_id,prereq_type,prerequisites,maxtimeallowed,timelimitaction,datafromlms,masteryscore 75 FROM sc_item, scorm_object 76 WHERE scorm_object.obj_id=sc_item.obj_id 77 AND scorm_object.c_type = %s 78 AND scorm_object.slm_id = %s',
79 array(
'text',
'integer'),
80 array(
'sit',$slm_obj->getId())
82 while($val_rec = $ilDB->fetchAssoc($val_set)) {
83 if($val_rec[
"prereq_type"]!=null || $val_rec[
"prerequisites"]!=null || $val_rec[
"maxtimeallowed"]!=null || $val_rec[
"timelimitaction"]!=null || $val_rec[
"datafromlms"]!=null || $val_rec[
"masteryscore"]!=null) {
84 $tmp_man=
array((
int)$val_rec[
"obj_id"],null,null,null,null,null,null);
85 if($val_rec[
"prereq_type"]!=null) $tmp_man[1]=self::encodeURIComponent($val_rec[
"prereq_type"]);
86 if($val_rec[
"prerequisites"]!=null) $tmp_man[2]=self::encodeURIComponent($val_rec[
"prerequisites"]);
87 if($val_rec[
"maxtimeallowed"]!=null) $tmp_man[3]=self::encodeURIComponent($val_rec[
"maxtimeallowed"]);
88 if($val_rec[
"timelimitaction"]!=null) $tmp_man[4]=self::encodeURIComponent($val_rec[
"timelimitaction"]);
89 if($val_rec[
"datafromlms"]!=null) $tmp_man[5]=self::encodeURIComponent($val_rec[
"datafromlms"]);
90 if($val_rec[
"masteryscore"]!=null) $tmp_man[6]=self::encodeURIComponent($val_rec[
"masteryscore"]);
96 .
'"refId":'.
$_GET[
"ref_id"].
',' 97 .
'"objId":'.$slm_obj->getId().
',' 98 .
'"clientId":"'.CLIENT_ID.
'",' 99 .
'"launchId":'.$launchId.
',' 101 .
'"pingSession":'. $session_timeout.
',' 102 .
'"studentId":'.$ilias->account->getId().
',' 103 .
'"studentName":"'.self::encodeURIComponent($ilias->account->getLastname().
', '.$ilias->account->getFirstname()).
'",' 104 .
'"studentLogin":"'.self::encodeURIComponent($ilias->account->getLogin()).
'",' 105 .
'"studentOu":"'.self::encodeURIComponent($ilias->account->getDepartment()).
'",' 106 .
'"credit":"'.str_replace(
"_",
"-", $slm_obj->getCreditMode()).
'",' 107 .
'"lesson_mode":"'.$slm_obj->getDefaultLessonMode().
'",' 108 .
'"b_autoReview":'.$b_autoReview.
',' 109 .
'"b_messageLog":'.$b_messageLog.
',' 110 .
'"b_checkSetValues":'.$b_checkSetValues.
',' 111 .
'"b_storeObjectives":'.$b_storeObjectives.
',' 112 .
'"b_storeInteractions":'.$b_storeInteractions.
',' 113 .
'"b_readInteractions":'.$b_readInteractions.
',' 114 .
'"c_storeSessionTime":"'.$c_storeSessionTime.
'",' 115 .
'"b_autoContinue":'.$b_autoContinue.
',' 116 .
'"b_autoLastVisited":'.$b_autoLastVisited.
',' 117 .
'"b_sessionDeactivated":'.$b_sessionDeactivated.
',' 118 .
'"i_lessonScoreMax":'.$i_lessonScoreMax.
',' 119 .
'"i_lessonMasteryScore":"'.$i_lessonMasteryScore.
'",' 120 .
'"b_debug":'.$b_debug.
',' 121 .
'"a_itemParameter":'.json_encode($a_man).
',' 122 .
'"status":'.json_encode(self::getStatus($slm_obj->getId(), $ilUser->getID(), $slm_obj->getAuto_last_visited())).
',' 123 .
'"dataDirectory":"'.self::encodeURIComponent($slm_obj->getDataDirectory(
"output").
'/').
'",' 130 .
'"not_attempted":"'.self::encodeURIComponent(
ilUtil::getImagePath(
'scorm/not_attempted.svg')).
'",' 135 .
'"wait":"'.self::encodeURIComponent($lng->txt(
"please_wait")).
'",' 136 .
'"status":"'.self::encodeURIComponent($lng->txt(
"cont_status")).
'",' 137 .
'"browsed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_browsed")).
'",' 138 .
'"completed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_completed")).
'",' 139 .
'"failed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_failed")).
'",' 140 .
'"incomplete":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_incomplete")).
'",' 141 .
'"not_attempted":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_not_attempted")).
'",' 142 .
'"passed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_passed")).
'",' 143 .
'"running":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_running")).
'"' 151 $b_readInteractions=
'false';
153 $tquery =
'SELECT sco_id,lvalue,rvalue FROM scorm_tracking ' 154 .
'WHERE user_id = %s AND obj_id = %s ' 155 .
"AND sco_id > 0 AND lvalue != 'cmi.core.entry' AND lvalue != 'cmi.core.session_time'";
156 if ($b_readInteractions ==
'false') $tquery.=
" AND SUBSTR(lvalue, 1, 16) != 'cmi.interactions'";
157 $val_set = $ilDB->queryF($tquery,
158 array(
'integer',
'integer'),
159 array($ilUser->getId(),$a_packageId)
161 while($val_rec = $ilDB->fetchAssoc($val_set)) {
162 if (!strpos($val_rec[
"lvalue"],
"._count"))
163 $a_out[]=
array( (
int)$val_rec[
"sco_id"], $val_rec[
"lvalue"], self::encodeURIComponent($val_rec[
"rvalue"]) );
165 return json_encode($a_out);
169 global $ilias,
$ilDB;
173 $val_set = $ilDB->queryF(
" 174 SELECT sc_resource.obj_id 175 FROM scorm_tree, sc_resource 176 WHERE scorm_tree.slm_id=%s 177 AND sc_resource.obj_id=scorm_tree.child",
181 while($val_rec = $ilDB->fetchAssoc($val_set)) {
182 $s_resourceIds .=
",".$val_rec[
"obj_id"];
184 $s_resourceIds = substr($s_resourceIds,1);
186 $tquery=
"SELECT scorm_tree.lft, scorm_tree.child, 187 CASE WHEN sc_resource.scormtype = 'asset' THEN 1 ELSE 0 END AS asset, 189 FROM scorm_tree, sc_resource, sc_item 190 WHERE scorm_tree.slm_id=%s 191 AND sc_item.obj_id=scorm_tree.child 192 AND sc_resource.import_id=sc_item.identifierref 193 AND sc_resource.obj_id in (".$s_resourceIds.
") 194 ORDER BY scorm_tree.lft";
195 $val_set = $ilDB->queryF($tquery,
199 while($val_rec = $ilDB->fetchAssoc($val_set)) {
201 $a_out[]=
array( (
int)$val_rec[
"lft"], (
int)$val_rec[
"child"], (
int)$val_rec[
"asset"], self::encodeURIComponent($val_rec[
"href"]) );
205 return json_encode($a_out);
209 global $ilias,
$ilDB;
211 $tquery=
"SELECT scorm_tree.child, scorm_tree.depth-3 depth, scorm_object.title, scorm_object.c_type 212 FROM scorm_tree, scorm_object 213 WHERE scorm_object.obj_id=scorm_tree.child 214 AND scorm_tree.slm_id=%s 215 AND (scorm_object.c_type='sor' OR scorm_object.c_type='sit') 216 ORDER BY scorm_tree.lft";
217 $val_set = $ilDB->queryF($tquery,
221 while($val_rec = $ilDB->fetchAssoc($val_set)) {
222 $a_out[]=
array((
int)$val_rec[
"child"],(
int)$val_rec[
"depth"],self::encodeURIComponent($val_rec[
"title"]),$val_rec[
"c_type"]);
224 return json_encode($a_out);
227 static function getStatus($a_packageId,$a_user_id,$auto_last_visited,$scormType=
"1.2") {
229 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
231 $status[
'saved_global_status']=(int) $oldStatus;
232 include_once
'./Services/Object/classes/class.ilObjectLP.php';
234 $status[
'lp_mode'] = $olp->getCurrentMode();
235 $collection = $olp->getCollectionInstance();
238 $status[
'scos'] = $collection->getItems();
240 else $status[
'scos'] =
array();
242 $status[
'p'] = $a_user_id;
244 $status[
'last_visited'] = null;
245 $status[
'total_time_sec'] = 0;
246 $val_set = $ilDB->queryF(
247 'SELECT last_visited, sco_total_time_sec, total_time_sec FROM sahs_user WHERE obj_id = %s AND user_id = %s',
248 array(
'integer',
'integer'),
249 array($a_packageId,$a_user_id));
250 $val_rec = $ilDB->fetchAssoc($val_set);
251 if($auto_last_visited) $status[
'last_visited'] = $val_rec[
"last_visited"];
252 if ($val_rec[
"total_time_sec"]==null) {
253 if ($val_rec[
"sco_total_time_sec"]==null) {
255 if ($scormType ==
"2004") {
256 include_once
'./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
260 $status[
'total_time_sec'] = (int) $val_rec[
"sco_total_time_sec"];
263 $status[
'total_time_sec'] = (int) $val_rec[
"total_time_sec"];
271 private static function setHash($a_packageId,$a_user_id) {
273 $hash = mt_rand(1000000000,2147483647);
276 $res = $ilDB->queryF(
'SELECT count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s',
277 array(
'integer',
'integer'),
278 array($a_packageId,$a_user_id)
280 $val_rec = $ilDB->fetchAssoc(
$res);
281 if ($val_rec[
"cnt"] == 0) {
282 $ilDB->manipulateF(
'INSERT INTO sahs_user (obj_id, user_id, hash, hash_end) VALUES(%s, %s, %s, %s)',
283 array(
'integer',
'integer',
'text',
'timestamp'),
284 array($a_packageId, $a_user_id,
"".$hash, $endDate)
289 $ilDB->manipulateF(
'UPDATE sahs_user SET hash = %s, hash_end = %s WHERE obj_id = %s AND user_id = %s',
290 array(
'text',
'timestamp',
'integer',
'integer'),
291 array(
"".$hash, $endDate, $a_packageId, $a_user_id)
static getIliasScormData($a_packageId)
static getIliasScormResources($a_packageId)
static getCookieMaxLifetimeInSeconds()
static setHash($a_packageId, $a_user_id)
static getIliasScormVars($slm_obj)
static encodeURIComponent($str)
static get_max_attempts($a_packageId)
Get max.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
Create styles array
The data for the language used.
static getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType="1.2")
static getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id, $a_write=false)
should be avoided; store value to increase performance for further requests
static getInstance($a_obj_id)
Class ilObjSCORMInitData.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
static getIliasScormTree($a_packageId)