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);
 }
 /**
  * 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();
 }
Exemple #3
0
 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);
     }
 }
 /**
  * Object specific configuration 
  *
  * @param int $a_obj_id object id
  */
 function configureByObjectId($a_obj_id)
 {
     if ($a_obj_id > 0) {
         include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
         $this->setLocalizationLanguage(ilObjSAHSLearningModule::getAffectiveLocalization($a_obj_id));
         $glo_id = ilObjSAHSLearningModule::lookupAssignedGlossary($a_obj_id);
         if ($glo_id > 0) {
             $this->addIntLinkFilter(array("GlossaryItem"));
         }
     }
 }
 /**
  * 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);
 }
 /**
  * Import relevant properties from given learning module
  *
  * @param ilObjSAHSLearningModule $a_lm
  * @return object
  */
 public static function createFromSCORMLM(ilObjSAHSLearningModule $a_lm, $a_user_id)
 {
     global $lng;
     $lng->loadLanguageModule("sahs");
     $newObj = new self();
     $newObj->setTitle($a_lm->getTitle());
     $newObj->setDescription($a_lm->getDescription());
     include_once "Services/Tracking/classes/class.ilLPMarks.php";
     $lp_marks = new ilLPMarks($a_lm->getId(), $a_user_id);
     $newObj->setProperty("issued_on", new ilDate($lp_marks->getStatusChanged(), IL_CAL_DATETIME));
     // create certificate
     if (!stristr(get_class($a_lm), "2004")) {
         $last_access = ilObjSCORMLearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     } else {
         $last_access = ilObjSCORM2004LearningModule::_lookupLastAccess($a_lm->getId(), $a_user_id);
     }
     $params = array("user_data" => ilObjUser::_lookupFields($a_user_id), "last_access" => $last_access);
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     include_once "Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
     $certificate = new ilCertificate(new ilSCORMCertificateAdapter($a_lm));
     $certificate = $certificate->outCertificate($params, false);
     // save pdf file
     if ($certificate) {
         // we need the object id for storing the certificate file
         $newObj->create();
         $path = self::initStorage($newObj->getId(), "certificate");
         $file_name = "sahs_" . $a_lm->getId() . "_" . $a_user_id . ".pdf";
         if (file_put_contents($path . $file_name, $certificate)) {
             $newObj->setProperty("file", $file_name);
             $newObj->update();
             return $newObj;
         }
         // file creation failed, so remove to object, too
         $newObj->delete();
     }
 }
 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);
 }
 /**
  * Post output processing:
  * - Add glossary divs
  */
 function postOutputProcessing($a_output)
 {
     //var_dump($this->glossary_links);
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     if ($this->scorm_mode != "export") {
         $tpl = new ilTemplate("tpl.glossary_entries.html", true, true, "Modules/Scorm2004");
     } else {
         $tpl = self::$export_glo_tpl;
     }
     $glossary = false;
     $overlays = array();
     // overlay for sco glossary
     if ($this->getGlossaryOverviewId() != "" && $this->getOutputMode() != "edit") {
         $ovov = $overlays[$this->getGlossaryOverviewId()] = new ilOverlayGUI($this->getGlossaryOverviewId());
         //			$ovov->setFixedCenter(true);
         $ovov->setAutoHide(false);
         $ovov->setCloseElementId("glo_ov_close");
         if ($this->getGlossaryOverviewId() != "") {
             if ($this->scorm_mode != "export" || $this->getOutputMode() == IL_PAGE_PREVIEW) {
                 $overlays[$this->getGlossaryOverviewId()]->add();
             } else {
                 $tpl->setCurrentBlock("add_script");
                 $tpl->setVariable("ADD_SCRIPT", "il.Util.addOnLoad(function () {" . $overlays[$this->getGlossaryOverviewId()]->getOnLoadCode() . "});");
                 $tpl->parseCurrentBlock();
             }
         }
     }
     if ($this->getOutputMode() != "edit") {
         if (is_array($this->glossary_links)) {
             foreach ($this->glossary_links as $k => $e) {
                 // glossary link
                 if ($e["Type"] == "GlossaryItem") {
                     $karr = explode(":", $k);
                     $link_id = $karr[0] . "_" . $this->getPageObject()->getId() . "_" . $karr[4];
                     //$ov_id = "ov".$karr[0]."_".$karr[4];
                     $ov_id = "ov" . $karr[0];
                     $cl_id = "ov" . $karr[0] . "cl";
                     $glov_id = "ov" . $karr[0] . "ov";
                     $term_id_arr = explode("_", $karr[0]);
                     $term_id = $term_id_arr[count($term_id_arr) - 1];
                     // get overlay html from glossary term
                     include_once "./Modules/Glossary/classes/class.ilGlossaryTermGUI.php";
                     $id_arr = explode("_", $karr[0]);
                     $term_gui =& new ilGlossaryTermGUI($id_arr[count($id_arr) - 1]);
                     $html = $term_gui->getOverlayHTML($cl_id, $this->getGlossaryOverviewId() != "" ? $glov_id : "", ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id));
                     $tpl->setCurrentBlock("entry");
                     $tpl->setVariable("CONTENT", $html);
                     $tpl->setVariable("OVERLAY_ID", $ov_id);
                     $glossary = true;
                     // first time the term is used
                     if (!isset($overlays[$ov_id])) {
                         $overlays[$ov_id] = new ilOverlayGUI($ov_id);
                         $overlays[$ov_id]->setAnchor($link_id);
                         $overlays[$ov_id]->setTrigger($link_id, "click", $link_id);
                         $overlays[$ov_id]->setAutoHide(false);
                         $overlays[$ov_id]->setCloseElementId($cl_id);
                         if ($this->scorm_mode != "export" || $this->getOutputMode() == IL_PAGE_PREVIEW) {
                             $overlays[$ov_id]->add();
                         } else {
                             $tpl->setVariable("SCRIPT", "il.Util.addOnLoad(function () {" . $overlays[$ov_id]->getOnLoadCode() . "});");
                         }
                     } else {
                         if ($this->scorm_mode != "export" || $this->getOutputMode() == IL_PAGE_PREVIEW) {
                             $overlays[$ov_id]->addTrigger($link_id, "click", $link_id);
                         } else {
                             $tpl->setVariable("SCRIPT", "il.Util.addOnLoad(function () {" . $overlays[$ov_id]->getTriggerOnLoadCode($link_id, "click", $link_id) . "});");
                         }
                     }
                     if ($this->getGlossaryOverviewId() != "") {
                         if ($this->scorm_mode != "export" || $this->getOutputMode() == IL_PAGE_PREVIEW) {
                             //$overlays[$this->getGlossaryOverviewId()]->addTrigger($glov_id, "click", null);
                             $overlays[$this->getGlossaryOverviewId()]->addTrigger($glov_id, "click", $ov_id, false, "tl", "tl");
                             //$overlays[$ov_id]->addTrigger("glo_ov_t".$term_id, "click", null, true);
                             $overlays[$ov_id]->addTrigger("glo_ov_t" . $term_id, "click", $this->getGlossaryOverviewId(), false, "tl", "tl");
                         } else {
                             $tpl->setVariable("SCRIPT2", "il.Util.addOnLoad(function () {" . $overlays[$this->getGlossaryOverviewId()]->getTriggerOnLoadCode($glov_id, "click", $ov_id, false, "tl", "tl") . "});");
                             $tpl->setVariable("SCRIPT3", "il.Util.addOnLoad(function () {" . $overlays[$ov_id]->getTriggerOnLoadCode("glo_ov_t" . $term_id, "click", $this->getGlossaryOverviewId(), false, "tl", "tl") . "});");
                         }
                     }
                     $tpl->parseCurrentBlock();
                 }
             }
         }
         if ($glossary && $this->scorm_mode != "export") {
             $ret = $a_output . $tpl->get();
             if ($this->getGlossaryOverviewId() != "") {
                 $ret .= ilSCORM2004ScoGUI::getGloOverviewOv($this->sco);
             }
             return $ret;
         }
     }
     return $a_output;
 }
 /**
  * Export HTML pages of SCO
  */
 function exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type = "sco", $a_one_file = "", $a_sco_tpl = null)
 {
     global $tpl, $ilCtrl, $ilBench, $ilLog, $lng;
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
     include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $output = "";
     $tree = new ilTree($this->slm_id);
     $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
     $tree->setTreeTablePK("slm_id");
     // @todo
     // Why is that much HTML code in an application class?
     // Please extract all this HTML to a tpl.<t_name>.html file and use
     // placeholders and the template engine to insert data.
     //
     // There copy/paste code residenting in ilSCORM2004ScoGUI. This
     // should be merged.
     //
     // alex, 4 Apr 09
     //
     //		if ($a_one_file == "")
     //		{
     $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
     //		}
     //		else
     //		{
     //			$sco_tpl = $a_sco_tpl;
     //		}
     if ($mode != 'pdf' && $a_one_file == "") {
         include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
         $pg_exp = new ilCOPageHTMLExport($a_target_dir);
         $pg_exp->getPreparedMainTemplate($sco_tpl);
         // init and question lang vars
         $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id);
         $sco_tpl->setCurrentBlock("init");
         include_once "./Services/COPage/classes/class.ilPCQuestion.php";
         $sco_tpl->setVariable("TXT_INIT_CODE", ilPCQuestion::getJSTextInitCode($lk));
         $sco_tpl->parseCurrentBlock();
         // (additional) style sheets needed
         $styles = array("./css/yahoo/container.css", "./css/question_handling.css");
         foreach ($styles as $style) {
             $sco_tpl->setCurrentBlock("css_file");
             $sco_tpl->setVariable("CSS_FILE", $style);
             $sco_tpl->parseCurrentBlock();
         }
         // (additional) scripts needed
         $scripts = array("./js/scorm.js", "./js/pager.js", "./js/pure.js", "./js/questions_" . $this->getId() . ".js");
         foreach ($scripts as $script) {
             $sco_tpl->setCurrentBlock("js_file");
             $sco_tpl->setVariable("JS_FILE", $script);
             $sco_tpl->parseCurrentBlock();
         }
         if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") {
             self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
         }
         $sco_tpl->touchBlock("finish");
     }
     // render head
     $sco_tpl->setCurrentBlock("head");
     $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
     $sco_tpl->parseCurrentBlock();
     $sco_tpl->touchBlock("tail");
     // meta page (meta info at SCO beginning)
     self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
     if ($a_one_file != "") {
         fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>");
         fputs($a_one_file, $sco_tpl->get("meta_page"));
     }
     //notify Question Exporter of new SCO
     require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
     ilQuestionExporter::indicateNewSco();
     // init export (this initialises glossary template)
     ilSCORM2004PageGUI::initExport();
     $terms = array();
     $terms = $this->getGlossaryTermIds();
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php";
     $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
     $sco_q_ids = array();
     foreach ($pages as $page) {
         //echo(print_r($page));
         $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0, $this->slm_object->getId());
         $page_obj->setPresentationTitle($page["title"]);
         $page_obj->setOutputMode(IL_PAGE_OFFLINE);
         $page_obj->setStyleId($this->slm_object->getStyleSheetId());
         if (count($terms) > 1) {
             $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this);
         }
         $page_output = $page_obj->showPage("export");
         // collect media objects
         $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
         foreach ($mob_ids as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
             $media_obj = new ilObjMediaObject($mob_id);
             if ($media_obj->hasFullscreenItem()) {
                 $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
             }
         }
         // collect glossary items
         $int_links = $page_obj->getPageObject()->getInternalLinks(true);
         include_once "./Services/Link/classes/class.ilInternalLink.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         if (is_array($int_links)) {
             foreach ($int_links as $k => $e) {
                 // glossary link
                 if ($e["Type"] == "GlossaryItem") {
                     $karr = explode(":", $k);
                     $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
                     $dids = ilGlossaryDefinition::getDefinitionList($tid);
                     foreach ($dids as $did) {
                         include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                         $def_pg = new ilGlossaryDefPage($did["id"]);
                         $def_pg->buildDom();
                         $mob_ids = $def_pg->collectMediaObjects(false);
                         foreach ($mob_ids as $mob_id) {
                             $this->mob_ids[$mob_id] = $mob_id;
                             //echo "<br>-$mob_id-";
                             $media_obj = new ilObjMediaObject($mob_id);
                             if ($media_obj->hasFullscreenItem()) {
                                 $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
                             }
                         }
                         include_once "./Services/COPage/classes/class.ilPCFileList.php";
                         $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc());
                         foreach ($file_ids as $file_id) {
                             $this->file_ids[$file_id] = $file_id;
                         }
                     }
                 }
             }
         }
         //exit;
         // collect all file items
         include_once "./Services/COPage/classes/class.ilPCFileList.php";
         $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc());
         foreach ($file_ids as $file_id) {
             $this->file_ids[$file_id] = $file_id;
         }
         if ($mode == 'pdf') {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $q_id) {
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
                 $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
                 $q_gui->outAdditionalOutput();
                 $html = $q_gui->getPreview(TRUE);
                 $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output);
             }
             $sco_tpl->touchBlock("pdf_pg_break");
         }
         $sco_tpl->setCurrentBlock("page");
         $sco_tpl->setVariable("PAGE", $page_output);
         $sco_tpl->parseCurrentBlock();
         // get all question ids of the sco
         if ($a_one_file != "") {
             include_once "./Services/COPage/classes/class.ilPCQuestion.php";
             $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
             foreach ($q_ids as $i) {
                 if (!in_array($i, $sco_q_ids)) {
                     $sco_q_ids[] = $i;
                 }
             }
         }
     }
     // glossary
     if ($mode != 'pdf') {
         $sco_tpl->setVariable("GLOSSARY_HTML", ilSCORM2004PageGUI::getGlossaryHTML($this));
     }
     if ($a_one_file == "") {
         $output = $sco_tpl->get();
     } else {
         $output = $sco_tpl->get("page");
     }
     if ($mode == 'pdf') {
         $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\\/div>/i", "<h2>\$1</h2>", $output);
     }
     //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
     $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/files\\/file_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_\$1/\$2", $output);
     $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "./players", $output);
     //		$output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output);
     $output = preg_replace("/file=..\\/..\\/..\\/.\\//i", "file=../", $output);
     if ($mode != 'pdf') {
         $output = preg_replace_callback("/href=\"&mob_id=(\\d+)&pg_id=(\\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         // this one is for fullscreen in glossary entries
         $output = preg_replace_callback("/href=\"fullscreen_(\\d+)\\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
         $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
         //			$output = preg_replace("/&#123;/","",$output);
         //			$output = preg_replace("/&#125;/","",$output);
         $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
         fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling);
         copy("./Modules/Scorm2004/templates/default/question_handling.css", $a_target_dir . '/css/question_handling.css');
         // hack to get the question js into the file and to display the correct answers
         if ($a_one_file != "") {
             $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output;
             if (count($sco_q_ids) > 0) {
                 $output .= '<script type="text/javascript">';
                 foreach ($sco_q_ids as $i) {
                     if ($i > 0) {
                         $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n";
                     }
                 }
                 $output .= '</script>';
             }
         }
         foreach (ilQuestionExporter::getMobs() as $mob_id) {
             $this->mob_ids[$mob_id] = $mob_id;
         }
     }
     $this->q_media = ilQuestionExporter::getFiles();
     //questions export end
     if ($a_one_file != "") {
         fputs($a_one_file, $output);
     } else {
         fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
     }
     $this->exportFileItems($a_target_dir, $expLog);
 }
 /**
  * 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"));
 }
 /**
  * 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;
 }
 /**
  * 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", "");
 }
 /**
  * des
  *
  * @param
  * @return
  */
 static function getGloOverviewOv($a_sco)
 {
     global $lng;
     $tpl = new ilTemplate("tpl.sco_glossary_overview.html", true, true, "Modules/Scorm2004");
     $terms = $a_sco->getGlossaryTermIds();
     $lk = ilObjSAHSLearningModule::getAffectiveLocalization($a_sco->getSLMId());
     foreach ($terms as $k => $t) {
         $tpl->setCurrentBlock("link");
         $tpl->setVariable("TXT_LINK", $t);
         $tpl->setVariable("ID_LINK", "glo_ov_t" . $k);
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable("DIV_ID", ilSCORM2004ScoGUI::getGlossaryOverviewId());
     $tpl->setVariable("TXT_SCO_GLOSSARY", $lng->txtlng("content", "cont_sco_glossary", $lk));
     $tpl->setVariable("TXT_CLOSE", $lng->txtlng("common", "close", $lk));
     if (count($terms) > 1) {
         return $tpl->get();
     } else {
         return "";
     }
 }
 /**
  * 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());
 }
 /**
  * edit question
  */
 function edit()
 {
     global $ilCtrl, $ilTabs;
     $ilTabs->setTabActive('question');
     if ($this->getSelfAssessmentMode()) {
         $q_ref = $this->content_obj->getQuestionReference();
         if ($q_ref != "") {
             $inst_id = ilInternalLink::_extractInstOfTarget($q_ref);
             if (!($inst_id > 0)) {
                 $q_id = ilInternalLink::_extractObjIdOfTarget($q_ref);
             }
         }
         $q_type = $_POST["q_type"] != "" ? $_POST["q_type"] : $_GET["q_type"];
         $ilCtrl->setParameter($this, "q_type", $q_type);
         if ($q_id == "" && $q_type == "") {
             return $this->insert("edit_empty");
         }
         include_once "./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php";
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
         $ilCtrl->setCmdClass("ilquestioneditgui");
         $ilCtrl->setCmd("editQuestion");
         $edit_gui = new ilQuestionEditGUI();
         // create question first-hand (needed for uploads)
         if ($q_id < 1 && $q_type) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($q_type);
             $q_id = $q_gui->object->createNewQuestion(true);
             unset($q_gui);
             if ($_GET["qpool_ref_id"] > 0) {
                 $edit_gui->setPoolRefId($_GET["qpool_ref_id"]);
                 $edit_gui->setPoolRefId(0);
             }
             //set default tries
             $edit_gui->setDefaultNrOfTries(ilObjSAHSLearningModule::_getTries($this->scormlmid));
         }
         $edit_gui->setPoolObjId(0);
         $edit_gui->setQuestionId($q_id);
         $edit_gui->setQuestionType($q_type);
         $edit_gui->setSelfAssessmentEditingMode(true);
         $edit_gui->setPageConfig($this->getPageConfig());
         $ret = $ilCtrl->forwardCommand($edit_gui);
         $this->tpl->setContent($ret);
         return $ret;
     } else {
         require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
         $q_gui =& assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
         $this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($q_gui)), "editQuestion");
     }
 }
 /**
  * Get deletion dependencies
  *
  */
 static function getDeletionDependencies($a_obj_id)
 {
     global $lng;
     $dep = array();
     include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
     $sms = ilObjSAHSLearningModule::getScormModulesForGlossary($a_obj_id);
     foreach ($sms as $sm) {
         $lng->loadLanguageModule("content");
         $dep[$sm] = $lng->txt("glo_used_in_scorm");
     }
     //echo "-".$a_obj_id."-";
     //var_dump($dep);
     return $dep;
 }
 /**
  * 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;
 }
Exemple #18
0
/**
* 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);
         }
     }
 }
 /**
  * info screen
  */
 function outputInfoScreen()
 {
     global $ilAccess;
     //$this->tpl->setHeaderPageTitle("PAGETITLE", " - ".$this->lm->getTitle());
     // set style sheets
     /*
     		if (!$this->offlineMode())
     		{
     			$this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
     		}
     		else
     		{
     			$style_name = $this->ilias->account->prefs["style"].".css";;
     			$this->tpl->setStyleSheetLocation("./".$style_name);
     		}*/
     $this->setInfoTabs("info_short");
     $this->lng->loadLanguageModule("meta");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this->slm_gui);
     $info->enablePrivateNotes();
     //$info->enableLearningProgress();
     $info->enableNews();
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $info->enableNewsEditing();
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             $info->setBlockProperty("news", "settings", true);
         }
     }
     // add read / back button
     if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
         $sahs_obj = new ilObjSAHSLearningModule($_GET["ref_id"]);
         $om = $sahs_obj->getOpenMode();
         $width = $sahs_obj->getWidth();
         $height = $sahs_obj->getHeight();
         if ($om != 0) {
             $info->addButton($this->lng->txt("view"), "javascript:void(0); onclick=startSAHS('" . $this->ctrl->getLinkTarget($this, "") . "','ilContObj" . $this->slm_gui->object->getId() . "'," . $om . "," . $width . "," . $height . ");", '');
         } else {
             $info->addButton($this->lng->txt("view"), $this->ctrl->getLinkTarget($this, ""), ' target="ilContObj' . $this->slm_gui->object->getId() . '" ');
         }
     }
     // show standard meta data section
     $info->addMetaDataSections($this->slm_gui->object->getId(), 0, $this->slm_gui->object->getType());
     /*
     		if ($this->offlineMode())
     		{
     			$this->tpl->setContent($info->getHTML());
     			return $this->tpl->get();
     		}
     		else
     		{*/
     // forward the command
     $this->ctrl->forwardCommand($info);
     //$this->tpl->setContent("aa");
     $this->tpl->show();
     //}
 }
 /**
  * workaround: SAHS in new javavasript-created window or iframe
  */
 function modifySAHSlaunch($a_link, $wtarget)
 {
     if (strstr($a_link, 'ilSAHSPresentationGUI') && !$this->offline_mode) {
         include_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
         $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
         $om = $sahs_obj->getOpenMode();
         $width = $sahs_obj->getWidth();
         $height = $sahs_obj->getHeight();
         if ($om != 0 && !ilBrowser::isMobile()) {
             $this->default_command["frame"] = "";
             $a_link = "javascript:void(0); onclick=startSAHS('" . $a_link . "','" . $wtarget . "'," . $om . "," . $width . "," . $height . ");";
         }
     }
     return $a_link;
 }
 /**
  * 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&amp;ref_id=" . $this->ref_id . "&amp;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&amp;ref_id=" . $this->ref_id . "&amp;cmd=downloadCertificate";
                 $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"), "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
                 break;
         }
     }
     return $props;
 }
 /**
  * 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;
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "sahs":
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
                     $page_obj = new ilSCORM2004Page($usage["id"]);
                     require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
                     $lm_obj = new ilObjSAHSLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "sahs");
                     }
                     break;
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                     $page_obj = new ilLMPage($usage["id"]);
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "lm");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $page_obj = new ilWikiPage($usage["id"]);
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                     $page_obj = new ilGlossaryDefPage($usage["id"]);
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "fold":
                 case "root":
                 case "crs":
                 case "grp":
                 case "cat":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
                     $ref_id = $this->getFirstWritableRefId($usage["id"]);
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 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();
     }
 }
 /**
  * Constructor
  * @access	public
  * @param	integer	reference_id or object_id
  * @param	boolean	treat the id as reference_id (true) or object_id (false)
  */
 function ilObjSCORMLearningModule($a_id = 0, $a_call_by_reference = true)
 {
     $this->type = "sahs";
     parent::ilObject($a_id, $a_call_by_reference);
 }
 /**
  * Add usages to info
  *
  * @param
  * @return
  */
 function addUsagesToInfo($info, $glo_id)
 {
     global $lng, $ilAccess;
     $info->addSection($lng->txt("glo_usages"));
     include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
     $sms = ilObjSAHSLearningModule::getScormModulesForGlossary($glo_id);
     foreach ($sms as $sm) {
         $link = false;
         $refs = ilObject::_getAllReferences($sm);
         foreach ($refs as $ref) {
             if ($link === false) {
                 if ($ilAccess->checkAccess("write", "", $ref)) {
                     include_once "./Services/Link/classes/class.ilLink.php";
                     $link = ilLink::_getLink($ref, 'sahs');
                 }
             }
         }
         $entry = ilObject::_lookupTitle($sm);
         if ($link !== false) {
             $entry = "<a href='" . $link . "' target='_top'>" . $entry . "</a>";
         }
         $info->addProperty($lng->txt("obj_sahs"), $entry);
     }
 }
 /**
  * edit question
  */
 function edit()
 {
     global $ilCtrl, $ilTabs;
     $ilTabs->setTabActive('question');
     if ($this->getSelfAssessmentMode()) {
         $q_ref = $this->content_obj->getQuestionReference();
         if ($q_ref != "") {
             $inst_id = ilInternalLink::_extractInstOfTarget($q_ref);
             if (!($inst_id > 0)) {
                 $q_id = ilInternalLink::_extractObjIdOfTarget($q_ref);
             }
         }
         $q_type = $_POST["q_type"] != "" ? $_POST["q_type"] : $_GET["q_type"];
         $ilCtrl->setParameter($this, "q_type", $q_type);
         if ($q_id == "" && $q_type == "") {
             return $this->insert("edit_empty");
         }
         include_once "./Modules/TestQuestionPool/classes/class.ilQuestionEditGUI.php";
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
         /*			$ilCtrl->setCmdClass("ilquestioneditgui");
         			$ilCtrl->setCmd("editQuestion");
         			$edit_gui = new ilQuestionEditGUI();*/
         // create question first-hand (needed for uploads)
         if ($q_id < 1 && $q_type) {
             include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($q_type);
             // feedback editing mode
             include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
             if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled() && $_REQUEST['add_quest_cont_edit_mode'] != "") {
                 $addContEditMode = $_GET['add_quest_cont_edit_mode'];
             } else {
                 $addContEditMode = assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT;
             }
             $q_gui->object->setAdditionalContentEditingMode($addContEditMode);
             //set default tries
             $q_gui->object->setDefaultNrOfTries(ilObjSAHSLearningModule::_getTries($this->scormlmid));
             $q_id = $q_gui->object->createNewQuestion(true);
             $this->content_obj->setQuestionReference("il__qst_" . $q_id);
             $this->pg_obj->update();
             unset($q_gui);
         }
         $ilCtrl->setParameterByClass("ilQuestionEditGUI", "q_id", $q_id);
         $ilCtrl->redirectByClass(array(get_class($this->pg_obj) . "GUI", "ilQuestionEditGUI"), "editQuestion");
         /*			$edit_gui->setPoolObjId(0);
         			$edit_gui->setQuestionId($q_id);	
         			$edit_gui->setQuestionType($q_type);
         			$edit_gui->setSelfAssessmentEditingMode(true);
         			$edit_gui->setPageConfig($this->getPageConfig());
         			$ret = $ilCtrl->forwardCommand($edit_gui);
         			$this->tpl->setContent($ret);*/
         return $ret;
     } else {
         require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
         $q_gui =& assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
         $this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($q_gui)), "editQuestion");
     }
 }
 /**
  * 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();
 }