/** * Get root node */ function getRootNode() { $root_id = $this->getTree()->readRootId(); if ($this->focus_id > 0 && $this->getTree()->isInTree($this->focus_id) && ilLMObject::_lookupType($this->focus_id) == "st") { // $root_id = $this->focus_id; } return $this->getTree()->getNodeData($root_id); }
/** * get html * @return */ public function getHTML() { global $lng, $ilUser; include_once 'Modules/LearningModule/classes/class.ilLMObject.php'; foreach ($this->getSubItemIds(true) as $sub_item) { if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) { $this->tpl->setCurrentBlock('sea_fragment'); $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item)); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('subitem'); $this->tpl->setVariable('SEPERATOR', ':'); switch (ilLMObject::_lookupType($sub_item, $this->getObjId())) { case 'pg': $this->getItemListGUI()->setChildId($sub_item); $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_pg')); $link = $this->getItemListGUI()->getCommandLink('page'); include_once './Services/Search/classes/class.ilUserSearchCache.php'; $link .= '&srcstring=1'; $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page')); $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item)); break; case 'st': $this->getItemListGUI()->setChildId($sub_item); $this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_st')); $link = $this->getItemListGUI()->getCommandLink('page'); include_once './Services/Search/classes/class.ilUserSearchCache.php'; $link .= '&srcstring=1'; $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page')); $this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item)); break; default: if (ilObject::_lookupType($sub_item) != 'file') { return ''; } $this->getItemListGUI()->setChildId('il__file_' . $sub_item); $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file')); $link = $this->getItemListGUI()->getCommandLink('downloadFile'); $this->tpl->setVariable('LINK', $link); $this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item)); break; } if (count($this->getSubItemIds(true)) > 1) { $this->parseRelevance($sub_item); } $this->tpl->parseCurrentBlock(); } $this->showDetailsLink(); return $this->tpl->get(); }
/** * Write layout setting * * @param int lm object id * @param string layout */ static function writeLayout($a_obj_id, $a_layout, $a_lm = null) { global $ilDB; $t = ilLMObject::_lookupType($a_obj_id); if ($t == "pg") { $query = "UPDATE lm_data SET " . " layout = " . $ilDB->quote($a_layout, "text") . " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"); $ilDB->manipulate($query); } else { if ($t == "st" && is_object($a_lm)) { $node = $a_lm->getLMTree()->getNodeData($a_obj_id); $child_nodes = $a_lm->getLMTree()->getSubTree($node); if (is_array($child_nodes) && count($child_nodes) > 0) { foreach ($child_nodes as $c) { if ($c["type"] == "pg") { $query = "UPDATE lm_data SET " . " layout = " . $ilDB->quote($a_layout, "text") . " WHERE obj_id = " . $ilDB->quote($c["child"], "integer"); $ilDB->manipulate($query); } } } } } }
function moveIntLinks($a_from_to) { $this->buildDom(); $changed = false; // resolve normal internal links $xpc = xpath_new_context($this->dom); $path = "//IntLink"; $res =& xpath_eval($xpc, $path); for ($i = 0; $i < count($res->nodeset); $i++) { $target = $res->nodeset[$i]->get_attribute("Target"); $type = $res->nodeset[$i]->get_attribute("Type"); $obj_id = ilInternalLink::_extractObjIdOfTarget($target); if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, "__"))) { if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") { $res->nodeset[$i]->set_attribute("Target", "il__pg_" . $a_from_to[$obj_id]); $changed = true; } if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") { $res->nodeset[$i]->set_attribute("Target", "il__st_" . $a_from_to[$obj_id]); $changed = true; } } } unset($xpc); // map areas $this->addHierIDs(); $xpc = xpath_new_context($this->dom); $path = "//MediaAlias"; $res =& xpath_eval($xpc, $path); require_once "Services/MediaObjects/classes/class.ilMediaItem.php"; require_once "Services/COPage/classes/class.ilMediaAliasItem.php"; for ($i = 0; $i < count($res->nodeset); $i++) { $media_object_node = $res->nodeset[$i]->parent_node(); $page_content_node = $media_object_node->parent_node(); $c_hier_id = $page_content_node->get_attribute("HierId"); // first check, wheter we got instance map areas -> take these $std_alias_item = new ilMediaAliasItem($this->dom, $c_hier_id, "Standard"); $areas = $std_alias_item->getMapAreas(); $correction_needed = false; if (count($areas) > 0) { // check if correction needed foreach ($areas as $area) { if ($area["Type"] == "PageObject" || $area["Type"] == "StructureObject") { $t = $area["Target"]; $tid = _extractObjIdOfTarget($t); if ($a_from_to[$tid] > 0) { $correction_needed = true; } } } } else { $areas = array(); // get object map areas and check whether at least one must // be corrected $oid = $res->nodeset[$i]->get_attribute("OriginId"); if (substr($oid, 0, 4) == "il__") { $id_arr = explode("_", $oid); $id = $id_arr[count($id_arr) - 1]; $mob = new ilObjMediaObject($id); $med_item = $mob->getMediaItem("Standard"); $med_areas = $med_item->getMapAreas(); foreach ($med_areas as $area) { $link_type = $area->getLinkType() == "int" ? "IntLink" : "ExtLink"; $areas[] = array("Nr" => $area->getNr(), "Shape" => $area->getShape(), "Coords" => $area->getCoords(), "Link" => array("LinkType" => $link_type, "Href" => $area->getHref(), "Title" => $area->getTitle(), "Target" => $area->getTarget(), "Type" => $area->getType(), "TargetFrame" => $area->getTargetFrame())); if ($area->getType() == "PageObject" || $area->getType() == "StructureObject") { $t = $area->getTarget(); $tid = ilInternalLink::_extractObjIdOfTarget($t); if ($a_from_to[$tid] > 0) { $correction_needed = true; } //var_dump($a_from_to); } } } } // correct map area links if ($correction_needed) { $changed = true; $std_alias_item->deleteAllMapAreas(); foreach ($areas as $area) { if ($area["Link"]["LinkType"] == "IntLink") { $target = $area["Link"]["Target"]; $type = $area["Link"]["Type"]; $obj_id = ilInternalLink::_extractObjIdOfTarget($target); if ($a_from_to[$obj_id] > 0) { if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") { $area["Link"]["Target"] = "il__pg_" . $a_from_to[$obj_id]; } if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") { $area["Link"]["Target"] = "il__st_" . $a_from_to[$obj_id]; } } } $std_alias_item->addMapArea($area["Shape"], $area["Coords"], $area["Link"]["Title"], array("Type" => $area["Link"]["Type"], "TargetFrame" => $area["Link"]["TargetFrame"], "Target" => $area["Link"]["Target"], "Href" => $area["Link"]["Href"], "LinkType" => $area["Link"]["LinkType"])); } } } unset($xpc); return $changed; }
/** * Save export IDs */ function saveExportIds() { global $ilCtrl, $lng; // check all export ids $ok = true; if (is_array($_POST["exportid"])) { foreach ($_POST["exportid"] as $pg_id => $exp_id) { if ($exp_id != "" && !preg_match("/^([a-zA-Z]+)[0-9a-zA-Z_]*\$/", trim($exp_id))) { $ok = false; } } } if (!$ok) { ilUtil::sendFailure($lng->txt("cont_exp_ids_not_resp_format1") . ": a-z, A-Z, 0-9, '_'. " . $lng->txt("cont_exp_ids_not_resp_format3") . " " . $lng->txt("cont_exp_ids_not_resp_format2")); $this->showExportIDsOverview(true); return; } if (is_array($_POST["exportid"])) { foreach ($_POST["exportid"] as $pg_id => $exp_id) { ilLMPageObject::saveExportId($this->object->getId(), $pg_id, ilUtil::stripSlashes($exp_id), ilLMObject::_lookupType($pg_id)); } } ilUtil::sendSuccess($lng->txt("cont_saved_export_ids"), true); $ilCtrl->redirect($this, "showExportIdsOverview"); }
/** * 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"); }
/** * 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); }
public function __appendChildLinks($html, $item, &$item_list_gui) { if (!count($item['child'])) { return $html; } $tpl = new ilTemplate('tpl.detail_links.html', true, true, 'Services/Search'); switch ($item['type']) { case 'lm': $tpl->setVariable("HITS", $this->lng->txt('search_hits')); include_once 'Modules/LearningModule/classes/class.ilLMObject.php'; foreach ($item['child'] as $child) { $tpl->setCurrentBlock("link_row"); switch (ilLMObject::_lookupType($child)) { case 'pg': $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_pg')); break; case 'st': $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('obj_st')); break; } $item_list_gui->setChildId($child); $tpl->setVariable("SEPERATOR", ' -> '); $tpl->setVariable("LINK", $item_list_gui->getCommandLink('page')); $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame('page')); $tpl->setVariable("TITLE", ilLMObject::_lookupTitle($child)); $tpl->parseCurrentBlock(); } break; case 'frm': $tpl->setVariable("HITS", $this->lng->txt('search_hits')); include_once './Modules/Forum/classes/class.ilObjForum.php'; foreach ($item['child'] as $child) { $thread_post = explode('_', $child); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('thread')); $item_list_gui->setChildId($thread_post); $tpl->setVariable("SEPERATOR", ': '); $tpl->setVariable("LINK", $item_list_gui->getCommandLink('posting')); $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame('')); $tpl->setVariable("TITLE", ilObjForum::_lookupThreadSubject($thread_post[0])); $tpl->parseCurrentBlock(); } break; case 'glo': $tpl->setVariable("HITS", $this->lng->txt('search_hits')); include_once './Modules/Glossary/classes/class.ilGlossaryTerm.php'; $this->lng->loadLanguageModule('content'); foreach ($item['child'] as $child) { $tpl->setCurrentBlock("link_row"); $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('cont_term')); $tpl->setVariable("SEPERATOR", ': '); $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'git', array('target' => 'git_' . $child . '_' . $item['ref_id']))); $tpl->setVariable("TITLE", ilGlossaryTerm::_lookGlossaryTerm($child)); $tpl->parseCurrentBlock(); } break; case 'wiki': $tpl->setVariable("HITS", $this->lng->txt('search_hits')); include_once './Modules/Wiki/classes/class.ilWikiPage.php'; include_once './Modules/Wiki/classes/class.ilWikiUtil.php'; $this->lng->loadLanguageModule('wiki'); foreach ($item['child'] as $child) { $page_title = ilWikiPage::lookupTitle($child); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("CHAPTER_PAGE", $this->lng->txt('wiki_page')); $tpl->setVariable("SEPERATOR", ': '); $tpl->setVariable("LINK", ilLink::_getLink($item['ref_id'], 'wiki', array(), "_" . ilWikiUtil::makeUrlTitle($page_title))); $tpl->setVariable("TITLE", $page_title); $tpl->parseCurrentBlock(); } break; case 'mcst': $tpl->setVariable("HITS", $this->lng->txt('search_hits')); include_once "./Services/News/classes/class.ilNewsItem.php"; foreach ($item['child'] as $child) { $tpl->setCurrentBlock("link_row"); //$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('item')); $item_list_gui->setChildId($child); //$tpl->setVariable("SEPERATOR",': '); $tpl->setVariable("LINK", $item_list_gui->getCommandLink('listItems')); $tpl->setVariable("TARGET", $item_list_gui->getCommandFrame('')); $tpl->setVariable("TITLE", ilNewsItem::_lookupTitle($child)); $tpl->parseCurrentBlock(); } break; default: } return $html . $tpl->get(); }
/** * update material assignment * * @access protected * @param * @return */ protected function updateMaterialAssignment() { global $ilAccess, $ilErr, $ilObjDataCache; if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } if (!$_GET['objective_id']) { ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true); $this->ctrl->redirect($this, 'listObjectives'); } $this->__initLMObject((int) $_GET['objective_id']); $this->objectives_lm_obj->deleteAll(); if (is_array($_POST['materials'])) { foreach ($_POST['materials'] as $node_id) { $obj_id = $ilObjDataCache->lookupObjId($node_id); $type = $ilObjDataCache->lookupType($obj_id); $this->objectives_lm_obj->setLMRefId($node_id); $this->objectives_lm_obj->setLMObjId($obj_id); $this->objectives_lm_obj->setType($type); $this->objectives_lm_obj->add(); } } if (is_array($_POST['chapters'])) { foreach ($_POST['chapters'] as $chapter) { include_once './Modules/LearningModule/classes/class.ilLMObject.php'; list($ref_id, $chapter_id) = explode('_', $chapter); $this->objectives_lm_obj->setLMRefId($ref_id); $this->objectives_lm_obj->setLMObjId($chapter_id); $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id)); $this->objectives_lm_obj->add(); } } ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm')); $this->selfAssessmentAssignment(); }
/** * update material assignment * * @access protected * @param * @return */ protected function updateMaterialAssignment() { global $ilAccess, $ilErr, $ilObjDataCache; if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING); } if (!$_GET['objective_id']) { ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true); $this->ctrl->redirect($this, 'listObjectives'); } $this->__initLMObject((int) $_GET['objective_id']); $this->objectives_lm_obj->deleteAll(); if (is_array($_POST['materials'])) { foreach ($_POST['materials'] as $node_id) { $obj_id = $ilObjDataCache->lookupObjId($node_id); $type = $ilObjDataCache->lookupType($obj_id); $this->objectives_lm_obj->setLMRefId($node_id); $this->objectives_lm_obj->setLMObjId($obj_id); $this->objectives_lm_obj->setType($type); $this->objectives_lm_obj->add(); } } if (is_array($_POST['chapters'])) { foreach ($_POST['chapters'] as $chapter) { include_once './Modules/LearningModule/classes/class.ilLMObject.php'; list($ref_id, $chapter_id) = explode('_', $chapter); $this->objectives_lm_obj->setLMRefId($ref_id); $this->objectives_lm_obj->setLMObjId($chapter_id); $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id)); $this->objectives_lm_obj->add(); } } ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm')); if ($_SESSION['objective_mode'] != self::MODE_CREATE) { ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'), true); $this->ctrl->returnToParent($this); } // begin-patch lok if ($this->getSettings()->worksWithInitialTest() and !$this->getSettings()->hasSeparateInitialTests()) { $this->selfAssessmentAssignment(); } elseif (!$this->getSettings()->hasSeparateQualifiedTests()) { $this->finalTestAssignment(); } else { ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'), true); $this->ctrl->returnToParent($this); } // end-patch lok }