/** * 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(); } }