function il2sop() { global $ilUser, $ilias; $this->setOfflineMode("il2sop"); header('Content-Type: text/javascript; charset=UTF-8'); include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $ob = new ilObjSAHSLearningModule($this->id); $module_version = $ob->getModuleVersion(); $sahs_user = $this->il2sopSahsUser(); $support_mail = ""; //TODO $scorm_version = "1.2"; if ($this->type == "scorm2004") { $scorm_version = "2004"; } $tree = ""; $learning_progress_enabled = 1; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->obj_id); if ($olp->getCurrentMode() == 0) { $learning_progress_enabled = 0; } $certificate_enabled = 0; $adlact_data = null; $ilias_version = $ilias->getSetting("ilias_version"); if ($this->type == 'scorm2004') { include_once "./Modules/Scorm2004/classes/ilSCORM13Player.php"; $ob2004 = new ilSCORM13Player(); $init_data = $ob2004->getConfigForPlayer(); $resources = json_decode($ob2004->getCPDataInit()); $cmi = $ob2004->getCMIData($ilUser->getID(), $this->obj_id); $max_attempt = $ob2004->get_max_attempts(); $adlact_data = json_decode($ob2004->getADLActDataInit()); //$globalobj_data = $ob2004->readGObjectiveInit(); } else { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php"; $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]); $init_data = ilObjSCORMInitData::getIliasScormVars($slm_obj); $resources = json_decode(ilObjSCORMInitData::getIliasScormResources($this->obj_id)); $tree = json_decode(ilObjSCORMInitData::getIliasScormTree($this->obj_id)); $cmi = json_decode(ilObjSCORMInitData::getIliasScormData($this->obj_id)); $max_attempt = ilObjSCORMInitData::get_max_attempts($this->obj_id); } if ($max_attempt == null) { $max_attempt = 0; } $result = array('client_data' => array($support_mail), 'user_data' => $this->il2sopUserData(), 'lm' => array(ilObject::_lookupTitle($this->obj_id), ilObject::_lookupDescription($this->obj_id), $scorm_version, 1, $init_data, $resources, $tree, $module_version, "", $learning_progress_enabled, $certificate_enabled, $max_attempt, $adlact_data, $ilias_version), 'sahs_user' => $sahs_user, 'cmi' => $cmi); print json_encode($result); }
/** * Get max. number of attempts allowed for this package */ function get_max_attempts() { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php"; return ilObjSCORMInitData::get_max_attempts($this->packageId); }
function getStatus($a_packageId, $a_user_id, $auto_last_visited, $scormType = "1.2") { global $ilDB; include_once './Services/Tracking/classes/class.ilLPStatus.php'; $oldStatus = ilLPStatus::_lookupStatus($a_packageId, $a_user_id); $status['saved_global_status'] = (int) $oldStatus; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($a_packageId); $status['lp_mode'] = $olp->getCurrentMode(); $collection = $olp->getCollectionInstance(); if ($collection) { $status['scos'] = $collection->getItems(); } else { $status['scos'] = array(); } $status['hash'] = ilObjSCORMInitData::setHash($a_packageId, $a_user_id); $status['p'] = $a_user_id; $status['last_visited'] = null; $status['total_time_sec'] = 0; $val_set = $ilDB->queryF('SELECT last_visited, sco_total_time_sec, total_time_sec FROM sahs_user WHERE obj_id = %s AND user_id = %s', array('integer', 'integer'), array($a_packageId, $a_user_id)); $val_rec = $ilDB->fetchAssoc($val_set); if ($auto_last_visited) { $status['last_visited'] = $val_rec["last_visited"]; } if ($val_rec["total_time_sec"] == null) { if ($val_rec["sco_total_time_sec"] == null) { //fall back for old ILIAS-Versions if ($scormType == "2004") { include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php'; $status['total_time_sec'] = (int) ilSCORM2004Tracking::getSumTotalTimeSecondsFromScos($a_packageId, $a_user_id, true); } } else { $status['total_time_sec'] = (int) $val_rec["sco_total_time_sec"]; } } else { $status['total_time_sec'] = (int) $val_rec["total_time_sec"]; } return $status; }
/** * SCORM Data for Javascript-API */ function apiInitData() { // global $ilias, $ilLog, $ilUser, $lng, $ilDB; if ($_GET["ref_id"] == "") { print 'alert("no start without ref_id");'; die; } header('Content-Type: text/javascript; charset=UTF-8'); print "function iliasApi() {\r\n"; $js_data = file_get_contents("./Modules/ScormAicc/scripts/basisAPI.js"); echo $js_data; $js_data = file_get_contents("./Modules/ScormAicc/scripts/SCORM1_2standard.js"); //want to give opportunities to different files (Uwe Kohnle) echo $js_data; print "}\r\n"; include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMInitData.php"; print "IliasScormVars=" . ilObjSCORMInitData::getIliasScormVars($this->slm) . ";\r\n"; //Resources print "IliasScormResources=" . ilObjSCORMInitData::getIliasScormResources($this->slm->getId()) . ";\r\n"; //Tree print "IliasScormTree=" . ilObjSCORMInitData::getIliasScormTree($this->slm->getId()) . ";\r\n"; //prevdata print "IliasScormData=" . ilObjSCORMInitData::getIliasScormData($this->slm->getId()) . ";\r\n"; // set alternative API name - not necessary for scorm if ($this->slm->getAPIAdapterName() != "API") { print 'var ' . $this->slm->getAPIAdapterName() . '=new iliasApi();'; } else { print 'var API=new iliasApi();'; } }
function getStatus($a_packageId, $a_user_id) { include_once './Services/Tracking/classes/class.ilLPStatus.php'; $oldStatus = ilLPStatus::_lookupStatus($a_packageId, $a_user_id); $status['saved_global_status'] = (int) $oldStatus; include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($a_packageId); $status['lp_mode'] = $olp->getCurrentMode(); $collection = $olp->getCollectionInstance(); if ($collection) { $status['scos'] = $collection->getItems(); } else { $status['scos'] = array(); } $status['hash'] = ilObjSCORMInitData::setHash($a_packageId, $a_user_id); $status['p'] = $a_user_id; return $status; }