/** * get current object id for import id (static) * * import ids can exist multiple times (if the same learning module * has been imported multiple times). we get the object id of * the last imported object, that is not in trash * * @param int $a_import_id import id * * @return int id */ function _getIdForImportId($a_import_id) { global $ilDB; $q = "SELECT obj_id FROM lm_data WHERE import_id = " . $ilDB->quote($a_import_id, "text") . " " . " ORDER BY create_date DESC"; $obj_set = $ilDB->query($q); while ($obj_rec = $ilDB->fetchAssoc($obj_set)) { $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]); // link only in learning module, that is not trashed include_once "./Services/Help/classes/class.ilObjHelpSettings.php"; if (ilObject::_hasUntrashedReference($lm_id) || ilObjHelpSettings::isHelpLM($lm_id)) { return $obj_rec["obj_id"]; } } return 0; }
/** * Show online help */ function showHelp() { global $ilHelp, $lng, $ilSetting; if ($_GET["help_screen_id"] != "") { ilSession::set("help_screen_id", $_GET["help_screen_id"]); $help_screen_id = $_GET["help_screen_id"]; } else { $help_screen_id = ilSession::get("help_screen_id"); } $this->resetCurrentPage(); $id_arr = explode(".", $help_screen_id); include_once "./Services/Help/classes/class.ilHelpMapping.php"; $help_arr = ilHelpMapping::getHelpSectionsForId($id_arr[0], $id_arr[1]); $hm = (int) $ilSetting->get("help_module"); if ((OH_REF_ID > 0 || $hm > 0) && count($help_arr) > 0) { if (OH_REF_ID > 0) { $oh_lm_id = ilObject::_lookupObjId(OH_REF_ID); } else { include_once "./Services/Help/classes/class.ilObjHelpSettings.php"; $oh_lm_id = ilObjHelpSettings::lookupModuleLmId($hm); } include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; $acc = new ilAccordionGUI(); $acc->setId("oh_acc"); $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN); foreach ($help_arr as $h_id) { include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; $st_id = $h_id; if (!ilLMObject::_exists($st_id)) { continue; } $pages = ilLMObject::getPagesOfChapter($oh_lm_id, $st_id); include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php"; $grp_list = new ilGroupedListGUI(); foreach ($pages as $pg) { $grp_list->addEntry(ilLMObject::_lookupTitle($pg["child"]), "#", "", "return il.Help.showPage(" . $pg["child"] . ");"); } $acc->addItem(ilLMObject::_lookupTitle($st_id), $grp_list->getHTML()); } $h_tpl = new ilTemplate("tpl.help.html", true, true, "Services/Help"); $h_tpl->setVariable("HEAD", $lng->txt("help")); $h_tpl->setVariable("CONTENT", $acc->getHTML()); $h_tpl->setVariable("CLOSE_IMG", ilUtil::img(ilUtil::getImagePath("icon_close2_s.png"))); echo $h_tpl->get(); } exit; }