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=
'-1';
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 $session_timeout = (int)($ilias->ini->readVariable(
"session",
"expire"))/2;
47 $b_autoReview=
'false';
48 if ($slm_obj->getAutoReview()) $b_autoReview=
'true';
50 if ($slm_obj->getDebug()) $b_debug=
'true';
51 $b_autoContinue=
'false';
52 if ($slm_obj->getAutoContinue()) $b_autoContinue=
'true';
53 $b_checkSetValues=
'false';
54 if ($slm_obj->getCheck_values()) $b_checkSetValues=
'true';
55 $b_autoLastVisited=
'false';
56 if ($slm_obj->getAuto_last_visited()) {
57 $b_autoLastVisited=
'true';
58 if ($launchId ==
'0') $launchId=$slm_obj->getLastVisited($ilUser->getID());
64 $val_set = $ilDB->queryF(
' 65 SELECT sc_item.obj_id,prereq_type,prerequisites,maxtimeallowed,timelimitaction,datafromlms,masteryscore 66 FROM sc_item, scorm_object 67 WHERE scorm_object.obj_id=sc_item.obj_id 68 AND scorm_object.c_type = %s 69 AND scorm_object.slm_id = %s',
70 array(
'text',
'integer'),
71 array(
'sit',$slm_obj->getId())
73 while($val_rec = $ilDB->fetchAssoc($val_set)) {
74 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) {
75 $tmp_man=array((
int)$val_rec[
"obj_id"],null,null,null,null,null,null);
76 if($val_rec[
"prereq_type"]!=null) $tmp_man[1]=self::encodeURIComponent($val_rec[
"prereq_type"]);
77 if($val_rec[
"prerequisites"]!=null) $tmp_man[2]=self::encodeURIComponent($val_rec[
"prerequisites"]);
78 if($val_rec[
"maxtimeallowed"]!=null) $tmp_man[3]=self::encodeURIComponent($val_rec[
"maxtimeallowed"]);
79 if($val_rec[
"timelimitaction"]!=null) $tmp_man[4]=self::encodeURIComponent($val_rec[
"timelimitaction"]);
80 if($val_rec[
"datafromlms"]!=null) $tmp_man[5]=self::encodeURIComponent($val_rec[
"datafromlms"]);
81 if($val_rec[
"masteryscore"]!=null) $tmp_man[6]=self::encodeURIComponent($val_rec[
"masteryscore"]);
87 .
'"refId":'.
$_GET[
"ref_id"].
',' 88 .
'"objId":'.$slm_obj->getId().
',' 89 .
'"launchId":'.$launchId.
',' 91 .
'"pingSession":'. $session_timeout.
',' 92 .
'"studentId":'.$ilias->account->getId().
',' 93 .
'"studentName":"'.self::encodeURIComponent($ilias->account->getLastname().
', '.$ilias->account->getFirstname()).
'",' 94 .
'"studentLogin":"'.self::encodeURIComponent($ilias->account->getLogin()).
'",' 95 .
'"studentOu":"'.self::encodeURIComponent($ilias->account->getDepartment()).
'",' 96 .
'"credit":"'.str_replace(
"_",
"-", $slm_obj->getCreditMode()).
'",' 97 .
'"lesson_mode":"'.$slm_obj->getDefaultLessonMode().
'",' 98 .
'"b_autoReview":'.$b_autoReview.
',' 99 .
'"b_messageLog":'.$b_messageLog.
',' 100 .
'"b_checkSetValues":'.$b_checkSetValues.
',' 101 .
'"b_storeObjectives":'.$b_storeObjectives.
',' 102 .
'"b_storeInteractions":'.$b_storeInteractions.
',' 103 .
'"b_readInteractions":'.$b_readInteractions.
',' 104 .
'"c_storeSessionTime":"'.$c_storeSessionTime.
'",' 105 .
'"b_autoContinue":'.$b_autoContinue.
',' 106 .
'"b_autoLastVisited":'.$b_autoLastVisited.
',' 107 .
'"i_lessonScoreMax":'.$i_lessonScoreMax.
',' 108 .
'"i_lessonMasteryScore":'.$i_lessonMasteryScore.
',' 109 .
'"b_debug":'.$b_debug.
',' 110 .
'"a_itemParameter":'.json_encode($a_man).
',' 111 .
'"status":'.json_encode(self::getStatus($slm_obj->getId(), $ilUser->getID())).
',' 112 .
'"dataDirectory":"'.self::encodeURIComponent($slm_obj->getDataDirectory(
"output").
'/').
'",' 119 .
'"not_attempted":"'.self::encodeURIComponent(
ilUtil::getImagePath(
'scorm/not_attempted.png')).
'",' 124 .
'"wait":"'.self::encodeURIComponent($lng->txt(
"please_wait")).
'",' 125 .
'"status":"'.self::encodeURIComponent($lng->txt(
"cont_status")).
'",' 126 .
'"browsed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_browsed")).
'",' 127 .
'"completed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_completed")).
'",' 128 .
'"failed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_failed")).
'",' 129 .
'"incomplete":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_incomplete")).
'",' 130 .
'"not_attempted":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_not_attempted")).
'",' 131 .
'"passed":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_passed")).
'",' 132 .
'"running":"'.self::encodeURIComponent($lng->txt(
"cont_sc_stat_running")).
'"' 140 $b_readInteractions=
'false';
142 $tquery =
'SELECT sco_id,lvalue,rvalue FROM scorm_tracking ' 143 .
'WHERE user_id = %s AND obj_id = %s ' 144 .
"AND sco_id > 0 AND lvalue != 'cmi.core.entry' AND lvalue != 'cmi.core.session_time'";
145 if ($b_readInteractions ==
'false') $tquery.=
" AND SUBSTR(lvalue, 1, 16) != 'cmi.interactions'";
146 $val_set = $ilDB->queryF($tquery,
147 array(
'integer',
'integer'),
148 array($ilUser->getId(),$a_packageId)
150 while($val_rec = $ilDB->fetchAssoc($val_set)) {
151 if (!strpos($val_rec[
"lvalue"],
"._count"))
152 $a_out[]=array( (
int)$val_rec[
"sco_id"], $val_rec[
"lvalue"], self::encodeURIComponent($val_rec[
"rvalue"]) );
154 return json_encode($a_out);
158 global $ilias, $ilDB;
162 $val_set = $ilDB->queryF(
" 163 SELECT sc_resource.obj_id 164 FROM scorm_tree, sc_resource 165 WHERE scorm_tree.slm_id=%s 166 AND sc_resource.obj_id=scorm_tree.child",
170 while($val_rec = $ilDB->fetchAssoc($val_set)) {
171 $s_resourceIds .=
",".$val_rec[
"obj_id"];
173 $s_resourceIds = substr($s_resourceIds,1);
175 $tquery=
"SELECT scorm_tree.lft, scorm_tree.child, 176 CASE WHEN sc_resource.scormtype = 'asset' THEN 1 ELSE 0 END AS asset, 178 FROM scorm_tree, sc_resource, sc_item 179 WHERE scorm_tree.slm_id=%s 180 AND sc_item.obj_id=scorm_tree.child 181 AND sc_resource.import_id=sc_item.identifierref 182 AND sc_resource.obj_id in (".$s_resourceIds.
") 183 ORDER BY scorm_tree.lft";
184 $val_set = $ilDB->queryF($tquery,
188 while($val_rec = $ilDB->fetchAssoc($val_set)) {
190 $a_out[]=array( (
int)$val_rec[
"lft"], (
int)$val_rec[
"child"], (
int)$val_rec[
"asset"], self::encodeURIComponent($val_rec[
"href"]) );
194 return json_encode($a_out);
198 global $ilias, $ilDB;
200 $tquery=
"SELECT scorm_tree.child, scorm_tree.depth-3 depth, scorm_object.title, scorm_object.c_type 201 FROM scorm_tree, scorm_object 202 WHERE scorm_object.obj_id=scorm_tree.child 203 AND scorm_tree.slm_id=%s 204 AND (scorm_object.c_type='sor' OR scorm_object.c_type='sit') 205 ORDER BY scorm_tree.lft";
206 $val_set = $ilDB->queryF($tquery,
210 while($val_rec = $ilDB->fetchAssoc($val_set)) {
211 $a_out[]=array((
int)$val_rec[
"child"],(
int)$val_rec[
"depth"],self::encodeURIComponent($val_rec[
"title"]),$val_rec[
"c_type"]);
213 return json_encode($a_out);
217 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
219 $status[
'saved_global_status']=(int) $oldStatus;
220 include_once
'./Services/Object/classes/class.ilObjectLP.php';
222 $status[
'lp_mode'] = $olp->getCurrentMode();
223 $collection = $olp->getCollectionInstance();
226 $status[
'scos'] = $collection->getItems();
228 else $status[
'scos'] = array();
230 $status[
'p'] = $a_user_id;
234 private function setHash($a_packageId,$a_user_id) {
236 $hash = mt_rand(1000000000,9999999999);
237 $endDate = date(
'Y-m-d H:i:s', mktime(date(
'H'), date(
'i'), date(
's'), date(
'm'), date(
'd')+1, date(
'Y')));
239 $res = $ilDB->queryF(
'SELECT count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s',
240 array(
'integer',
'integer'),
241 array($a_packageId,$a_user_id)
243 $val_rec = $ilDB->fetchAssoc(
$res);
244 if ($val_rec[
"cnt"] == 0) {
245 $ilDB->manipulateF(
'INSERT INTO sahs_user (obj_id, user_id, hash, hash_end) VALUES(%s, %s, %s, %s)',
246 array(
'integer',
'integer',
'text',
'timestamp'),
247 array($a_packageId, $a_user_id,
"".$hash, $endDate)
252 $ilDB->manipulateF(
'UPDATE sahs_user SET hash = %s, hash_end = %s WHERE obj_id = %s AND user_id = %s',
253 array(
'text',
'timestamp',
'integer',
'integer'),
254 array(
"".$hash, $endDate, $a_packageId, $a_user_id)
276 $res = $ilDB->queryF(
277 'SELECT max_attempt FROM sahs_lm WHERE id = %s',
283 return $row[
'max_attempt'];
static _lookupStatus($a_obj_id, $a_user_id)
Lookup status.
getIliasScormData($a_packageId)
getIliasScormVars($slm_obj)
setHash($a_packageId, $a_user_id)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getIliasScormResources($a_packageId)
get_max_attempts($a_packageId)
Get max.
getIliasScormTree($a_packageId)
static getInstance($a_obj_id)
getStatus($a_packageId, $a_user_id)
Class ilObjSCORMInitData.