/** * Object specific configuration * * @param int $a_obj_id object id */ function configureByObjectId($a_obj_id) { if ($a_obj_id > 0) { include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $this->setDisableDefaultQuestionFeedback(ilObjLearningModule::_lookupDisableDefaultFeedback($a_obj_id)); if (ilObjContentObject::isOnlineHelpModule($a_obj_id, true)) { $this->setEnableSelfAssessment(false, false); } } }
/** * Show link help list */ function showLinkHelp() { global $ilUser, $ilCtrl; // filter link types if (!$this->filter_white_list) { foreach ($this->filter_link_types as $link_type) { unset($this->ltypes[$link_type]); } } else { $ltypes = array(); foreach ($this->ltypes as $k => $l) { if (in_array($k, $this->filter_link_types)) { $ltypes[$k] = $l; } } $this->ltypes = $ltypes; } // determine link type and target $this->determineLinkType(); $ltype = $this->link_target != "" ? $this->link_type . "_" . $this->link_target : $this->link_type; $def_type = ilObject::_lookupType($this->default_obj, true); // determine content object id switch ($this->link_type) { case "PageObject": case "StructureObject": if (empty($_SESSION["il_link_cont_obj"]) && ($def_type != "mep" && $def_type != "glo")) { $_SESSION["il_link_cont_obj"] = $this->default_obj; } break; case "GlossaryItem": if (empty($_SESSION["il_link_glossary"]) && $def_type == "glo") { $_SESSION["il_link_glossary"] = $this->default_obj; } break; case "Media": if (empty($_SESSION["il_link_mep"]) && $def_type == "mep") { $_SESSION["il_link_mep"] = $this->default_obj; } break; } /* $target_str = ($link_target == "") ? "" : " target=\"".$link_target."\" ";*/ $target_str = $this->link_target == "" ? "" : " target=\"" . $this->link_target . "\""; //echo "-".$this->link_type."-"; if ($this->link_type == "GlossaryItem" && (empty($_SESSION["il_link_glossary"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_glossary"], true), array("glo")))) { $this->changeTargetObject("glo"); } if (($this->link_type == "PageObject" || $this->link_type == "StructureObject") && (empty($_SESSION["il_link_cont_obj"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk")))) { $this->changeTargetObject("cont_obj"); } if ($ilCtrl->isAsynch()) { $tpl = new ilTemplate("tpl.link_help_asynch.html", true, true, "Modules/LearningModule"); } else { $tpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule"); $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); } switch ($this->link_type) { case "GlossaryItem": $this->ctrl->setParameter($this, "target_type", "glo"); break; case "PageObject": case "StructureObject": $this->ctrl->setParameter($this, "target_type", "cont_obj"); break; case "Media": $this->ctrl->setParameter($this, "target_type", "mep"); break; default: break; } //echo "<br><br>:".$this->ctrl->getFormAction($this).":"; //echo "<br>link_type:".$this->link_type; //echo "<br>cont_obj:".$_SESSION["il_link_cont_obj"]; //echo "<br>link_mep".$_SESSION["il_link_mep"]; //echo $this->ctrl->getFormAction($this, "", "", true); $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "changeLinkType", "", true)); $tpl->setVariable("FORMACTION2", $this->ctrl->getFormAction($this)); $tpl->setVariable("TXT_HELP_HEADER", $this->lng->txt("cont_link_select")); $tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_link_type")); //echo "<br><br>".$ltype; $select_ltype = ilUtil::formSelect($ltype, "ltype", $this->ltypes, false, true, "0", "", array("id" => "ilIntLinkTypeSelector")); $tpl->setVariable("SELECT_TYPE", $select_ltype); $tpl->setVariable("CMD_CHANGETYPE", "changeLinkType"); $tpl->setVariable("BTN_CHANGETYPE", $this->lng->txt("cont_change_type")); /* if ($this->isEnabledJavaScript()) { $tpl->setVariable("BTN_CLOSE_JS", $this->lng->txt("close")); } else {*/ $tpl->setVariable("CMD_CLOSE", "closeLinkHelp"); $tpl->setVariable("BTN_CLOSE", $this->lng->txt("close")); // } $chapterRowBlock = "chapter_row"; $anchor_row_block = "anchor_link"; if ($this->isEnabledJavaScript()) { $chapterRowBlock .= "_js"; $anchor_row_block .= "_js"; } $obj_id = ilObject::_lookupObjId($_SESSION["il_link_cont_obj"]); $type = ilObject::_lookupType($obj_id); // switch link type switch ($this->link_type) { // page link case "PageObject": require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true); // get all chapters $ctree = $cont_obj->getLMTree(); $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId())); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj")); $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($nodes as $node) { if ($node["type"] == "st") { $tpl->setCurrentBlock("chapter_row"); $tpl->setVariable("TXT_CHAPTER", $node["title"]); $tpl->setVariable("ROWCLASS", "tblrow1"); //$tpl->setVariable("LINK_CHAPTER", // "[iln chap=\"".$node["obj_id"]."\"".$target_str."] [/iln]"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } if ($node["type"] == "pg") { include_once "./Services/COPage/classes/class.ilPCParagraph.php"; $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPCParagraph::_readAnchors($type, $node["obj_id"], "")); } } // get all free pages $pages = ilLMPageObject::getPageList($cont_obj->getId()); $free_pages = array(); foreach ($pages as $page) { if (!$ctree->isInTree($page["obj_id"])) { $free_pages[] = $page; } } if (count($free_pages) > 0) { $tpl->setCurrentBlock(str_replace("_js", "", $chapterRowBlock)); $tpl->setVariable("TXT_CHAPTER", $this->lng->txt("cont_free_pages")); $tpl->setVariable("ROWCLASS", "tblrow1"); $tpl->parseCurrentBlock(); foreach ($free_pages as $node) { include_once "./Services/COPage/classes/class.ilPCParagraph.php"; $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPCParagraph::_readAnchors($type, $node["obj_id"], "")); } } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // chapter link // chapter link case "StructureObject": // check whether current object matchs to type if (!in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk"))) { $this->changeTargetObject("lm"); } if ($type == "lm") { require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true); } else { if ($type == "dbk") { require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php"; $cont_obj = new ilObjDlBook($_SESSION["il_link_cont_obj"], true); } } // get all chapters $ctree =& $cont_obj->getLMTree(); $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId())); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj")); $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($nodes as $node) { if ($node["type"] == "st") { $this->renderLink($tpl, $node["title"], $node["obj_id"], "StructureObject", "st", "chap"); } } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // glossary item link // glossary item link case "GlossaryItem": require_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; $glossary =& new ilObjGlossary($_SESSION["il_link_glossary"], true); // get all glossary items $terms = $glossary->getTermList(); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("glossary")); $tpl->setVariable("TXT_CONT_TITLE", $glossary->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($terms as $term) { $this->renderLink($tpl, $term["term"], $term["id"], "GlossaryItem", "git", "term"); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // media object // media object case "Media": include_once "./Modules/MediaPool/classes/class.ilMediaPoolItem.php"; //$tpl->setVariable("TARGET2", " target=\"content\" "); // content object id = 0 --> get clipboard objects if ($_SESSION["il_link_mep"] == 0) { $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); $mobjs = $this->ilias->account->getClipboardObjects("mob"); // sort by name $objs = array(); foreach ($mobjs as $obj) { $objs[$obj["title"] . ":" . $obj["id"]] = $obj; } ksort($objs); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_media_source")); $tpl->setVariable("TXT_CONT_TITLE", $this->lng->txt("cont_personal_clipboard")); $tpl->setVariable("COLSPAN", "2"); foreach ($objs as $obj) { $this->renderLink($tpl, $obj["title"], $obj["id"], "MediaObject", "mob", "media"); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); } else { require_once "./Modules/MediaPool/classes/class.ilObjMediaPool.php"; $med_pool =& new ilObjMediaPool($_SESSION["il_link_mep"], true); // get current folders $fobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "fold"); $f2objs = array(); foreach ($fobjs as $obj) { $f2objs[$obj["title"] . ":" . $obj["child"]] = $obj; } ksort($f2objs); // get current media objects $mobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "mob"); $m2objs = array(); foreach ($mobjs as $obj) { $m2objs[$obj["title"] . ":" . $obj["child"]] = $obj; } ksort($m2objs); // merge everything together $objs = array_merge($f2objs, $m2objs); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("mep")); $tpl->setVariable("TXT_CONT_TITLE", $med_pool->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->setVariable("COLSPAN", "2"); $tpl->parseCurrentBlock(); if ($parent_id = $med_pool->getParentId($_SESSION["il_link_mep_obj"])) { $css_row = "tblrow1"; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("ROWCLASS", $css_row); $tpl->setVariable("TXT_CHAPTER", ".."); $this->ctrl->setParameter($this, "mep_fold", $parent_id); if ($ilCtrl->isAsynch()) { $tpl->setVariable("LINK", "#"); $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $parent_id . "');\" "); } else { $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder")); } $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } foreach ($objs as $obj) { if ($obj["type"] == "fold") { $css_row = $css_row == "tblrow2" ? "tblrow1" : "tblrow2"; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("ROWCLASS", $css_row); $tpl->setVariable("TXT_CHAPTER", $obj["title"]); $this->ctrl->setParameter($this, "mep_fold", $obj["child"]); if ($ilCtrl->isAsynch()) { $tpl->setVariable("LINK", "#"); $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $obj["child"] . "');\" "); } else { $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder")); } $tpl->parseCurrentBlock(); } else { $fid = ilMediaPoolItem::lookupForeignId($obj["child"]); if (ilObject::_lookupType($fid) == "mob") { $this->renderLink($tpl, $obj["title"], $fid, "MediaObject", "mob", "media"); } } $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); } break; // repository item // repository item case "RepositoryItem": $tpl->setVariable("LINK_HELP_CONTENT", $this->selectRepositoryItem()); break; // file download link // file download link case "File": if (!is_object($this->uploaded_file)) { $tpl->setVariable("LINK_HELP_CONTENT", $this->getFileLinkHTML()); } else { echo $this->getFileLinkHTML(); exit; } break; } if ($ilCtrl->isAsynch()) { echo $tpl->get(); exit; } exit; }
/** * 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; //var_dump($usage); if (is_int(strpos($usage["type"], ":"))) { $us_arr = explode(":", $usage["type"]); $usage["type"] = $us_arr[1]; $cont_type = $us_arr[0]; } //var_dump($usage); include_once './Services/Link/classes/class.ilLink.php'; switch ($usage["type"]) { case "pg": include_once "./Services/COPage/classes/class.ilPageObjectFactory.php"; $page_obj = ilPageObjectFactory::getInstance($cont_type, $usage["id"]); $item = array(); //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]); switch ($cont_type) { case "lm": 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($page_obj->getId() . "_" . $ref_id, "pg"); } break; case "wpg": require_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $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.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 "cont": $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type); $item["obj_title"] = ilObject::_lookupTitle($page_obj->getId()); $ref_id = $this->getFirstWritableRefId($page_obj->getId()); 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; } if (count($usage["hist_nr"]) > 5) { $ver .= "..., "; $cnt = count($usage["hist_nr"]) - 5; for ($i = 0; $i < $cnt; $i++) { unset($usage["hist_nr"][$i]); } } 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")); } }
/** * Delete module * * @param * @return */ function deleteModule($a_id) { global $ilDB, $ilSetting; // if this is the currently activated one, deactivate it first if ($a_id == (int) $ilSetting->get("help_module")) { $ilSetting->set("help_module", ""); } $set = $ilDB->query("SELECT * FROM help_module " . " WHERE id = " . $ilDB->quote($a_id, "integer")); $rec = $ilDB->fetchAssoc($set); // delete learning module if (ilObject::_lookupType($rec["lm_id"]) == "lm") { include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $lm = new ilObjLearningModule($rec["lm_id"], false); $lm->delete(); } // delete mappings include_once "./Services/Help/classes/class.ilHelpMapping.php"; ilHelpMapping::deleteEntriesOfModule($a_id); // delete tooltips include_once "./Services/Help/classes/class.ilHelp.php"; ilHelp::deleteTooltipsOfModule($a_id); // delete help module record $ilDB->manipulate("DELETE FROM help_module WHERE " . " id = " . $ilDB->quote($a_id, "integer")); }