public function getValidModes() { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $subtype = ilObjSAHSLearningModule::_lookupSubType($this->obj_id); if ($subtype != "scorm2004") { if ($this->checkSCORMPreconditions()) { return array(ilLPObjSettings::LP_MODE_SCORM); } include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php"; $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM); if (sizeof($collection->getPossibleItems())) { return array(ilLPObjSettings::LP_MODE_DEACTIVATED, ilLPObjSettings::LP_MODE_SCORM); } return array(ilLPObjSettings::LP_MODE_DEACTIVATED); } else { if ($this->checkSCORMPreconditions()) { return array(ilLPObjSettings::LP_MODE_SCORM, ilLPObjSettings::LP_MODE_SCORM_PACKAGE); } include_once "Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php"; $collection = new ilLPCollectionOfSCOs($this->obj_id, ilLPObjSettings::LP_MODE_SCORM); if (sizeof($collection->getPossibleItems())) { return array(ilLPObjSettings::LP_MODE_DEACTIVATED, ilLPObjSettings::LP_MODE_SCORM_PACKAGE, ilLPObjSettings::LP_MODE_SCORM); } return array(ilLPObjSettings::LP_MODE_DEACTIVATED, ilLPObjSettings::LP_MODE_SCORM_PACKAGE); } }
/** * create new instance and save it */ public function save() { global $ilUser; $lm_id = $_REQUEST["lm_id"]; if ($lm_id) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($lm_id); if ($type == "scorm") { include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; $lm = new ilObjSCORMLearningModule($lm_id, false); } else { include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $lm = new ilObjSCORM2004LearningModule($lm_id, false); } include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php"; $newObj = ilObjSCORMVerification::createFromSCORMLM($lm, $ilUser->getId()); if ($newObj) { $parent_id = $this->node_id; $this->node_id = null; $this->putObjectInTree($newObj, $parent_id); $this->afterSave($newObj); } else { ilUtil::sendFailure($this->lng->txt("msg_failed")); } } else { ilUtil::sendFailure($this->lng->txt("select_one")); } $this->create(); }
/** * Constructor * * @param int $a_id Object ID * @access public */ function __construct() { global $ilias; $this->ilias =& $ilias; $this->id = $_GET['ref_id']; $this->obj_id = ilObject::_lookupObjectId($_GET['ref_id']); include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $this->type = ilObjSAHSLearningModule::_lookupSubType($this->obj_id); $this->read(); }
/** * Get all completed tests */ protected function getItems() { global $ilUser, $tree; $data = array(); include_once "Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive()) { $obj_ids = array(); $root = $tree->getNodeData($tree->getRootId()); foreach ($tree->getSubTree($root, true, "sahs") as $node) { $obj_ids[] = $node["obj_id"]; } if ($obj_ids) { include_once "./Services/Tracking/classes/class.ilObjUserTracking.php"; include_once "./Services/Tracking/classes/class.ilLPStatus.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php"; $lp_active = ilObjUserTracking::_enabledLearningProgress(); foreach (ilCertificate::areObjectsActive($obj_ids) as $obj_id => $active) { if ($active) { $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($type == "scorm") { $lm = new ilObjSCORMLearningModule($obj_id, false); } else { $lm = new ilObjSCORM2004LearningModule($obj_id, false); } $adapter = new ilSCORMCertificateAdapter($lm); if (ilCertificate::_isComplete($adapter)) { $lpdata = $completed = false; if ($lp_active) { $completed = ilLPStatus::_hasUserCompleted($obj_id, $ilUser->getId()); $lpdata = true; } if (!$lpdata) { switch ($type) { case "scorm": $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; case "scorm2004": $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId()); break; } } $data[] = array("id" => $obj_id, "title" => ilObject::_lookupTitle($obj_id), "passed" => (bool) $completed); } } } } } $this->setData($data); }
public function getScoresForUserAndCP_Node_Id($item_id, $user_id) { include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php'; switch (ilObjSAHSLearningModule::_lookupSubType($this->obj_id)) { case 'hacp': case 'aicc': include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php'; return ilObjAICCLearningModule::_getScoresForUser($item_id, $user_id); case 'scorm': include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php'; //include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php'; return ilObjSCORMLearningModule::_getScoresForUser($item_id, $user_id); case 'scorm2004': include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php'; return ilObjSCORM2004LearningModule::_getScores2004ForUser($item_id, $user_id); } return array("raw" => null, "max" => null, "scaled" => null); }
/** * Initialize properties form * * @param * @return */ function initPropertiesForm() { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this)); $this->form->setTitle($this->lng->txt("cont_lm_properties")); // SCORM-type $ne = new ilNonEditableValueGUI($this->lng->txt("type"), ""); $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID()))); $this->form->addItem($ne); // version $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), ""); $ne->setValue($this->object->getModuleVersion()); $this->form->addItem($ne); // online $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online"); $cb->setValue("y"); if ($this->object->getOnline()) { $cb->setChecked(true); } $this->form->addItem($cb); // offline Mode $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode"); $cb->setValue("y"); $cb->setChecked($this->object->getOfflineMode()); $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info")); $this->form->addItem($cb); // // presentation // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_presentation")); $this->form->addItem($sh); // display mode (open) $options = array("0" => $this->lng->txt("cont_open_normal"), "1" => $this->lng->txt("cont_open_iframe_max"), "2" => $this->lng->txt("cont_open_iframe_defined"), "5" => $this->lng->txt("cont_open_window_undefined"), "6" => $this->lng->txt("cont_open_window_defined")); $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode"); $si->setOptions($options); $si->setValue($this->object->getOpenMode()); $this->form->addItem($si); // width $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getWidth()); $this->form->addItem($ni); // height $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height"); $ni->setMaxLength(4); $ni->setSize(4); $ni->setValue($this->object->getHeight()); $this->form->addItem($ni); // disable top menu $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu"); $cb->setValue("y"); $cb->setChecked($this->object->getNoMenu()); $this->form->addItem($cb); // disable left-side navigation $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig"); $cb->setValue("y"); $cb->setChecked($this->object->getHideNavig()); $this->form->addItem($cb); // auto navigation to last visited item $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited"); $cb->setValue("y"); $cb->setChecked($this->object->getAuto_last_visited()); $cb->setInfo($this->lng->txt("cont_auto_last_visited_info")); $this->form->addItem($cb); // // scorm options // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_scorm_options")); $this->form->addItem($sh); // max attempts $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt"); $ni->setMaxLength(3); $ni->setSize(3); $ni->setValue($this->object->getMaxAttempt()); $this->form->addItem($ni); // lesson mode $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"), "browse" => $this->lng->txt("cont_sc_less_mode_browse")); $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode"); $si->setOptions($options); $si->setValue($this->object->getDefaultLessonMode()); $this->form->addItem($si); // credit mode $options = array("credit" => $this->lng->txt("cont_credit_on"), "no_credit" => $this->lng->txt("cont_credit_off")); $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode"); $si->setOptions($options); $si->setValue($this->object->getCreditMode()); $si->setInfo($this->lng->txt("cont_credit_mode_info")); $this->form->addItem($si); // set lesson mode review when completed $options = array("n" => $this->lng->txt("cont_sc_auto_review_no"), "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"), "p" => $this->lng->txt("cont_sc_auto_review_passed"), "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"), "c" => $this->lng->txt("cont_sc_auto_review_completed"), "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"), "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed")); $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review"); $si->setOptions($options); $si->setValue($this->object->getAutoReviewChar()); $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004")); $this->form->addItem($si); // // rte settings // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_rte_settings")); $this->form->addItem($sh); // unlimited session timeout $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session"); $cb->setValue("y"); $cb->setChecked($this->object->getSession()); $cb->setInfo($this->lng->txt("cont_sc_usession_info")); $this->form->addItem($cb); // sequencing $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing"); $cb->setValue("y"); $cb->setChecked($this->object->getSequencing()); $cb->setInfo($this->lng->txt("cont_sequencing_info")); $this->form->addItem($cb); // storage of interactions $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions"); $cb->setValue("y"); $cb->setChecked($this->object->getInteractions()); $this->form->addItem($cb); // objectives $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives"); $cb->setValue("y"); $cb->setChecked($this->object->getObjectives()); $this->form->addItem($cb); // comments $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments"); $cb->setValue("y"); $cb->setChecked($this->object->getComments()); $this->form->addItem($cb); // time from lms $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms"); $cb->setValue("y"); $cb->setChecked($this->object->getTime_from_lms()); $cb->setInfo($this->lng->txt("cont_time_from_lms_info")); $this->form->addItem($cb); // check values $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values"); $cb->setValue("y"); $cb->setChecked($this->object->getCheck_values()); $this->form->addItem($cb); // auto cmi.exit to suspend $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend"); $cb->setValue("y"); $cb->setChecked($this->object->getAutoSuspend()); $cb->setInfo($this->lng->txt("cont_auto_suspend_info")); $this->form->addItem($cb); // // debugging // $sh = new ilFormSectionHeaderGUI(); $sh->setTitle($this->lng->txt("cont_debugging")); $this->form->addItem($sh); // test tool $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug"); $cb->setValue("y"); $cb->setChecked($this->object->getDebug()); if ($this->object->getDebugActivated() == false) { $cb->setDisabled(true); $cb->setInfo($this->lng->txt("cont_debug_deactivated")); } else { $cb->setInfo($this->lng->txt("cont_debug_deactivate")); } $this->form->addItem($cb); $this->form->addCommandButton("saveProperties", $lng->txt("save")); }
/** * Download the certificate for the active user */ public function downloadCertificate() { global $ilUser, $tree, $ilCtrl; $allowed = false; $last_access = 0; $obj_id = ilObject::_lookupObjId($_GET["ref_id"]); include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php"; if (ilObjSAHSLearningModuleAccess::_lookupUserCertificate($obj_id)) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); switch ($type) { case "scorm": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; $allowed = true; $last_access = ilObjSCORMLearningModule::_lookupLastAccess($obj_id, $ilUser->getId()); break; case "scorm2004": include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $allowed = true; $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($obj_id, $ilUser->getId()); break; default: break; } } if ($allowed) { include_once "./Services/Certificate/classes/class.ilCertificate.php"; include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php"; $certificate = new ilCertificate(new ilSCORMCertificateAdapter($this->slm)); $params = array("user_data" => ilObjUser::_lookupFields($ilUser->getId()), "last_access" => $last_access); $certificate->outCertificate($params, true); exit; } // redirect to parent category if certificate is not accessible $parent = $tree->getParentId($_GET["ref_id"]); $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent); $ilCtrl->redirectByClass("ilrepositorygui", ""); }
/** * Checks whether a certificate exists for the active user or not * @param int obj_id Object ID of the SCORM Learning Module * @param int usr_id Object ID of the user. If not given, the active user will be taken * @return true/false */ public static function _lookupUserCertificate($obj_id, $usr_id = 0) { global $ilUser; $uid = $usr_id ? $usr_id : $ilUser->getId(); $completed = false; // check for certificates include_once "./Services/Certificate/classes/class.ilCertificate.php"; if (ilCertificate::isActive() && ilCertificate::isObjectActive($obj_id)) { $lpdata = false; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); include_once "Services/Tracking/classes/class.ilObjUserTracking.php"; if (ilObjUserTracking::_enabledLearningProgress()) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; $completed = ilLPStatus::_hasUserCompleted($obj_id, $uid); $lpdata = true; } switch ($type) { case "scorm": if (!$lpdata) { include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php"; $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $uid); } break; case "scorm2004": if (!$lpdata) { include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $uid); } break; default: break; } } return $completed; }
/** * upload new version of module */ function newModuleVersion() { $obj_id = ilObject::_lookupObjectId($_GET['ref_id']); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); // display import form $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scorm_new_version_import.html", "Modules/ScormAicc"); $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath('icon_slm.png')); $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_sahs")); $this->ctrl->setParameter($this, "new_type", "sahs"); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("BTN_NAME", "newModuleVersionUpload"); $this->tpl->setVariable("TARGET", ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '); $this->tpl->setVariable("TXT_SELECT_LMTYPE", $this->lng->txt("type")); if ($type == "scorm2004") { $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm2004")); } else { $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm")); } include_once 'Services/FileSystem/classes/class.ilUploadFiles.php'; if (ilUploadFiles::_getUploadDirectory()) { $files = ilUploadFiles::_getUploadFiles(); foreach ($files as $file) { $file = htmlspecialchars($file, ENT_QUOTES, "utf-8"); $this->tpl->setCurrentBlock("option_uploaded_file"); $this->tpl->setVariable("UPLOADED_FILENAME", $file); $this->tpl->setVariable("TXT_UPLOADED_FILENAME", $file); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("select_uploaded_file"); $this->tpl->setVariable("TXT_SELECT_FROM_UPLOAD_DIR", $this->lng->txt("cont_select_from_upload_dir")); $this->tpl->setVariable("TXT_UPLOADED_FILE", $this->lng->txt("cont_uploaded_file")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload")); $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel")); $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_sahs")); $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file")); // gives out the limit as a little notice $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice") . " " . $this->getMaxFileSize()); }
function getValidModes() { global $lng; switch ($this->obj_type) { case 'crs': if (ilLPObjSettings::_checkObjectives($this->getObjId())) { return array(LP_MODE_OBJECTIVES => $lng->txt('trac_mode_objectives')); } return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_MANUAL_BY_TUTOR => $lng->txt('trac_mode_manual_by_tutor'), LP_MODE_COLLECTION => $lng->txt('trac_mode_collection')); break; case 'dbk': return array(LP_MODE_MANUAL => $lng->txt('trac_mode_manual'), LP_MODE_DEACTIVATE => $lng->txt('trac_mode_deactivated')); case 'lm': return array(LP_MODE_MANUAL => $lng->txt('trac_mode_manual'), LP_MODE_VISITS => $lng->txt('trac_mode_visits'), LP_MODE_TLT => $lng->txt('trac_mode_tlt'), LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated')); case 'htlm': return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_MANUAL => $lng->txt('trac_mode_manual')); case 'sahs': include_once './Services/Tracking/classes/class.ilLPCollections.php'; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $subtype = ilObjSAHSLearningModule::_lookupSubType($this->getObjId()); if ($subtype != "scorm2004") { if (ilLPObjSettings::_checkSCORMPreconditions($this->getObjId())) { return array(LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc')); } if (ilLPCollections::_getCountPossibleSAHSItems($this->getObjId())) { return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc')); } return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated')); } else { if (ilLPObjSettings::_checkSCORMPreconditions($this->getObjId())) { return array(LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc'), LP_MODE_SCORM_PACKAGE => $lng->txt('trac_mode_scorm_package')); } if (ilLPCollections::_getCountPossibleSAHSItems($this->getObjId())) { return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_SCORM_PACKAGE => $lng->txt('trac_mode_scorm_package'), LP_MODE_SCORM => $lng->txt('trac_mode_scorm_aicc')); } return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_SCORM_PACKAGE => $lng->txt('trac_mode_scorm_package')); } break; case 'tst': return array(LP_MODE_TEST_FINISHED => $lng->txt('trac_mode_test_finished'), LP_MODE_TEST_PASSED => $lng->txt('trac_mode_test_passed'), LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated')); case 'exc': return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_EXERCISE_RETURNED => $lng->txt('trac_mode_exercise_returned')); case 'grp': return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_MANUAL_BY_TUTOR => $lng->txt('trac_mode_manual_by_tutor'), LP_MODE_COLLECTION => $lng->txt('trac_mode_collection')); case 'fold': return array(LP_MODE_DEACTIVATED => $lng->txt('trac_mode_deactivated'), LP_MODE_COLLECTION => $lng->txt('trac_mode_collection')); case 'sess': return array(LP_MODE_EVENT => $this->lng->txt('trac_mode_event')); default: return array(); } }
function setInfoTabs($a_active) { global $ilTabs, $ilLocator, $ilAccess; // $ilTabs->clearTargets(); // #9658 / #11753 include_once "Services/Tracking/classes/class.ilLearningProgressAccess.php"; if (ilLearningProgressAccess::checkAccess($_GET["ref_id"]) && (!$ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"]) && !$ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"]) || !$ilAccess->checkAccess("write", "", $_GET["ref_id"]))) { $ilTabs->addTab("info_short", $this->lng->txt("info_short"), $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")); $ilTabs->addTab("learning_progress", $this->lng->txt("learning_progress"), $this->ctrl->getLinkTargetByClass('illearningprogressgui', '')); } if ($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"]) || $ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) { include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php'; $privacy = ilPrivacySettings::_getInstance(); if ($privacy->enabledSahsProtocolData()) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $obj_id = ilObject::_lookupObjectId($_GET['ref_id']); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($type == "scorm2004") { $ilTabs->addTab("cont_tracking_data", $this->lng->txt("cont_tracking_data"), $this->ctrl->getLinkTargetByClass('ilobjscorm2004learningmodulegui', 'showTrackingItems')); } else { if ($type == "scorm") { $ilTabs->addTab("cont_tracking_data", $this->lng->txt("cont_tracking_data"), $this->ctrl->getLinkTargetByClass('ilobjscormlearningmodulegui', 'showTrackingItems')); } } } } $ilTabs->activateTab($a_active); $this->tpl->getStandardTemplate(); $this->tpl->setTitle($this->slm_gui->object->getTitle()); $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg")); $ilLocator->addRepositoryItems(); $ilLocator->addItem($this->slm_gui->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]); $this->tpl->setLocator(); }
/** * execute command */ function &executeCommand() { global $lng, $ilAccess, $ilNavigationHistory, $ilCtrl, $ilLocator, $ilObjDataCache; include_once "./Services/Object/classes/class.ilObjectGUI.php"; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $lng->loadLanguageModule("content"); $obj_id = ilObject::_lookupObjectId($_GET['ref_id']); // add entry to navigation history if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php"; if (!ilObjSAHSLearningModuleAccess::_lookupEditable($obj_id)) { $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?cmd=infoScreen&baseClass=ilSAHSPresentationGUI&ref_id=" . $_GET["ref_id"], "lm"); } } include_once 'Services/Payment/classes/class.ilPaymentObject.php'; if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) { $ilLocator->addRepositoryItems(); $ilLocator->addItem($ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($_GET['ref_id'])), 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $_GET['ref_id'], '', $_GET['ref_id'], 'sahs'); $this->tpl->setLocator(); $this->tpl->getStandardTemplate(); include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php'; $this->ctrl->setReturn($this, ''); $pp_gui = new ilShopPurchaseGUI($_GET['ref_id']); $this->ctrl->forwardCommand($pp_gui); $this->tpl->show(); exit; } $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($cmd == "downloadCertificate") { require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php"; $scorm_gui = new ilSCORMPresentationGUI(); $ret =& $this->ctrl->forwardCommand($scorm_gui); } switch ($type) { case "scorm2004": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php"; $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "scorm": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php"; $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "aicc": include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModuleGUI.php"; $this->slm_gui = new ilObjAICCLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "hacp": include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModuleGUI.php"; $this->slm_gui = new ilObjHACPLearningModuleGUI("", $_GET["ref_id"], true, false); break; } if ($next_class != "ilinfoscreengui" && $cmd != "infoScreen" && $next_class != "illearningprogressgui") { include_once "./Services/License/classes/class.ilLicense.php"; ilLicense::_noteAccess($obj_id, "sahs", $_GET["ref_id"]); switch ($type) { case "scorm2004": $this->ctrl->setCmdClass("ilscorm13player"); $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "scorm": $this->ctrl->setCmdClass("ilscormpresentationgui"); $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "aicc": $this->ctrl->setCmdClass("ilaiccpresentationgui"); break; case "hacp": $this->ctrl->setCmdClass("ilhacppresentationgui"); break; } $next_class = $this->ctrl->getNextClass($this); } switch ($next_class) { case "ilinfoscreengui": $ret =& $this->outputInfoScreen(); break; case "ilscorm13player": require_once "./Modules/Scorm2004/classes/ilSCORM13Player.php"; $scorm_gui = new ilSCORM13Player(); $ret =& $this->ctrl->forwardCommand($scorm_gui); break; case "ilscormpresentationgui": require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php"; $scorm_gui = new ilSCORMPresentationGUI(); $ret =& $this->ctrl->forwardCommand($scorm_gui); break; case "ilaiccpresentationgui": require_once "./Modules/ScormAicc/classes/AICC/class.ilAICCPresentationGUI.php"; $aicc_gui = new ilAICCPresentationGUI(); $ret =& $this->ctrl->forwardCommand($aicc_gui); break; case "ilhacppresentationgui": require_once "./Modules/ScormAicc/classes/HACP/class.ilHACPPresentationGUI.php"; $hacp_gui = new ilHACPPresentationGUI(); $ret =& $this->ctrl->forwardCommand($hacp_gui); break; case "illearningprogressgui": $this->setInfoTabs("learning_progress"); include_once "./Services/Tracking/classes/class.ilLearningProgressGUI.php"; $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY, $_GET['ref_id']); $this->ctrl->forwardCommand($new_gui); $this->tpl->show(); break; default: $this->{$cmd}(); } }
/** * Delete progress of users and objects * Implemented for */ public function deleteProgress($sid, $ref_ids, $usr_ids, $type_filter, $progress_filter) { $this->initAuth($sid); $this->initIlias(); // Check session if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } // Check filter if (array_diff((array) $type_filter, self::$DELETE_PROGRESS_FILTER_TYPES)) { return $this->__raiseError('Invalid filter type given', 'Client'); } include_once 'Services/User/classes/class.ilObjUser.php'; if (!in_array(self::USER_FILTER_ALL, $usr_ids) and !ilObjUser::userExists($usr_ids)) { return $this->__raiseError('Invalid user ids given', 'Client'); } $valid_refs = array(); foreach ((array) $ref_ids as $ref_id) { $obj_id = ilObject::_lookupObjId($ref_id); $type = ilObject::_lookupType($obj_id); // All containers if ($GLOBALS['objDefinition']->isContainer($type)) { $all_sub_objs = array(); foreach ($type_filter as $type_filter_item) { $sub_objs = $GLOBALS['tree']->getSubTree($GLOBALS['tree']->getNodeData($ref_id), false, $type_filter_item); $all_sub_objs = array_merge($all_sub_objs, $sub_objs); } foreach ($all_sub_objs as $child_ref) { $child_type = ilObject::_lookupType(ilObject::_lookupObjId($child_ref)); if (!$GLOBALS['ilAccess']->checkAccess('write', '', $child_ref)) { return $this->__raiseError('Permission denied for : ' . $ref_id . ' -> type ' . $type, 'Client'); } $valid_refs[] = $child_ref; } } elseif (in_array($type, $type_filter)) { if (!$GLOBALS['ilAccess']->checkAccess('write', '', $ref_id)) { return $this->__raiseError('Permission denied for : ' . $ref_id . ' -> type ' . $type, 'Client'); } $valid_refs[] = $ref_id; } else { return $this->__raiseError('Invalid object type given for : ' . $ref_id . ' -> type ' . $type, 'Client'); } } // Delete tracking data foreach ($valid_refs as $ref_id) { include_once './classes/class.ilObjectFactory.php'; $obj = ilObjectFactory::getInstanceByRefId($ref_id, false); if (!$obj instanceof ilObject) { return $this->__raiseError('Invalid reference id given : ' . $ref_id . ' -> type ' . $type, 'Client'); } // filter users $valid_users = $this->applyProgressFilter($obj->getId(), (array) $usr_ids, (array) $progress_filter); switch ($obj->getType()) { case 'sahs': include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php'; $subtype = ilObjSAHSLearningModule::_lookupSubType($obj->getId()); switch ($subtype) { case 'scorm': $this->deleteScormTracking($obj->getId(), (array) $valid_users); break; case 'scorm2004': $this->deleteScorm2004Tracking($obj->getId(), (array) $valid_users); break; } break; case 'tst': foreach ((array) $valid_users as $usr_id) { $obj->removeTestResultsForUser($usr_id); } break; } // Refresh status include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php'; ilLPStatusWrapper::_refreshStatus($obj->getId()); } return true; }
/** * Get item properties * * @return array array of property arrays: * "alert" (boolean) => display as an alert property (usually in red) * "property" (string) => property name * "value" (string) => property value */ function getProperties() { global $lng, $rbacsystem; $props = array(); include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php"; $editable = ilObjSAHSLearningModuleAccess::_lookupEditable($this->obj_id); if (!$editable && ilObjSAHSLearningModuleAccess::_isOffline($this->obj_id)) { $props[] = array("alert" => true, "property" => $lng->txt("status"), "value" => $lng->txt("offline")); } else { if ($editable) { $props[] = array("alert" => true, "value" => $lng->txt("authoring_mode")); } } if ($rbacsystem->checkAccess("write", $this->ref_id)) { $props[] = array("alert" => false, "property" => $lng->txt("type"), "value" => $lng->txt("sahs")); } // check for certificates if (ilObjSAHSLearningModuleAccess::_lookupUserCertificate($this->obj_id)) { include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $type = ilObjSAHSLearningModule::_lookupSubType($this->obj_id); switch ($type) { case "scorm": $lng->loadLanguageModule('certificate'); $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->ref_id . "&cmd=downloadCertificate"; $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"), "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>'); break; case "scorm2004": $lng->loadLanguageModule('certificate'); $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->ref_id . "&cmd=downloadCertificate"; $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"), "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>'); break; } } return $props; }
/** * scorm learning module presentation script * * @author Alex Killing <*****@*****.**> * @version $Id$ * */ chdir("../.."); require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $cmd = $_GET["cmd"] == "" ? $_POST["cmd"] : $_GET["cmd"]; $ref_id = $_GET["ref_id"]; //get type of cbt if (!empty($ref_id)) { require_once "./include/inc.header.php"; $obj_id = ilObject::_lookupObjectId($ref_id); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); } else { //ensure HACP $requiredKeys = array("command", "version", "session_id"); if (count(array_diff($requiredKeys, array_keys(array_change_key_case($_POST, CASE_LOWER)))) == 0) { //now we need to get a connection to the database and global params //but that doesnt work because of missing logindata of the contentserver //require_once "./include/inc.header.php"; //highly insecure $param = urldecode($_POST["session_id"]); if (!empty($param) && substr_count($param, "_") == 3) { list($session_id, $client_id, $ref_id, $obj_id) = explode("_", $param); $_COOKIE[session_name()] = $session_id; $_COOKIE['ilClientId'] = $client_id; // session_id($session_id); require_once "./include/inc.header.php";
function refreshStatus($a_obj_id) { parent::refreshStatus($a_obj_id); // this is restricted to SCOs in the current collection include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php"; $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id); $completed = ilLPStatusWrapper::_getCompleted($a_obj_id); $failed = ilLPStatusWrapper::_getFailed($a_obj_id); $all_active_users = array_unique(array_merge($in_progress, $completed, $failed)); // get all tracked users regardless of SCOs include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php'; $subtype = ilObjSAHSLearningModule::_lookupSubType($a_obj_id); if ($subtype != "scorm2004") { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php"; $all_tracked_users = ilObjSCORMTracking::_getTrackedUsers($a_obj_id); } else { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php"; $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id); } $not_attempted_users = array_diff($all_tracked_users, $all_active_users); unset($all_tracked_users); unset($all_active_users); // reset all users which have no data for the current SCOs if ($not_attempted_users) { foreach ($not_attempted_users as $usr_id) { // this will update any (parent) collections if necessary ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0); } } }
/** * Get participant ids for given object * * @param int $a_ref_id * @return array */ public static function getParticipantsForObject($a_ref_id) { global $tree; $obj_id = ilObject::_lookupObjectId($a_ref_id); $obj_type = ilObject::_lookupType($obj_id); // try to get participants from (parent) course/group switch ($obj_type) { case "crs": include_once "Modules/Course/classes/class.ilCourseParticipants.php"; $member_obj = ilCourseParticipants::_getInstanceByObjId($obj_id); return $member_obj->getMembers(); case "grp": include_once "Modules/Group/classes/class.ilGroupParticipants.php"; $member_obj = ilGroupParticipants::_getInstanceByObjId($obj_id); return $member_obj->getMembers(); default: // walk path to find course or group object and use members of that object $path = $tree->getPathId($a_ref_id); array_pop($path); foreach (array_reverse($path) as $path_ref_id) { $type = ilObject::_lookupType($path_ref_id, true); if ($type == "crs" || $type == "grp") { return self::getParticipantsForObject($path_ref_id); } } break; } $a_users = null; // no participants possible: use tracking/object data where possible switch ($obj_type) { case "sahs": include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $subtype = ilObjSAHSLearningModule::_lookupSubType($obj_id); if ($subtype == "scorm2004") { // based on cmi_node/cp_node, used for scorm tracking data views include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php"; $mod = new ilObjSCORM2004LearningModule($obj_id, false); $all = $mod->getTrackedUsers(""); if ($all) { $a_users = array(); foreach ($all as $item) { $a_users[] = $item["user_id"]; } } } else { include_once "./Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php"; $a_users = ilObjSCORMTracking::_getTrackedUsers($obj_id); } break; case "exc": include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php"; include_once "./Modules/Exercise/classes/class.ilObjExercise.php"; $exc = new ilObjExercise($obj_id, false); $members = new ilExerciseMembers($exc); $a_users = $members->getMembers(); break; case "tst": include_once "./Services/Tracking/classes/class.ilLPStatusTestFinished.php"; $a_users = ilLPStatusTestFinished::getParticipants($obj_id); break; default: // no sensible data: return null break; } return $a_users; }
/** * execute command */ function &executeCommand() { global $lng, $ilAccess, $ilNavigationHistory, $ilias; include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php"; $lng->loadLanguageModule("content"); // permission if (!$ilAccess->checkAccess("write", "", $_GET["ref_id"])) { $this->ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } // add entry to navigation history $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $_GET["ref_id"], "lm"); $next_class = $this->ctrl->getNextClass($this); $cmd = $this->ctrl->getCmd(); $obj_id = ilObject::_lookupObjectId($_GET['ref_id']); $type = ilObjSAHSLearningModule::_lookupSubType($obj_id); switch ($type) { case "scorm2004": include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php"; $this->slm_gui = new ilObjSCORM2004LearningModuleGUI("", $_GET["ref_id"], true, false); break; case "scorm": include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php"; $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "aicc": include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModuleGUI.php"; $this->slm_gui = new ilObjAICCLearningModuleGUI("", $_GET["ref_id"], true, false); break; case "hacp": include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModuleGUI.php"; $this->slm_gui = new ilObjHACPLearningModuleGUI("", $_GET["ref_id"], true, false); break; } if ($next_class == "") { switch ($type) { case "scorm2004": $this->ctrl->setCmdClass("ilobjscorm2004learningmodulegui"); break; case "scorm": $this->ctrl->setCmdClass("ilobjscormlearningmodulegui"); break; case "aicc": $this->ctrl->setCmdClass("ilobjaicclearningmodulegui"); break; case "hacp": $this->ctrl->setCmdClass("ilobjhacplearningmodulegui"); break; } $next_class = $this->ctrl->getNextClass($this); } switch ($next_class) { case "ilobjscormlearningmodulegui": case "ilobjscorm2004learningmodulegui": $ret =& $this->ctrl->forwardCommand($this->slm_gui); break; case "ilobjaicclearningmodulegui": $ret =& $this->ctrl->forwardCommand($this->slm_gui); break; case "ilobjhacplearningmodulegui": $ret =& $this->ctrl->forwardCommand($this->slm_gui); break; default: die("ilSAHSEdit: Class {$next_class} not found."); } $this->tpl->show(); }