/** * Get node icon * * @param array $a_node node array * @return string icon path */ function getNodeIcon($a_node) { if ($a_node["child"] == $this->getNodeId($this->getRootNode())) { $icon = ilUtil::getImagePath("icon_lm.svg"); } else { $a_name = "icon_" . $a_node["type"] . ".svg"; if ($a_node["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()) ? "_sc" : ""; $a_name = "icon_pg" . $img_sc . ".svg"; if (!$active) { $a_name = "icon_pg_d" . $img_sc . ".svg"; } else { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_node["child"], $this->lm->getType()); if ($contains_dis) { $a_name = "icon_pg_del" . $img_sc . ".svg"; } } } $icon = ilUtil::getImagePath($a_name); } return $icon; }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl; //var_dump($a_set); // icon... // check activation include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($a_set["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); // is page scheduled? $img_sc = $this->lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()) ? "_sc" : ""; if (!$active) { $img = "icon_pg_d" . $img_sc . ".svg"; $alt = $lng->txt("cont_page_deactivated"); } else { if (ilLMPage::_lookupContainsDeactivatedElements($a_set["obj_id"], $this->lm->getType())) { $img = "icon_pg_del" . $img_sc . ".svg"; $alt = $lng->txt("cont_page_deactivated_elements"); } else { $img = "icon_pg" . $img_sc . ".svg"; $alt = $this->lng->txt("pg"); } } $this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt)); // title/link $ilCtrl->setParameter($this, "backcmd", ""); $ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]); $this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit")); $this->tpl->setVariable("TITLE", $a_set["title"]); $this->tpl->setVariable("ID", $a_set["obj_id"]); // context if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) { $path_str = $this->parent_obj->getContextPath($a_set["obj_id"]); } else { $path_str = "---"; } // check whether page is header or footer $add_str = ""; if ($a_set["obj_id"] == $this->lm->getHeaderPage()) { $add_str = " <b>(" . $lng->txt("cont_header") . ")</b>"; } if ($a_set["obj_id"] == $this->lm->getFooterPage()) { $add_str .= " <b>(" . $lng->txt("cont_footer") . ")</b>"; } $this->tpl->setVariable("USAGE", $path_str . $add_str); // layout if ($this->lm->getLayoutPerPage()) { if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") { $this->tpl->setVariable("LAYOUT", $lng->txt("cont_layout_" . $l)); } } }
/** * Get node icon alt text * * @param array $a_node node array * @return string alt text */ function getNodeIconAlt($a_node) { global $lng; include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; if ($a_node["type"] == "du") { $a_node["type"] = "lm"; } if ($a_node["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $lm_set = new ilSetting("lm"); $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $lm_set->get("time_scheduled_page_activation")); if (!$active) { return $lng->txt("cont_page_deactivated"); } else { $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_node["child"], $this->lm->getType()); if ($contains_dis) { return $lng->txt("cont_page_deactivated_elements"); } } } return parent::getNodeIconAlt($a_node); }
/** * Update internal links, after multiple pages have been copied */ static function updateInternalLinks($a_copied_nodes, $a_parent_type = "lm") { $all_fixes = array(); foreach ($a_copied_nodes as $original_id => $copied_id) { $copied_type = ilLMObject::_lookupType($copied_id); $copy_lm = ilLMObject::_lookupContObjID($copied_id); if ($copied_type == "pg") { // // 1. Outgoing links from the copied page. // //$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id); include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $tpg = new ilLMPage($copied_id); $tpg->buildDom(); $il = $tpg->getInternalLinks(); $targets = array(); foreach ($il as $l) { $targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l["Target"]), "id" => (int) ilInternalLink::_extractObjIdOfTarget($l["Target"]), "inst" => (int) ilInternalLink::_extractInstOfTarget($l["Target"])); } $fix = array(); foreach ($targets as $target) { if (($target["inst"] == 0 || ($target["inst"] = IL_INST_ID)) && ($target["type"] == "pg" || $target["type"] == "st")) { // first check, whether target is also within the copied set if ($a_copied_nodes[$target["id"]] > 0) { $fix[$target["id"]] = $a_copied_nodes[$target["id"]]; } else { // now check, if a copy if the target is already in the same lm // only if target is not already in the same lm! $trg_lm = ilLMObject::_lookupContObjID($target["id"]); if ($trg_lm != $copy_lm) { $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $target["type"] . "_" . $target["id"]); $found = false; foreach ($lm_data as $item) { if (!$found && $item["lm_id"] == $copy_lm) { $fix[$target["id"]] = $item["obj_id"]; $found = true; } } } } } } // outgoing links to be fixed if (count($fix) > 0) { //echo "<br>--".$copied_id; //var_dump($fix); $t = ilObject::_lookupType($copy_lm); if (is_array($all_fixes[$t . ":" . $copied_id])) { $all_fixes[$t . ":" . $copied_id] += $fix; } else { $all_fixes[$t . ":" . $copied_id] = $fix; } } } if ($copied_type == "pg" || $copied_type == "st") { // // 2. Incoming links to the original pages // // A->B A2 (A+B currently copied) // A->C B2 // B->A // C->A C2->A (C already copied) $original_lm = ilLMObject::_lookupContObjID($original_id); $original_type = ilObject::_lookupType($original_lm); if ($original_lm != $copy_lm) { // This gets sources that link to A+B (so we have C here) // (this also does already the trick when instance map areas are given in C) // int_link, where target_type, target_id, target_inst -> ok $sources = ilInternalLink::_getSourcesOfTarget($copied_type, $original_id, 0); // mobs linking to $original_id // map_area, where link_type, target -> ok $mobs = ilMapArea::_getMobsForTarget("int", "il__" . $copied_type . "_" . $original_id); // pages using these mobs include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; foreach ($mobs as $mob) { // mob_usage, where id -> ok // mep_item, where foreign_id, type -> ok // mep_tree, where child -> already existed // il_news_item, where mob_id -> ok // map_area, where link_type, target -> aready existed // media_item, where id -> already existed // personal_clipboard, where item_id, type -> ok $usages = ilObjMediaObject::lookupUsages($mob); foreach ($usages as $usage) { if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st") { $sources[] = $usage; } } } $fix = array(); foreach ($sources as $source) { $stype = explode(":", $source["type"]); $source_type = $stype[1]; if ($source_type == "pg" || $source_type == "st") { // first of all: source must be in original lm $src_lm = ilLMObject::_lookupContObjID($source["id"]); if ($src_lm == $original_lm) { // check, if a copy if the source is already in the same lm // now we look for the latest copy of C in LM2 $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $source_type . "_" . $source["id"], $copy_lm); $found = false; foreach ($lm_data as $item) { if (!$found) { $fix[$item["obj_id"]][$original_id] = $copied_id; $found = true; } } } } } // outgoing links to be fixed if (count($fix) > 0) { foreach ($fix as $page_id => $fix_array) { $t = ilObject::_lookupType($copy_lm); if (is_array($all_fixes[$t . ":" . $page_id])) { $all_fixes[$t . ":" . $page_id] += $fix_array; } else { $all_fixes[$t . ":" . $page_id] = $fix_array; } } } } } } foreach ($all_fixes as $pg => $fixes) { $pg = explode(":", $pg); include_once "./Services/COPage/classes/class.ilPageObjectFactory.php"; $page = ilPageObjectFactory::getInstance($pg[0], $pg[1]); if ($page->moveIntLinks($fixes)) { $page->update(true, true); } } }
function isVisible($a_id, $a_type) { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($a_id, $this->lm_obj->getType(), $this->lm_set->get("time_scheduled_page_activation")); if (!$active && $a_type == "pg") { $act_data = ilLMPage::_lookupActivationData((int) $a_id, $this->lm_obj->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { return true; } else { return false; } } else { return true; } }
static function _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id) { include_once "./Services/Link/classes/class.ilInternalLink.php"; //echo "-".$a_rep_import_id."-".$a_rep_ref_id."-"; $sources = ilInternalLink::_getSourcesOfTarget("obj", ilInternalLink::_extractObjIdOfTarget($a_rep_import_id), ilInternalLink::_extractInstOfTarget($a_rep_import_id)); //var_dump($sources); foreach ($sources as $source) { //echo "A"; if ($source["type"] == "lm:pg") { //echo "B"; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (self::_exists("lm", $source["id"], $source["lang"])) { $page_obj = new ilLMPage($source["id"], 0, $source["lang"]); if (!$page_obj->page_not_found) { //echo "C"; $page_obj->handleImportRepositoryLink($a_rep_import_id, $a_rep_type, $a_rep_ref_id); } $page_obj->update(); } } } }
/** * activates or deactivates pages */ function activatePages() { if (is_array($_POST["id"])) { foreach ($_POST["id"] as $id) { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $act = ilLMPage::_lookupActive($id, $this->object->getType()); ilLMPage::_writeActive($id, $this->object->getType(), !$act); } } $this->ctrl->redirect($this, "pages"); }
/** * activates or deactivates pages */ function activatePages() { global $lng; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (is_array($_POST["id"])) { $act_items = array(); // get all "top" ids, i.e. remove ids, that have a selected parent foreach ($_POST["id"] as $id) { $path = $this->tree->getPathId($id); $take = true; foreach ($path as $path_id) { if ($path_id != $id && in_array($path_id, $_POST["id"])) { $take = false; } } if ($take) { $act_items[] = $id; } } foreach ($act_items as $id) { $childs = $this->tree->getChilds($id); foreach ($childs as $child) { if (ilLMObject::_lookupType($child["child"]) == "pg") { $act = ilLMPage::_lookupActive($child["child"], $this->content_object->getType()); ilLMPage::_writeActive($child["child"], $this->content_object->getType(), !$act); } } if (ilLMObject::_lookupType($id) == "pg") { $act = ilLMPage::_lookupActive($id, $this->content_object->getType()); ilLMPage::_writeActive($id, $this->content_object->getType(), !$act); } } } else { ilUtil::sendFailure($lng->txt("no_checkbox"), true); } $this->ctrl->redirect($this, "view"); }
/** * presentation title doesn't have to be page title, it may be * chapter title + page title or chapter title only, depending on settings * * @param string $a_mode IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER */ static function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-") { if ($a_mode == IL_NO_HEADER && !$a_force_content) { return ""; } if ($a_lm_id == 0) { $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id); } if ($a_lm_id == 0) { return ""; } // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI) $title = ilLMObject::_lookupTitle($a_pg_id); // this is also optimized since ilObjectTranslation re-uses instances for one lm include_once "./Services/Object/classes/class.ilObjectTranslation.php"; $ot = ilObjectTranslation::getInstance($a_lm_id); $languages = $ot->getLanguages(); if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang])) { include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php"; $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang); if ($lmobjtrans->getTitle() != "") { $title = $lmobjtrans->getTitle(); } } if ($a_mode == IL_PAGE_TITLE) { return $title; } include_once "./Modules/LearningModule/classes/class.ilLMTree.php"; $tree = ilLMTree::getInstance($a_lm_id); if ($tree->isInTree($a_pg_id)) { $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st"); $childs = $tree->getChildsByType($pred_node["obj_id"], "pg"); $cnt_str = ""; if (count($childs) > 1) { $cnt = 0; foreach ($childs as $child) { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($a_lm_id), $a_time_scheduled_activation); if (!$active) { $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id)); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $active = true; } } if ($child["type"] != "pg" || $active) { $cnt++; } if ($child["obj_id"] == $a_pg_id) { $cur_cnt = $cnt; } } if ($cnt > 1) { $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")"; } } require_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; //$struct_obj =& new ilStructureObject($pred_node["obj_id"]); //return $struct_obj->getTitle(); return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers, false, 0, $a_lang) . $cnt_str; //return $pred_node["title"].$cnt_str; } else { return $title; } }
/** * Auto link glossary terms * * @param * @return */ function autoLinkGlossaryTerms($a_glo_id) { // get terms include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; $terms = ilGlossaryTerm::getTermList($a_glo_id); // each get page: get content include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $pages = ilLMPage::getAllPages($this->getType(), $this->getId()); // determine terms that occur in the page $found_pages = array(); foreach ($pages as $p) { $pg = new ilLMPage($p["id"]); $c = $pg->getXMLContent(); foreach ($terms as $t) { if (is_int(stripos($c, $t["term"]))) { $found_pages[$p["id"]]["terms"][] = $t; if (!is_object($found_pages[$p["id"]]["page"])) { $found_pages[$p["id"]]["page"] = $pg; } } } reset($terms); } // ilPCParagraph autoLinkGlossariesPage with page and terms include_once "./Services/COPage/classes/class.ilPCParagraph.php"; foreach ($found_pages as $id => $fp) { ilPCParagraph::autoLinkGlossariesPage($fp["page"], $fp["terms"]); } }
/** * show print view */ function showPrintView() { global $ilUser, $lng, $ilCtrl; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (!$this->lm->isActivePrintView()) { return; } $this->renderPageTitle(); $c_obj_id = $this->getCurrentPageId(); // set values according to selection if ($_POST["sel_type"] == "page") { if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) { $_POST["obj_id"][] = $c_obj_id; } } if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) { $path = $this->lm_tree->getPathFull($c_obj_id); $chap_id = $path[1]["child"]; if ($chap_id > 0) { $_POST["obj_id"][] = $chap_id; } } //var_dump($_GET); //var_dump($_POST); // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } // content style $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true); // set title header $this->tpl->setVariable("HEADER", $this->lm->getTitle()); $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId())); include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php"; include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; include_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; $act_level = 99999; $activated = false; $glossary_links = array(); $output_header = false; $media_links = array(); // get header and footer if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getFooterPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $footer_page_content = $page_object_gui->showPage(); } } if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getHeaderPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $header_page_content = $page_object_gui->showPage(); } } // add free selected pages if (is_array($_POST["obj_id"])) { foreach ($_POST["obj_id"] as $k) { if ($k > 0 && !$this->lm_tree->isInTree($k)) { if (ilLMObject::_lookupType($k) == "pg") { $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true); } } } } else { ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true); $ilCtrl->redirect($this, "showPrintViewSelection"); } foreach ($nodes as $node_key => $node) { // check page activation $active = ilLMPage::_lookupActive($node["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($node["type"] == "pg" && !$active) { continue; } // print all subchapters/subpages if higher chapter // has been selected if ($node["depth"] <= $act_level) { if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) { $act_level = $node["depth"]; $activated = true; } else { $act_level = 99999; $activated = false; } } if ($activated && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) { // output learning module header if ($node["type"] == "du") { $output_header = true; } // output chapter title if ($node["type"] == "st") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $chap = new ilStructureObject($this->lm, $node["obj_id"]); $this->tpl->setCurrentBlock("print_chapter"); $chapter_title = $chap->_getPresentationTitle($node["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang); $this->tpl->setVariable("CHAP_TITLE", $chapter_title); if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($nodes[$node_key + 1]["type"] == "pg") { $this->tpl->setVariable("CHAP_HEADER", $header_page_content); $did_chap_page_header = true; } } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); } // output page if ($node["type"] == "pg") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $this->tpl->setCurrentBlock("print_item"); // get page $page_id = $node["obj_id"]; $page_object_gui = $this->getLMPageGUI($page_id); $page_object = $page_object_gui->getPageObject(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // get lm page $lm_pg_obj = new ilLMPageObject($this->lm, $page_id); $lm_pg_obj->setLMId($this->lm->getId()); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) { $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); // prevent page title after chapter title // that have the same content if ($this->lm->isActiveNumbering()) { $chapter_title = trim(substr($chapter_title, strpos($chapter_title, " "))); } if ($page_title != $chapter_title) { $page_object_gui->setPresentationTitle($page_title); } } // handle header / footer $hcont = $header_page_content; $fcont = $footer_page_content; if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($did_chap_page_header) { $hcont = ""; } if ($nodes[$node_key + 1]["type"] == "pg" && !($nodes[$node_key + 1]["depth"] <= $act_level && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) { $fcont = ""; } } $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $page_content = $page_object_gui->showPage(); if ($this->lm->getPageHeader() != IL_PAGE_TITLE) { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont); } else { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont . "<br />"); } $chapter_title = ""; $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); // get internal links $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]); $got_mobs = false; foreach ($int_links as $key => $link) { if ($link["type"] == "git" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $glossary_links[$key] = $link; } if ($link["type"] == "mob" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $got_mobs = true; $mob_links[$key] = $link; } } // this is not cool because of performance reasons // unfortunately the int link table does not // store the target frame (we want to append all linked // images but not inline images (i.e. mobs with no target // frame)) if ($got_mobs) { $page_object->buildDom(); $links = $page_object->getInternalLinks(); foreach ($links as $link) { if ($link["Type"] == "MediaObject" && $link["TargetFrame"] != "" && $link["TargetFrame"] != "None") { $media_links[] = $link; } } } } } } $annex_cnt = 0; $annexes = array(); // glossary if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) { include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; // sort terms $terms = array(); foreach ($glossary_links as $key => $link) { $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]); $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term); } $terms = ilUtil::sortArray($terms, "term", "asc"); //ksort($terms); foreach ($terms as $t) { $link = $t["link"]; $key = $t["key"]; $defs = ilGlossaryDefinition::getDefinitionList($link["id"]); $def_cnt = 1; // output all definitions of term foreach ($defs as $def) { // definition + number, if more than 1 definition if (count($defs) > 1) { $this->tpl->setCurrentBlock("def_title"); $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . $def_cnt++); $this->tpl->parseCurrentBlock(); } include_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php"; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setTemplateOutput(false); $page_gui->setOutputMode("print"); $this->tpl->setCurrentBlock("definition"); $page_gui->setFileDownloadLink("#"); $page_gui->setFullscreenLink("#"); $page_gui->setSourceCodeDownloadScript("#"); $output = $page_gui->showPage(); $this->tpl->setVariable("VAL_DEFINITION", $output); $this->tpl->parseCurrentBlock(); } // output term $this->tpl->setCurrentBlock("term"); $this->tpl->setVariable("VAL_TERM", $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])); $this->tpl->parseCurrentBlock(); } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("glossary"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo"); $this->tpl->setVariable("TXT_GLOSSARY", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // referenced images if (count($media_links) > 0) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; foreach ($media_links as $media) { if (substr($media["Target"], 0, 4) == "il__") { $arr = explode("_", $media["Target"]); $id = $arr[count($arr) - 1]; $med_obj = new ilObjMediaObject($id); $med_item = $med_obj->getMediaItem("Standard"); if (is_object($med_item)) { if (is_int(strpos($med_item->getFormat(), "image"))) { $this->tpl->setCurrentBlock("ref_image"); // image source if ($med_item->getLocationType() == "LocalFile") { $this->tpl->setVariable("IMG_SOURCE", ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id . "/" . $med_item->getLocation()); } else { $this->tpl->setVariable("IMG_SOURCE", $med_item->getLocation()); } if ($med_item->getCaption() != "") { $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption()); } else { $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle()); } $this->tpl->parseCurrentBlock(); } } } } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("ref_images"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images"); $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // output learning module title and toc if ($output_header) { $this->tpl->setCurrentBlock("print_header"); $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle()); if ($this->lm->getDescription() != "none") { include_once "Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); $md_gen = $md->getGeneral(); foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); } $this->tpl->setVariable("LM_DESCRIPTION", $description); } $this->tpl->parseCurrentBlock(); // output toc $nodes2 = $nodes; foreach ($nodes2 as $node2) { if ($node2["type"] == "st" && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) { for ($j = 1; $j < $node2["depth"]; $j++) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", ilStructureObject::_getPresentationTitle($node2["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang)); $this->tpl->parseCurrentBlock(); } } // annexes foreach ($annexes as $annex) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", $annex); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc"); $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_start_block"); $this->tpl->parseCurrentBlock(); } // output author information include_once 'Services/MetaData/classes/class.ilMD.php'; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); if (is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach ($ids = $lifecycle->getContributeIds() as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author . $sep . $md_ent->getEntity(); $sep = ", "; } } } if ($author != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("author"); $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author")); $this->tpl->setVariable("LM_AUTHOR", $author); $this->tpl->parseCurrentBlock(); } } // output copyright information if (is_object($md_rights = $md->getRights())) { $copyright = $md_rights->getDescription(); include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($copyright); if ($copyright != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("copyright"); $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright")); $this->tpl->setVariable("LM_COPYRIGHT", $copyright); $this->tpl->parseCurrentBlock(); } } $this->tpl->show(false); }
/** * Get icon alt text * * @param array itema array * @return string icon alt text */ function getChildIconAlt($a_item) { global $lng; include_once "./Modules/LearningModule/classes/class.ilLMObject.php"; if ($a_item["type"] == "pg") { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($a_item["node_id"], $this->lm_type); if (!$active) { return $lng->txt("cont_page_deactivated"); } else { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_item["node_id"], $this->lm_type); if ($contains_dis) { return $lng->txt("cont_page_deactivated_elements"); } } } return ilUtil::getImagePath("icon_" . $a_item["type"] . ".png"); }
/** * presentation title doesn't have to be page title, it may be * chapter title + page title or chapter title only, depending on settings * * @param string $a_mode IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER */ function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-") { global $ilDB, $ilUser; if ($a_lm_id == 0) { $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id); } // @todo: optimize include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang("lm", $a_lm_id); // select $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_pg_id, "integer"); $pg_set = $ilDB->query($query); $pg_rec = $ilDB->fetchAssoc($pg_set); if ($a_lang != "-" && $ml->getActivated() && in_array($a_lang, $ml->getLanguages())) { include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php"; $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang); if ($lmobjtrans->getTitle() != "") { $pg_rec["title"] = $lmobjtrans->getTitle(); } } if ($a_mode == IL_NO_HEADER && !$a_force_content) { return ""; } $tree = new ilTree($pg_rec["lm_id"]); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); if ($a_mode == IL_PAGE_TITLE) { $nr = ""; return $nr . $pg_rec["title"]; } if ($tree->isInTree($pg_rec["obj_id"])) { $pred_node = $tree->fetchPredecessorNode($pg_rec["obj_id"], "st"); $childs = $tree->getChildsByType($pred_node["obj_id"], "pg"); $cnt_str = ""; if (count($childs) > 1) { $cnt = 0; foreach ($childs as $child) { include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation); if (!$active) { $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"])); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $active = true; } } if ($child["type"] != "pg" || $active) { $cnt++; } if ($child["obj_id"] == $pg_rec["obj_id"]) { $cur_cnt = $cnt; } } if ($cnt > 1) { $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")"; } } require_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; //$struct_obj =& new ilStructureObject($pred_node["obj_id"]); //return $struct_obj->getTitle(); return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers) . $cnt_str; //return $pred_node["title"].$cnt_str; } else { return $pg_rec["title"]; } }
/** * 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")); } }
/** * Get href for node * * @param mixed $a_node node object/array * @return string href attribute */ function getNodeHref($a_node) { if (!$this->getOfflineMode()) { return $this->lm_pres->getLink($this->lm->getRefId(), "", $a_node["child"]); //return parent::buildLinkTarget($a_node_id, $a_type); } else { if ($a_node["type"] != "pg") { // get next activated page $found = false; while (!$found) { $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg"); include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($a_node["child"] > 0 && !$active) { $found = false; } else { $found = true; } } } include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; if ($nid = ilLMPageObject::getExportId($this->lm->getId(), $a_node["child"])) { return "lm_pg_" . $nid . ".html"; } return "lm_pg_" . $a_node["child"] . ".html"; } }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl; $this->tpl->setVariable("TXT_PAGE_TITLE", $a_set["title"]); $ilCtrl->setParameterByClass("illmpageobjectgui", "obj_id", $a_set["obj_id"]); $this->tpl->setVariable("HREF_PAGE", $ilCtrl->getLinkTargetByClass("illmpageobjectgui", "edit")); include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $page_object = new ilLMPage($a_set["obj_id"]); $page_object->buildDom(); $int_links = $page_object->getInternalLinks(); foreach ($int_links as $link) { $target = $link["Target"]; if (substr($target, 0, 4) == "il__") { $target_arr = explode("_", $target); $target_id = $target_arr[count($target_arr) - 1]; $type = $link["Type"]; switch ($type) { case "PageObject": $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg")); if (ilLMObject::_exists($target_id)) { $lm_id = ilLMObject::_lookupContObjID($target_id); $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : ""; $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str); } else { $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>"); } $this->tpl->parseCurrentBlock(); break; case "StructureObject": $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st")); if (ilLMObject::_exists($target_id)) { $lm_id = ilLMObject::_lookupContObjID($target_id); $add_str = $lm_id != $this->lm_id ? " (" . ilObject::_lookupTitle($lm_id) . ")" : ""; $this->tpl->setVariable("TXT_LINK_TITLE", ilLMObject::_lookupTitle($target_id) . $add_str); } else { $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>"); } $this->tpl->parseCurrentBlock(); break; case "GlossaryItem": $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term")); include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; if (ilGlossaryTerm::_exists($target_id)) { $this->tpl->setVariable("TXT_LINK_TITLE", ilGlossaryTerm::_lookGlossaryTerm($target_id)); } else { $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>"); } $this->tpl->parseCurrentBlock(); break; case "MediaObject": $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob")); if (ilObject::_exists($target_id)) { $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($target_id)); } else { $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>"); } $this->tpl->parseCurrentBlock(); break; case "RepositoryItem": $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item")); $obj_type = ilObject::_lookupType($target_id, true); $obj_id = ilObject::_lookupObjId($target_id); if (ilObject::_exists($obj_id)) { $this->tpl->setVariable("TXT_LINK_TITLE", ilObject::_lookupTitle($obj_id) . " (" . $lng->txt("obj_" . $obj_type) . ")"); } else { $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target_id . "]" . "</b>"); } $this->tpl->parseCurrentBlock(); break; } } else { $type = $link["Type"]; switch ($type) { case "PageObject": $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("pg")); break; case "StructureObject": $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("st")); break; case "GlossaryItem": $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_term")); break; case "MediaObject": $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("mob")); break; case "RepositoryItem": $this->tpl->setVariable("TXT_LINK_TYPE", $lng->txt("cont_repository_item")); break; } $this->tpl->setCurrentBlock("link"); $this->tpl->setVariable("TXT_MISSING", "<b>" . $lng->txt("cont_target_missing") . " [" . $target . "]" . "</b>"); $this->tpl->parseCurrentBlock(); } } }