19 $revert = array(
'%21'=>
'!',
'%2A'=>
'*',
'%27'=>
"'",
'%28'=>
'(',
'%29'=>
')',
'%7E'=>
'~');
20 return strtr(rawurlencode($str), $revert);
29 $b_storeObjectives=
'false';
30 if ($slm_obj->getObjectives()) {
31 $b_storeObjectives=
'true';
33 $b_storeInteractions=
'false';
34 if ($slm_obj->getInteractions()) {
35 $b_storeInteractions=
'true';
37 $b_readInteractions=
'false';
38 $c_storeSessionTime=
's';
39 if ($slm_obj->getTime_from_lms()) {
40 $c_storeSessionTime=
'i';
42 $i_lessonScoreMax=
'-1';
43 $i_lessonMasteryScore=$slm_obj->getMasteryScore();
46 $b_messageLog=
'false';
47 if (
$ilLog->current_log_level == 30) {
51 if (
$_GET[
"autolaunch"] !=
"") {
52 $launchId=
$_GET[
"autolaunch"];
55 if ($slm_obj->getSession()) {
56 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
59 if ($session_timeout > $max_idle) {
60 $session_timeout = $max_idle;
63 if ($session_timeout > $min_idle) {
64 $session_timeout = $min_idle;
66 $session_timeout -= 10;
68 $b_autoReview=
'false';
69 if ($slm_obj->getAutoReview()) {
72 $b_autoSuspend=
'false';
73 if ($slm_obj->getAutoSuspend()) {
74 $b_autoSuspend=
'true';
77 if ($slm_obj->getDebug()) {
80 $b_autoContinue=
'false';
81 if ($slm_obj->getAutoContinue()) {
82 $b_autoContinue=
'true';
84 $b_checkSetValues=
'false';
85 if ($slm_obj->getCheck_values()) {
86 $b_checkSetValues=
'true';
88 $b_autoLastVisited=
'false';
89 if ($slm_obj->getAuto_last_visited()) {
90 $b_autoLastVisited=
'true';
91 if ($launchId ==
'0') {
92 $launchId=$slm_obj->getLastVisited(
$ilUser->getID());
96 $b_sessionDeactivated=
'false';
97 if ($slm_obj->getSessionDeactivated()) {
98 $b_sessionDeactivated=
'true';
104 $val_set =
$ilDB->queryF(
106 SELECT sc_item.obj_id,prereq_type,prerequisites,maxtimeallowed,timelimitaction,datafromlms,masteryscore
107 FROM sc_item, scorm_object
108 WHERE scorm_object.obj_id=sc_item.obj_id
109 AND scorm_object.c_type = %s
110 AND scorm_object.slm_id = %s',
111 array(
'text',
'integer'),
112 array(
'sit',$slm_obj->getId())
114 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
115 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) {
116 $tmp_man=array((
int) $val_rec[
"obj_id"],
null,
null,
null,
null,
null,
null);
117 if ($val_rec[
"prereq_type"]!=
null) {
120 if ($val_rec[
"prerequisites"]!=
null) {
123 if ($val_rec[
"maxtimeallowed"]!=
null) {
126 if ($val_rec[
"timelimitaction"]!=
null) {
129 if ($val_rec[
"datafromlms"]!=
null) {
132 if ($val_rec[
"masteryscore"]!=
null) {
140 .
'"refId":' .
$_GET[
"ref_id"] .
','
141 .
'"objId":' . $slm_obj->getId() .
','
142 .
'"clientId":"' . CLIENT_ID .
'",'
143 .
'"launchId":' . $launchId .
','
145 .
'"pingSession":' . $session_timeout .
','
146 .
'"studentId":"' . $slm_obj->getApiStudentId() .
'",'
150 .
'"credit":"' . str_replace(
"_",
"-", $slm_obj->getCreditMode()) .
'",'
151 .
'"lesson_mode":"' . $slm_obj->getDefaultLessonMode() .
'",'
152 .
'"b_autoReview":' . $b_autoReview .
','
153 .
'"b_autoSuspend":' . $b_autoSuspend .
','
154 .
'"b_messageLog":' . $b_messageLog .
','
155 .
'"b_checkSetValues":' . $b_checkSetValues .
','
156 .
'"b_storeObjectives":' . $b_storeObjectives .
','
157 .
'"b_storeInteractions":' . $b_storeInteractions .
','
158 .
'"b_readInteractions":' . $b_readInteractions .
','
159 .
'"c_storeSessionTime":"' . $c_storeSessionTime .
'",'
160 .
'"b_autoContinue":' . $b_autoContinue .
','
161 .
'"b_autoLastVisited":' . $b_autoLastVisited .
','
162 .
'"b_sessionDeactivated":' . $b_sessionDeactivated .
','
163 .
'"i_lessonScoreMax":' . $i_lessonScoreMax .
','
164 .
'"i_lessonMasteryScore":"' . $i_lessonMasteryScore .
'",'
165 .
'"b_debug":' . $b_debug .
','
166 .
'"a_itemParameter":' . json_encode($a_man) .
','
167 .
'"status":' . json_encode(self::getStatus($slm_obj->getId(),
$ilUser->getID(), $slm_obj->getAuto_last_visited())) .
','
197 $b_readInteractions=
'false';
199 $tquery =
'SELECT sco_id,lvalue,rvalue FROM scorm_tracking '
200 .
'WHERE user_id = %s AND obj_id = %s '
201 .
"AND sco_id > 0 AND lvalue != 'cmi.core.entry' AND lvalue != 'cmi.core.session_time'";
202 if ($b_readInteractions ==
'false') {
203 $tquery.=
" AND SUBSTR(lvalue, 1, 16) != 'cmi.interactions'";
205 $val_set =
$ilDB->queryF(
207 array(
'integer',
'integer'),
208 array(
$ilUser->getId(),$a_packageId)
210 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
211 if (!strpos($val_rec[
"lvalue"],
"._count")) {
212 $a_out[]=array( (
int) $val_rec[
"sco_id"], $val_rec[
"lvalue"], self::encodeURIComponent($val_rec[
"rvalue"]) );
215 return json_encode($a_out);
220 global $ilias,
$ilDB;
224 $val_set =
$ilDB->queryF(
226 SELECT sc_resource.obj_id
227 FROM scorm_tree, sc_resource
228 WHERE scorm_tree.slm_id=%s
229 AND sc_resource.obj_id=scorm_tree.child",
233 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
234 $s_resourceIds .=
"," . $val_rec[
"obj_id"];
236 $s_resourceIds = substr($s_resourceIds, 1);
238 $tquery=
"SELECT scorm_tree.lft, scorm_tree.child,
239 CASE WHEN sc_resource.scormtype = 'asset' THEN 1 ELSE 0 END AS asset,
241 FROM scorm_tree, sc_resource, sc_item
242 WHERE scorm_tree.slm_id=%s
243 AND sc_item.obj_id=scorm_tree.child
244 AND sc_resource.import_id=sc_item.identifierref
245 AND sc_resource.obj_id in (" . $s_resourceIds .
")
246 ORDER BY scorm_tree.lft";
247 $val_set =
$ilDB->queryF(
252 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
254 $a_out[]=array( (
int) $val_rec[
"lft"], (
int) $val_rec[
"child"], (
int) $val_rec[
"asset"], self::encodeURIComponent($val_rec[
"href"]) );
258 return json_encode($a_out);
263 global $ilias,
$ilDB;
265 $tquery=
"SELECT scorm_tree.child, scorm_tree.depth-3 depth, scorm_object.title, scorm_object.c_type
266 FROM scorm_tree, scorm_object
267 WHERE scorm_object.obj_id=scorm_tree.child
268 AND scorm_tree.slm_id=%s
269 AND (scorm_object.c_type='sor' OR scorm_object.c_type='sit')
270 ORDER BY scorm_tree.lft";
271 $val_set =
$ilDB->queryF(
276 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
277 $a_out[]=array((
int) $val_rec[
"child"],(
int) $val_rec[
"depth"],self::encodeURIComponent($val_rec[
"title"]),$val_rec[
"c_type"]);
279 return json_encode($a_out);
282 public static function getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType=
"1.2")
285 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
287 $status[
'saved_global_status']=(int) $oldStatus;
288 include_once
'./Services/Object/classes/class.ilObjectLP.php';
290 $status[
'lp_mode'] = $olp->getCurrentMode();
291 $collection = $olp->getCollectionInstance();
293 $status[
'scos'] = $collection->getItems();
295 $status[
'scos'] = array();
298 $status[
'p'] = $a_user_id;
300 $status[
'last_visited'] =
null;
301 $status[
'total_time_sec'] = 0;
302 $val_set =
$ilDB->queryF(
303 'SELECT last_visited, sco_total_time_sec, total_time_sec FROM sahs_user WHERE obj_id = %s AND user_id = %s',
304 array(
'integer',
'integer'),
305 array($a_packageId,$a_user_id)
307 $val_rec =
$ilDB->fetchAssoc($val_set);
308 if ($auto_last_visited) {
309 $status[
'last_visited'] = $val_rec[
"last_visited"];
311 if ($val_rec[
"total_time_sec"]==
null) {
312 if ($val_rec[
"sco_total_time_sec"]==
null) {
314 if ($scormType ==
"2004") {
315 include_once
'./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
319 $status[
'total_time_sec'] = (int) $val_rec[
"sco_total_time_sec"];
322 $status[
'total_time_sec'] = (int) $val_rec[
"total_time_sec"];
330 private static function setHash($a_packageId, $a_user_id)
333 $hash = mt_rand(1000000000, 2147483647);
337 'SELECT count(*) cnt FROM sahs_user WHERE obj_id = %s AND user_id = %s',
338 array(
'integer',
'integer'),
339 array($a_packageId,$a_user_id)
342 if ($val_rec[
"cnt"] == 0) {
344 'INSERT INTO sahs_user (obj_id, user_id, hash, hash_end) VALUES(%s, %s, %s, %s)',
345 array(
'integer',
'integer',
'text',
'timestamp'),
346 array($a_packageId, $a_user_id,
"" . $hash, $endDate)
350 'UPDATE sahs_user SET hash = %s, hash_end = %s WHERE obj_id = %s AND user_id = %s',
351 array(
'text',
'timestamp',
'integer',
'integer'),
352 array(
"" . $hash, $endDate, $a_packageId, $a_user_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
Class ilObjSCORMInitData.
static encodeURIComponent($str)
static getIliasScormData($a_packageId)
static getIliasScormVars($slm_obj)
static get_max_attempts($a_packageId)
Get max.
static getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType="1.2")
static getIliasScormResources($a_packageId)
static setHash($a_packageId, $a_user_id)
static getIliasScormTree($a_packageId)
static getInstance($a_obj_id)
static getSumTotalTimeSecondsFromScos($a_obj_id, $a_user_id, $a_write=false)
should be avoided; store value to increase performance for further requests
static getIdleValue($fixedMode=false)
Returns the idle time in seconds.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getCookieMaxLifetimeInSeconds()
foreach($_POST as $key=> $value) $res