/** * get the HTML pages of a card from the glossary * Each page is an assoc array with title and html code * The first page is assumed to be the question * * @return array ( array ("title" => string, "html" => string), ...) */ function getGlossaryTermPages() { require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; require_once "./Services/COPage/classes/class.ilPageObjectGUI.php"; $term = new ilGlossaryTerm($this->card->getTermId()); $defs = ilGlossaryDefinition::getDefinitionList($term->getId()); // get the term page $term_page = array("title" => $this->plugin->txt("glossary_term"), "html" => $term->getTerm()); // get the definition pages $i = 1; $def_pages = array(); $def_title = count($defs) > 1 ? $this->plugin->txt("glossary_definition_x") : $this->plugin->txt("glossary_definition"); foreach ($defs as $definition) { $page_gui = new ilPageObjectGUI("gdf", $definition["id"]); $page_gui->setTemplateOutput(false); $page_gui->setOutputMode(IL_PAGE_PRESENTATION); $page_gui->setEnabledTabs(false); $def_pages[] = array("title" => sprintf($def_title, $i++), "html" => $page_gui->getHTML()); } // return the pages according to the glossary mode switch ($this->object->getGlossaryMode()) { case ilObjFlashcards::GLOSSARY_MODE_TERM_DEFINITIONS: return array_merge(array($term_page), $def_pages); case ilObjFlashcards::GLOSSARY_MODE_DEFINITION_TERM: return array_merge($def_pages, array($term_page)); case ilObjFlashcards::GLOSSARY_MODE_DEFINITIONS: $def_pages[0]["title"] = $this->plugin->txt("question"); $answer_title = count($def_pages) > 2 ? $this->plugin->txt("answer_x") : $this->plugin->txt("answer"); for ($i = 1; $i < count($def_pages); $i++) { $def_pages[$i]["title"] = sprintf($answer_title, $i); } return $def_pages; } }
function _parseStructure() { /* @var $object ilObjGlossary */ $terms = $this->object->getTermlist(); foreach ($terms as $term) { /* @var $termStructureObject ilSoapGLOTermStructureObject*/ $termStructureObject = ilSoapStructureObjectFactory::getInstance($term["id"], "git", $term["term"], "", $this->getObject()->getRefId()); $this->structureObject->addStructureObject($termStructureObject); $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); foreach ($defs as $def) { $defStructureObject = ilSoapStructureObjectFactory::getInstance($def["id"], "gdf", $def["short_text"], "", $this->getObject()->getRefId()); $termStructureObject->addStructureObject($defStructureObject); } // print_r($defs); } }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $sep = ": "; for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("SEP", $sep); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT_DEF", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TEXT_DEF", $this->lng->txt("glo_definition_abbr") . ($j + 1)); $this->tpl->parseCurrentBlock(); $sep = ", "; } $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $_GET["def"]); if ($term["id"] == $_GET["term_id"]) { $this->tpl->touchBlock("hl"); } $this->tpl->setVariable("TEXT_TERM", $term["term"]); $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $_GET["term_id"]); }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilobjglossarygui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); // actions drop down if ($this->glossary->getId() == $term["glo_id"]) { $list = new ilAdvancedSelectionListGUI(); $list->addItem($lng->txt("cont_edit_term"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); if (count($defs) > 1) { $list->addItem($lng->txt("cont_edit_definitions"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listDefinitions")); } else { if (count($defs) == 1) { $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $defs[0]["id"]); $list->addItem($lng->txt("cont_edit_definition"), "", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); } } $list->addItem($lng->txt("cont_add_definition"), "", $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "addDefinition")); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", ""); $list->setId("act_term_" . $term["id"]); $list->setListTitle($lng->txt("actions")); $this->tpl->setVariable("ACTIONS", $list->getHTML()); } for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; /*if ($this->glossary->getId() == $term["glo_id"]) { // up if ($j > 0) { $this->tpl->setCurrentBlock("move_up"); $this->tpl->setVariable("TXT_UP", $lng->txt("up")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp")); $this->tpl->parseCurrentBlock(); } // down if ($j+1 < count($defs)) { $this->tpl->setCurrentBlock("move_down"); $this->tpl->setVariable("TXT_DOWN", $lng->txt("down")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown")); $this->tpl->parseCurrentBlock(); } // delete $this->tpl->setCurrentBlock("delete"); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DELETE", $ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion")); $this->tpl->setVariable("TXT_DELETE", $lng->txt("delete")); $this->tpl->parseCurrentBlock(); // edit $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->parseCurrentBlock(); }*/ // text $this->tpl->setCurrentBlock("definition"); $short_str = $def["short_text"]; // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } $short_str = ilUtil::insertLatexImages($short_str); $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("check_col"); $this->tpl->setVariable("CHECKBOX_ID", $term["id"]); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); // usage if (in_array("usage", $this->getSelectedColumns())) { $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]); if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) { $this->tpl->setCurrentBlock("link_usage"); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", ""); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("usage"); $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("td_usage"); $this->tpl->parseCurrentBlock(); } // glossary title if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) { $this->tpl->setCurrentBlock("glossary"); $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"])); $this->tpl->parseCurrentBlock(); } // output language if (in_array("language", $this->getSelectedColumns())) { $this->tpl->setCurrentBlock("td_lang"); $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"])); $this->tpl->parseCurrentBlock(); } foreach ($this->adv_cols_order as $c) { if ($c["id"] == 0) { $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TD_VAL", $term["term"]); $this->tpl->parseCurrentBlock(); } else { if (in_array("md_" . $c["id"], $this->selected_cols)) { $id = (int) $c["id"]; $val = " "; if (isset($term["md_" . $id . "_presentation"])) { $pb = $term["md_" . $id . "_presentation"]->getHTML(); if ($pb) { $val = $pb; } } $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TD_VAL", $val); $this->tpl->parseCurrentBlock(); } } } }
/** * list definitions of a term */ function listDefinitions($a_ref_id = 0, $a_term_id = 0, $a_get_html = false) { global $ilUser, $ilAccess, $ilias, $lng, $ilCtrl; if ($a_ref_id == 0) { $ref_id = (int) $_GET["ref_id"]; } else { $ref_id = $a_ref_id; } if ($a_term_id == 0) { $term_id = $this->term_id; } else { $term_id = $a_term_id; } if (!$ilAccess->checkAccess("read", "", $ref_id)) { $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE); } // tabs if ($this->glossary->getPresentationMode() != "full_def") { $this->showDefinitionTabs("content"); } $term = new ilGlossaryTerm($term_id); if (!$a_get_html) { $tpl = $this->tpl; require_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php"; $tpl->getStandardTemplate(); // $this->setTabs(); if ($this->offlineMode()) { $style_name = $ilUser->prefs["style"] . ".css"; $tpl->setVariable("LOCATION_STYLESHEET", "./" . $style_name); } else { $this->setLocator(); } // content style $tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId())); } else { $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css"); } $tpl->parseCurrentBlock(); // syntax style $tpl->setCurrentBlock("SyntaxStyle"); if (!$this->offlineMode()) { $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); } else { $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", "syntaxhighlight.css"); } $tpl->parseCurrentBlock(); $tpl->setTitleIcon(ilUtil::getImagePath("icon_term_b.png")); $tpl->setTitle($this->lng->txt("cont_term") . ": " . $term->getTerm()); // load template for table $tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", "Modules/Glossary"); } else { // content style $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content.css"); } $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); } else { $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", "syntaxhighlight.css"); } $this->tpl->parseCurrentBlock(); $tpl = new ilTemplate("tpl.glossary_definition_list.html", true, true, "Modules/Glossary"); } $defs = ilGlossaryDefinition::getDefinitionList($term_id); $tpl->setVariable("TXT_TERM", $term->getTerm()); $this->mobs = array(); for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setStyleId($this->glossary->getStyleSheetId()); $page = $page_gui->getPageObject(); // internal links $page->buildDom(); $int_links = $page->getInternalLinks(); $link_xml = $this->getLinkXML($int_links); $page_gui->setLinkXML($link_xml); if ($this->offlineMode()) { $page_gui->setOutputMode("offline"); $page_gui->setOfflineDirectory($this->getOfflineDirectory()); } $page_gui->setSourcecodeDownloadScript($this->getLink($ref_id)); $page_gui->setFullscreenLink($this->getLink($ref_id, "fullscreen", $term_id, $def["id"])); $page_gui->setTemplateOutput(false); $page_gui->setRawPageContent(true); $page_gui->setFileDownloadLink($this->getLink($ref_id, "downloadFile")); if (!$this->offlineMode()) { $output = $page_gui->preview(); } else { $output = $page_gui->presentation($page_gui->getOutputMode()); } if (count($defs) > 1) { $tpl->setCurrentBlock("definition_header"); $tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . ($j + 1)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("definition"); $tpl->setVariable("PAGE_CONTENT", $output); $tpl->parseCurrentBlock(); } // display possible backlinks $sources = ilInternalLink::_getSourcesOfTarget('git', $_GET['term_id'], 0); if ($sources) { $backlist_shown = false; foreach ($sources as $src) { $type = explode(':', $src['type']); if ($type[0] == 'lm') { if ($type[1] == 'pg') { $title = ilLMPageObject::_getPresentationTitle($src['id']); $lm_id = ilLMObject::_lookupContObjID($src['id']); $lm_title = ilObject::_lookupTitle($lm_id); $tpl->setCurrentBlock('backlink_item'); $ref_ids = ilObject::_getAllReferences($lm_id); $access = false; foreach ($ref_ids as $rid) { if ($ilAccess->checkAccess("read", "", $rid)) { $access = true; } } if ($access) { $tpl->setCurrentBlock("backlink_item"); $tpl->setVariable("BACKLINK_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . $type[1] . "_" . $src['id']); $tpl->setVariable("BACKLINK_ITEM", $lm_title . ": " . $title); $tpl->parseCurrentBlock(); $backlist_shown = true; } } } } if ($backlist_shown) { $tpl->setCurrentBlock("backlink_list"); $tpl->setVariable("BACKLINK_TITLE", $this->lng->txt('glo_term_used_in')); $tpl->parseCurrentBlock(); } } if (!$a_get_html) { $tpl->setCurrentBlock("perma_link"); $tpl->setVariable("PERMA_LINK", ILIAS_HTTP_PATH . "/goto.php?target=" . "git" . "_" . $term_id . "_" . $ref_id . "&client_id=" . CLIENT_ID); $tpl->setVariable("TXT_PERMA_LINK", $this->lng->txt("perma_link")); $tpl->setVariable("PERMA_TARGET", "_top"); $tpl->parseCurrentBlock(); } // highlighting? if ($_GET["srcstring"] != "" && !$this->offlineMode()) { include_once './Services/Search/classes/class.ilUserSearchCache.php'; $cache = ilUserSearchCache::_getInstance($ilUser->getId()); $cache->switchSearchType(ilUserSearchCache::LAST_QUERY); $search_string = $cache->getQuery(); include_once "./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php"; include_once "./Services/Search/classes/class.ilQueryParser.php"; $p = new ilQueryParser($search_string); $p->parse(); $words = $p->getQuotedWords(); if (is_array($words)) { foreach ($words as $w) { ilTextHighlighterGUI::highlight("ilGloContent", $w, $tpl); } } $this->fill_on_load_code = true; } if ($this->offlineMode() || $a_get_html) { return $tpl->get(); } }
/** * list definitions */ function listDefinitions() { global $ilTabs; $this->getTemplate(); $this->displayLocator(); $this->setTabs(); $ilTabs->activateTab("definitions"); require_once "./Services/COPage/classes/class.ilPageObjectGUI.php"; // content style $this->tpl->setCurrentBlock("ContentStyle"); $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId())); $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); // load template for table $this->tpl->addBlockfile("ADM_CONTENT", "def_list", "tpl.glossary_definition_list.html", true); //$this->tpl->addBlockfile("CONTENT", "def_list", "tpl.glossary_definition_list.html", true); //ilUtil::sendInfo(); $this->tpl->addBlockfile("STATUSLINE", "statusline", "tpl.statusline.html"); $this->tpl->setTitle($this->lng->txt("cont_term") . ": " . $this->term->getTerm()); $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_term_b.png")); $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $this->tpl->setCurrentBlock("add_def"); $this->tpl->setVariable("TXT_ADD_DEFINITION", $this->lng->txt("cont_add_definition")); $this->tpl->setVariable("BTN_ADD", "addDefinition"); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("def_list"); $defs = ilGlossaryDefinition::getDefinitionList($_GET["term_id"]); $this->tpl->setVariable("TXT_TERM", $this->term->getTerm()); for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; $page_gui = new ilPageObjectGUI("gdf", $def["id"]); $page_gui->setStyleId($this->glossary->getStyleSheetId()); $page_gui->setSourcecodeDownloadScript("ilias.php?baseClass=ilGlossaryPresentationGUI&ref_id=" . $_GET["ref_id"]); $page_gui->setTemplateOutput(false); $output = $page_gui->preview(); if (count($defs) > 1) { $this->tpl->setCurrentBlock("definition_header"); $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . ($j + 1)); $this->tpl->parseCurrentBlock(); } if ($j > 0) { $this->tpl->setCurrentBlock("up"); $this->tpl->setVariable("TXT_UP", $this->lng->txt("up")); $this->ctrl->setParameter($this, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $this->ctrl->getLinkTarget($this, "moveUp")); $this->tpl->parseCurrentBlock(); } if ($j + 1 < count($defs)) { $this->tpl->setCurrentBlock("down"); $this->tpl->setVariable("TXT_DOWN", $this->lng->txt("down")); $this->ctrl->setParameter($this, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $this->ctrl->getLinkTarget($this, "moveDown")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("submit_btns"); $this->tpl->setVariable("TXT_EDIT", $this->lng->txt("edit")); $this->ctrl->setParameter($this, "def", $def["id"]); $this->ctrl->setParameterByClass("ilTermDefinitionEditorGUI", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $this->ctrl->getLinkTargetByClass(array("ilTermDefinitionEditorGUI", "ilPageObjectGUI"), "edit")); $this->tpl->setVariable("TXT_DELETE", $this->lng->txt("delete")); $this->tpl->setVariable("LINK_DELETE", $this->ctrl->getLinkTarget($this, "confirmDefinitionDeletion")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("PAGE_CONTENT", $output); $this->tpl->parseCurrentBlock(); } //$this->tpl->setCurrentBlock("def_list"); //$this->tpl->parseCurrentBlock(); $this->quickList(); }
/** * Export HTML pages of SCO */ function exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type = "sco", $a_one_file = "", $a_sco_tpl = null) { global $tpl, $ilCtrl, $ilBench, $ilLog, $lng; include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php"; include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php"; include_once "./Services/MetaData/classes/class.ilMD.php"; $output = ""; $tree = new ilTree($this->slm_id); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); // @todo // Why is that much HTML code in an application class? // Please extract all this HTML to a tpl.<t_name>.html file and use // placeholders and the template engine to insert data. // // There copy/paste code residenting in ilSCORM2004ScoGUI. This // should be merged. // // alex, 4 Apr 09 // // if ($a_one_file == "") // { $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004"); // } // else // { // $sco_tpl = $a_sco_tpl; // } if ($mode != 'pdf' && $a_one_file == "") { include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php"; $pg_exp = new ilCOPageHTMLExport($a_target_dir); $pg_exp->getPreparedMainTemplate($sco_tpl); // init and question lang vars $lk = ilObjSAHSLearningModule::getAffectiveLocalization($this->slm_id); $sco_tpl->setCurrentBlock("init"); include_once "./Services/COPage/classes/class.ilPCQuestion.php"; $sco_tpl->setVariable("TXT_INIT_CODE", ilPCQuestion::getJSTextInitCode($lk)); $sco_tpl->parseCurrentBlock(); // (additional) style sheets needed $styles = array("./css/yahoo/container.css", "./css/question_handling.css"); foreach ($styles as $style) { $sco_tpl->setCurrentBlock("css_file"); $sco_tpl->setVariable("CSS_FILE", $style); $sco_tpl->parseCurrentBlock(); } // (additional) scripts needed $scripts = array("./js/scorm.js", "./js/pager.js", "./js/pure.js", "./js/questions_" . $this->getId() . ".js"); foreach ($scripts as $script) { $sco_tpl->setCurrentBlock("js_file"); $sco_tpl->setVariable("JS_FILE", $script); $sco_tpl->parseCurrentBlock(); } if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") { self::renderNavigation($sco_tpl, "./images/spacer.png", $lk); } $sco_tpl->touchBlock("finish"); } // render head $sco_tpl->setCurrentBlock("head"); $sco_tpl->setVariable("SCO_TITLE", $this->getTitle()); $sco_tpl->parseCurrentBlock(); $sco_tpl->touchBlock("tail"); // meta page (meta info at SCO beginning) self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode); if ($a_one_file != "") { fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>"); fputs($a_one_file, $sco_tpl->get("meta_page")); } //notify Question Exporter of new SCO require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php'; ilQuestionExporter::indicateNewSco(); // init export (this initialises glossary template) ilSCORM2004PageGUI::initExport(); $terms = array(); $terms = $this->getGlossaryTermIds(); include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php"; $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page'); $sco_q_ids = array(); foreach ($pages as $page) { //echo(print_r($page)); $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0, $this->slm_object->getId()); $page_obj->setPresentationTitle($page["title"]); $page_obj->setOutputMode(IL_PAGE_OFFLINE); $page_obj->setStyleId($this->slm_object->getStyleSheetId()); if (count($terms) > 1) { $page_obj->setGlossaryOverviewInfo(ilSCORM2004ScoGUI::getGlossaryOverviewId(), $this); } $page_output = $page_obj->showPage("export"); // collect media objects $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false); foreach ($mob_ids as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; $media_obj = new ilObjMediaObject($mob_id); if ($media_obj->hasFullscreenItem()) { $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject()); } } // collect glossary items $int_links = $page_obj->getPageObject()->getInternalLinks(true); include_once "./Services/Link/classes/class.ilInternalLink.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; if (is_array($int_links)) { foreach ($int_links as $k => $e) { // glossary link if ($e["Type"] == "GlossaryItem") { $karr = explode(":", $k); $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]); $dids = ilGlossaryDefinition::getDefinitionList($tid); foreach ($dids as $did) { include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php"; $def_pg = new ilGlossaryDefPage($did["id"]); $def_pg->buildDom(); $mob_ids = $def_pg->collectMediaObjects(false); foreach ($mob_ids as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; //echo "<br>-$mob_id-"; $media_obj = new ilObjMediaObject($mob_id); if ($media_obj->hasFullscreenItem()) { $media_obj->exportMediaFullscreen($a_target_dir, $def_pg); } } include_once "./Services/COPage/classes/class.ilPCFileList.php"; $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc()); foreach ($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } } } } } //exit; // collect all file items include_once "./Services/COPage/classes/class.ilPCFileList.php"; $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc()); foreach ($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } if ($mode == 'pdf') { include_once "./Services/COPage/classes/class.ilPCQuestion.php"; $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]); foreach ($q_ids as $q_id) { include_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php"; $q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id); $q_gui->outAdditionalOutput(); $html = $q_gui->getPreview(TRUE); $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output); } $sco_tpl->touchBlock("pdf_pg_break"); } $sco_tpl->setCurrentBlock("page"); $sco_tpl->setVariable("PAGE", $page_output); $sco_tpl->parseCurrentBlock(); // get all question ids of the sco if ($a_one_file != "") { include_once "./Services/COPage/classes/class.ilPCQuestion.php"; $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]); foreach ($q_ids as $i) { if (!in_array($i, $sco_q_ids)) { $sco_q_ids[] = $i; } } } } // glossary if ($mode != 'pdf') { $sco_tpl->setVariable("GLOSSARY_HTML", ilSCORM2004PageGUI::getGlossaryHTML($this)); } if ($a_one_file == "") { $output = $sco_tpl->get(); } else { $output = $sco_tpl->get("page"); } if ($mode == 'pdf') { $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\\/div>/i", "<h2>\$1</h2>", $output); } //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output); $output = preg_replace("/mobs\\/mm_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_\$1/\$2", $output); $output = preg_replace("/\\.\\/files\\/file_(\\d+)\\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_\$1/\$2", $output); $output = preg_replace("/\\.\\/Services\\/MediaObjects\\/flash_mp3_player/i", "./players", $output); // $output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output); $output = preg_replace("/file=..\\/..\\/..\\/.\\//i", "file=../", $output); if ($mode != 'pdf') { $output = preg_replace_callback("/href=\"&mob_id=(\\d+)&pg_id=(\\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output); // this one is for fullscreen in glossary entries $output = preg_replace_callback("/href=\"fullscreen_(\\d+)\\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output); $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output); // $output = preg_replace("/{/","",$output); // $output = preg_replace("/}/","",$output); $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js'); fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling); copy("./Modules/Scorm2004/templates/default/question_handling.css", $a_target_dir . '/css/question_handling.css'); // hack to get the question js into the file and to display the correct answers if ($a_one_file != "") { $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output; if (count($sco_q_ids) > 0) { $output .= '<script type="text/javascript">'; foreach ($sco_q_ids as $i) { if ($i > 0) { $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n"; } } $output .= '</script>'; } } foreach (ilQuestionExporter::getMobs() as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; } } $this->q_media = ilQuestionExporter::getFiles(); //questions export end if ($a_one_file != "") { fputs($a_one_file, $output); } else { fputs(fopen($a_target_dir . '/index.html', 'w+'), $output); } $this->exportFileItems($a_target_dir, $expLog); }
/** * export glossary terms */ function exportHTMLGlossaryTerms(&$a_lm_gui, $a_target_dir) { global $ilLocator; foreach ($this->offline_int_links as $int_link) { $ilLocator->clearItems(); if ($int_link["type"] == "git") { $tpl = new ilTemplate("tpl.main.html", true, true); $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html"); $_GET["obj_id"] = $int_link["id"]; $_GET["frame"] = "_blank"; $content =& $a_lm_gui->glossary(); $file = $a_target_dir . "/term_" . $int_link["id"] . ".html"; // open file if (!($fp = @fopen($file, "w+"))) { die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"); } chmod($file, 0770); fwrite($fp, $content); fclose($fp); // store linked/embedded media objects of glosssary term include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; $defs = ilGlossaryDefinition::getDefinitionList($int_link["id"]); foreach ($defs as $def) { $def_mobs = ilObjMediaObject::_getMobsOfObject("gdf:pg", $def["id"]); foreach ($def_mobs as $def_mob) { $this->offline_mobs[$def_mob] = $def_mob; } // get all files of page $def_files = ilObjFile::_getFilesOfObject("gdf:pg", $page["obj_id"]); $this->offline_files = array_merge($this->offline_files, $def_files); } } } }
/** * 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); }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getPresentationMode() == "full_def") { $this->tpl->setCurrentBlock("fd_td"); $this->tpl->setVariable("FULL_DEF", $this->parent_obj->listDefinitions($_GET["ref_id"], $term["id"], true)); $this->tpl->parseCurrentBlock(); } else { for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if (count($defs) > 1) { $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("DEF_TEXT", $lng->txt("cont_definition") . " " . ($j + 1)); $this->tpl->parseCurrentBlock(); } // check dirty short texts $this->tpl->setCurrentBlock("definition"); if ($def["short_text_dirty"]) { $def = new ilGlossaryDefinition($def["id"]); $def->updateShortText(); $short_str = $def->getShortText(); } else { $short_str = $def["short_text"]; } // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } if (!$this->offline) { $short_str = ilUtil::insertLatexImages($short_str); } else { $short_str = ilUtil::buildLatexImages($short_str, $this->parent_obj->getOfflineDirectory()); } $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } // $this->tpl->touchBlock("def_td"); // display additional column 'glossary' for meta glossaries if ($this->glossary->isVirtual()) { $this->tpl->setCurrentBlock("glossary_row"); $glo_title = ilObject::_lookupTitle($term["glo_id"]); $this->tpl->setVariable("GLO_TITLE", $glo_title); $this->tpl->parseCurrentBlock(); } } $ilCtrl->clearParameters($this->parent_obj); // advanced metadata foreach ($this->adv_cols_order as $c) { if ($c["id"] == 0) { $this->tpl->setCurrentBlock("link_start"); if (!$this->offline) { if (!empty($filter)) { $ilCtrl->setParameter($this->parent_obj, "term", $filter); $ilCtrl->setParameter($this->parent_obj, "oldoffset", $_GET["oldoffset"]); } $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "offset", $_GET["offset"]); $this->tpl->setVariable("LINK_VIEW_TERM", $ilCtrl->getLinkTarget($this->parent_obj, "listDefinitions")); $ilCtrl->clearParameters($this->parent_obj); } else { $this->tpl->setVariable("LINK_VIEW_TERM", "term_" . $term["id"] . ".html"); } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("link_end"); $this->tpl->setVariable("ANCHOR_TERM", "term_" . $term["id"]); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("td"); $this->tpl->setVariable("TEXT", $term["term"]); $this->tpl->parseCurrentBlock(); } else { $id = $c["id"]; $f = $this->adv_fields[$c["id"]]; $this->tpl->setCurrentBlock("td"); switch ($f["type"]) { case ilAdvancedMDFieldDefinition::TYPE_DATETIME: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDateTime($term["md_" . $id], IL_CAL_UNIX)) : " "; break; case ilAdvancedMDFieldDefinition::TYPE_DATE: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDate($term["md_" . $id], IL_CAL_UNIX)) : " "; break; default: $val = $term["md_" . $id] != "" ? $term["md_" . $id] : " "; break; } $this->tpl->setVariable("TEXT", $val); $this->tpl->parseCurrentBlock(); } } }
/** * Copy a term to a glossary * * @param * @return */ function _copyTerm($a_term_id, $a_glossary_id) { $old_term = new ilGlossaryTerm($a_term_id); // copy the term $new_term = new ilGlossaryTerm(); $new_term->setTerm($old_term->getTerm()); $new_term->setLanguage($old_term->getLanguage()); $new_term->setGlossaryId($a_glossary_id); $new_term->create(); // copy the definitions include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; $def_list = ilGlossaryDefinition::getDefinitionList($a_term_id); foreach ($def_list as $def) { $old_def = new ilGlossaryDefinition($def["id"]); $new_def = new ilGlossaryDefinition(); $new_def->setShortText($old_def->getShortText()); $new_def->setNr($old_def->getNr()); $new_def->setTermId($new_term->getId()); $new_def->create(); // copy meta data include_once "Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($old_term->getGlossaryId(), $old_def->getPageObject()->getId(), $old_def->getPageObject()->getParentType()); $new_md = $md->cloneMD($a_glossary_id, $new_def->getPageObject()->getId(), $old_def->getPageObject()->getParentType()); // page content $new_def->getPageObject()->setXMLContent($old_def->getPageObject()->copyXmlContent(true)); $new_def->getPageObject()->buildDom(); $new_def->getPageObject()->update(); } return $new_term->getId(); }
/** * export object to xml (see ilias_co.dtd) * * @param object $a_xml_writer ilXmlWriter object that receives the * xml data */ function exportXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) { global $ilBench; // export glossary $attrs = array(); $attrs["Type"] = "Glossary"; $a_xml_writer->xmlStartTag("ContentObject", $attrs); // MetaData $this->exportXMLMetaData($a_xml_writer); // collect media objects $terms = $this->getTermList(); $this->mob_ids = array(); $this->file_ids = array(); foreach ($terms as $term) { include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; $defs = ilGlossaryDefinition::getDefinitionList($term[id]); foreach ($defs as $def) { $this->page_object = new ilGlossaryDefPage($def["id"]); $this->page_object->buildDom(); $this->page_object->insertInstIntoIDs(IL_INST_ID); $mob_ids = $this->page_object->collectMediaObjects(false); include_once "./Services/COPage/classes/class.ilPCFileList.php"; $file_ids = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc()); foreach ($mob_ids as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; } foreach ($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } } } // export media objects $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Media Objects"); $ilBench->start("GlossaryExport", "exportMediaObjects"); $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog); $ilBench->stop("GlossaryExport", "exportMediaObjects"); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Media Objects"); // FileItems $expLog->write(date("[y-m-d H:i:s] ") . "Start Export File Items"); $ilBench->start("ContentObjectExport", "exportFileItems"); $this->exportFileItems($a_target_dir, $expLog); $ilBench->stop("ContentObjectExport", "exportFileItems"); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items"); // Glossary $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Glossary Items"); $ilBench->start("GlossaryExport", "exportGlossaryItems"); $this->exportXMLGlossaryItems($a_xml_writer, $a_inst, $expLog); $ilBench->stop("GlossaryExport", "exportGlossaryItems"); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Glossary Items"); $a_xml_writer->xmlEndTag("ContentObject"); }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if ($this->glossary->getId() == $term["glo_id"]) { // up if ($j > 0) { $this->tpl->setCurrentBlock("move_up"); $this->tpl->setVariable("TXT_UP", $lng->txt("up")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp")); $this->tpl->parseCurrentBlock(); } // down if ($j + 1 < count($defs)) { $this->tpl->setCurrentBlock("move_down"); $this->tpl->setVariable("TXT_DOWN", $lng->txt("down")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown")); $this->tpl->parseCurrentBlock(); } // delete $this->tpl->setCurrentBlock("delete"); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DELETE", $ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion")); $this->tpl->setVariable("TXT_DELETE", $lng->txt("delete")); $this->tpl->parseCurrentBlock(); // edit $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameterByClass("ilpageobjectgui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilpageobjectgui"), "edit")); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->parseCurrentBlock(); } // text $this->tpl->setCurrentBlock("definition"); $short_str = $def["short_text"]; // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page =& new ilPageObject("gdf", $def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } $short_str = ilUtil::insertLatexImages($short_str); $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("check_col"); $this->tpl->setVariable("CHECKBOX_ID", $term["id"]); $this->tpl->parseCurrentBlock(); // edit term link $this->tpl->setCurrentBlock("edit_term"); $this->tpl->setVariable("TEXT_TERM", $term["term"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getId() == $term["glo_id"]) { $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $this->tpl->setVariable("TXT_EDIT_TERM", $lng->txt("edit")); } $this->tpl->parseCurrentBlock(); // usage $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]); if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) { $this->tpl->setCurrentBlock("link_usage"); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", ""); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("usage"); $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->parseCurrentBlock(); } // glossary title if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) { $this->tpl->setCurrentBlock("glossary"); $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"])); $this->tpl->parseCurrentBlock(); } // output term and language $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"])); }
/** * quick term list */ function quickList() { global $ilUser, $tpl; return; include_once "./Modules/Glossary/classes/class.ilTermQuickListTableGUI.php"; $tab = new ilTermQuickListTableGUI($this, "listTerms"); $tpl->setLeftContent($tab->getHTML()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.glossary_short_list.html", "Modules/Glossary"); // $this->tpl->addBlockFile("EXPLORER_TOP", "exp_top", "tpl.explorer_top.html"); // $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false)); $this->tpl->setVariable("FORMACTION1", $this->ctrl->getFormAction($this)); $this->tpl->setVariable("CMD_REFR", "quickList"); $this->tpl->setVariable("TXT_REFR", $this->lng->txt("refresh")); $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_terms")); include_once "./Services/Table/classes/class.ilTableGUI.php"; // glossary term list template // load template for table $this->tpl->addBlockfile("SHORT_LIST", "list", "tpl.table.html"); // load template for table content data $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.term_short_tbl_row.html", true); $num = 0; $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); // create table $tbl = new ilTableGUI(); // title & header columns //$tbl->setTitle($this->lng->txt("cont_terms")); //$tbl->setHelp("tbl_help.php","icon_help.png",$this->lng->txt("help")); $tbl->setHeaderNames(array($this->lng->txt("cont_term"))); $cols = array("term"); $header_params = $this->ctrl->getParameterArrayByClass("ilobjglossarygui", "listTerms"); $header_params["cmd"] = "quickList"; $tbl->setHeaderVars($cols, $header_params); $tbl->setColumnWidth(array("100%")); $tbl->disable("title"); // control $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->disable("header"); $term_list = $this->object->getTermList(); $tbl->setMaxCount(count($term_list)); $this->tpl->setVariable("COLUMN_COUNT", 1); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); // sorting array $term_list = array_slice($term_list, $_GET["offset"], $_GET["limit"]); // render table $tbl->render(); if (count($term_list) > 0) { $i = 1; foreach ($term_list as $key => $term) { $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $sep = ": "; for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; // edit $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("SEP", $sep); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); $this->ctrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT_DEF", $this->ctrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TEXT_DEF", $this->lng->txt("glo_definition_abbr") . ($j + 1)); $this->tpl->parseCurrentBlock(); $sep = ", "; } $this->tpl->setCurrentBlock("tbl_content"); $css_row = ilUtil::switchColor(++$i, "tblrow1", "tblrow2"); // edit term link $this->tpl->setVariable("TEXT_TERM", $term["term"]); $this->ctrl->setParameter($this, "term_id", $term["id"]); $this->tpl->setVariable("LINK_EDIT_TERM", $this->ctrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->parseCurrentBlock(); } } else { //$this->tpl->setCurrentBlock("notfound"); $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found")); $this->tpl->setVariable("NUM_COLS", $num); //$this->tpl->parseCurrentBlock(); } }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if ($this->glossary->getId() == $term["glo_id"]) { // up if ($j > 0) { $this->tpl->setCurrentBlock("move_up"); $this->tpl->setVariable("TXT_UP", $lng->txt("up")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_UP", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp")); $this->tpl->parseCurrentBlock(); } // down if ($j + 1 < count($defs)) { $this->tpl->setCurrentBlock("move_down"); $this->tpl->setVariable("TXT_DOWN", $lng->txt("down")); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DOWN", $ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown")); $this->tpl->parseCurrentBlock(); } // delete $this->tpl->setCurrentBlock("delete"); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); $ilCtrl->setParameter($this->parent_obj, "def", $def["id"]); $this->tpl->setVariable("LINK_DELETE", $ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion")); $this->tpl->setVariable("TXT_DELETE", $lng->txt("delete")); $this->tpl->parseCurrentBlock(); // edit $this->tpl->setCurrentBlock("edit"); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]); $ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]); $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit")); $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $this->tpl->parseCurrentBlock(); } // text $this->tpl->setCurrentBlock("definition"); $short_str = $def["short_text"]; // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page = new ilGlossaryDefPage($def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } $short_str = ilUtil::insertLatexImages($short_str); $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("check_col"); $this->tpl->setVariable("CHECKBOX_ID", $term["id"]); $this->tpl->parseCurrentBlock(); // edit term link $this->tpl->setCurrentBlock("edit_term"); $this->tpl->setVariable("TEXT_TERM", $term["term"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getId() == $term["glo_id"]) { $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm")); $this->tpl->setVariable("TXT_EDIT_TERM", $lng->txt("edit")); } $this->tpl->parseCurrentBlock(); // usage if (in_array("usage", $this->getSelectedColumns())) { $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]); if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) { $this->tpl->setCurrentBlock("link_usage"); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]); $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages")); $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", ""); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("usage"); $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"])); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("td_usage"); $this->tpl->parseCurrentBlock(); } // glossary title if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) { $this->tpl->setCurrentBlock("glossary"); $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"])); $this->tpl->parseCurrentBlock(); } // output language if (in_array("language", $this->getSelectedColumns())) { $this->tpl->setCurrentBlock("td_lang"); $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"])); $this->tpl->parseCurrentBlock(); } // adv metadata foreach ($this->getSelectedColumns() as $c) { if (substr($c, 0, 3) == "md_") { $id = (int) substr($c, 3); $this->tpl->setCurrentBlock("td_md"); switch ($this->adv_fields[$id]["type"]) { case ilAdvancedMDFieldDefinition::TYPE_DATETIME: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDateTime($term["md_" . $id], IL_CAL_UNIX)) : " "; break; case ilAdvancedMDFieldDefinition::TYPE_DATE: $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDate($term["md_" . $id], IL_CAL_UNIX)) : " "; break; default: $val = $term["md_" . $id] != "" ? $term["md_" . $id] : " "; breal; } $this->tpl->setVariable("MD_VAL", $val); $this->tpl->parseCurrentBlock(); } } }
/** * Fill table row */ protected function fillRow($term) { global $lng, $ilCtrl; $defs = ilGlossaryDefinition::getDefinitionList($term["id"]); $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]); if ($this->glossary->getPresentationMode() == "full_def") { $this->tpl->setVariable("FULL_DEF", $this->parent_obj->listDefinitions($_GET["ref_id"], $term["id"], true)); } else { for ($j = 0; $j < count($defs); $j++) { $def = $defs[$j]; if (count($defs) > 1) { $this->tpl->setCurrentBlock("definition"); $this->tpl->setVariable("DEF_TEXT", $lng->txt("cont_definition") . " " . ($j + 1)); $this->tpl->parseCurrentBlock(); } // check dirty short texts $this->tpl->setCurrentBlock("definition"); if ($def["short_text_dirty"]) { $def = new ilGlossaryDefinition($def["id"]); $def->updateShortText(); $short_str = $def->getShortText(); } else { $short_str = $def["short_text"]; } // replace tex // if a tex end tag is missing a tex end tag $ltexs = strrpos($short_str, "[tex]"); $ltexe = strrpos($short_str, "[/tex]"); if ($ltexs > $ltexe) { $page =& new ilPageObject("gdf", $def["id"]); $page->buildDom(); $short_str = $page->getFirstParagraphText(); $short_str = strip_tags($short_str, "<br>"); $ltexe = strpos($short_str, "[/tex]", $ltexs); $short_str = ilUtil::shortenText($short_str, $ltexe + 6, true); } if (!$this->offline) { $short_str = ilUtil::insertLatexImages($short_str); } else { $short_str = ilUtil::buildLatexImages($short_str, $this->parent_obj->getOfflineDirectory()); } $short_str = ilPCParagraph::xml2output($short_str); $this->tpl->setVariable("DEF_SHORT", $short_str); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("definition_row"); $this->tpl->parseCurrentBlock(); } // $this->tpl->touchBlock("def_td"); // display additional column 'glossary' for meta glossaries if ($this->glossary->isVirtual()) { $this->tpl->setCurrentBlock("glossary_row"); $glo_title = ilObject::_lookupTitle($term["glo_id"]); $this->tpl->setVariable("GLO_TITLE", $glo_title); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("view_term"); $this->tpl->setVariable("TEXT_TERM", $term["term"]); if (!$this->offline) { if (!empty($filter)) { $ilCtrl->setParameter($this, "term", $filter); $ilCtrl->setParameter($this, "oldoffset", $_GET["oldoffset"]); } $ilCtrl->setParameter($this, "term_id", $term["id"]); $ilCtrl->setParameter($this, "offset", $_GET["offset"]); $this->tpl->setVariable("LINK_VIEW_TERM", $ilCtrl->getLinkTarget($this->parent_obj, "listDefinitions")); $ilCtrl->clearParameters($this); } else { $this->tpl->setVariable("LINK_VIEW_TERM", "term_" . $term["id"] . ".html"); } $this->tpl->setVariable("ANCHOR_TERM", "term_" . $term["id"]); $this->tpl->parseCurrentBlock(); } $ilCtrl->clearParameters($this->parent_obj); }