/**
  * display locator
  */
 function display($a_gui_class)
 {
     global $lng;
     $this->tpl->addBlockFile($this->temp_var, "locator", "tpl.locator.html", "Services/Locator");
     if ($this->obj_id != 0 && $this->tree->isInTree($this->obj_id)) {
         $path = $this->tree->getPathFull($this->obj_id);
     } else {
         $path = $this->tree->getPathFull($this->tree->getRootId());
         if ($this->obj_id != 0) {
             $path[] = array("type" => "pg", "child" => $this->obj_id, "title" => ilLMPageObject::_getPresentationTitle($this->obj_id));
         }
     }
     $modifier = 1;
     foreach ($path as $key => $row) {
         if ($key < count($path) - $modifier) {
             $this->tpl->touchBlock("locator_separator");
         }
         $this->tpl->setCurrentBlock("locator_item");
         $transit = "";
         if ($row["child"] == 1) {
             $title = $this->cont_obj->getTitle();
             $cmd = "properties";
             $cmdClass = $a_gui_class;
         } else {
             $title = $row["title"];
             switch ($row["type"]) {
                 case "st":
                     $cmdClass = "ilStructureObjectGUI";
                     $cmd = "view";
                     if ($this->ctrl->getCmdClass() != "ilstructureobjectgui") {
                         $transit = array($a_gui_class);
                     }
                     break;
                 case "pg":
                     $cmdClass = "ilLMPageObjectGUI";
                     $cmd = "view";
                     if ($this->ctrl->getCmdClass() != "illmpageobjectgui") {
                         $transit = array($a_gui_class);
                     }
                     break;
             }
         }
         $this->tpl->setVariable("ITEM", $title);
         $obj_str = $row["child"] == 1 ? "" : "&obj_id=" . $row["child"];
         $this->ctrl->setParameterByClass($cmdClass, "obj_id", $row["child"]);
         $link = $this->ctrl->getLinkTargetByClass($cmdClass, $cmd, $transit);
         $this->ctrl->setParameterByClass($cmdClass, "obj_id", $_GET["obj_id"]);
         $this->tpl->setVariable("LINK_ITEM", $link);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("locator");
     $this->tpl->parseCurrentBlock();
 }
 /**
  * standard implementation for title, maybe overwritten by derived classes
  */
 function buildTitle($a_title, $a_id, $a_type)
 {
     if ($a_type == "st") {
         return ilStructureObject::_getPresentationTitle($a_id, $this->lm_obj->isActiveNumbering(), false, $this->lm_obj->getId(), $this->lang);
     }
     if ($this->lm_obj->getTOCMode() == "chapters" || $a_type != "pg") {
         return $a_title;
     } else {
         if ($a_type == "pg") {
             return ilLMPageObject::_getPresentationTitle($a_id, $this->lm_obj->getPageHeader(), $this->lm_obj->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm_obj->getId(), $this->lang);
         }
     }
 }
Пример #3
0
 /**
  * Get affective title
  *
  * @param
  * @return
  */
 static function _getPresentationTitle($a_node, $a_mode = IL_PAGE_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false, $a_lm_id = 0, $a_lang = "-")
 {
     if ($a_lang == "") {
         $a_lang = "-";
     }
     if ($a_node["type"] == "st") {
         return ilStructureObject::_getPresentationTitle($a_node["child"], $a_include_numbers, $a_time_scheduled_activation, $a_lm_id, $a_lang);
     } else {
         return ilLMPageObject::_getPresentationTitle($a_node["child"], $a_mode, $a_include_numbers, $a_time_scheduled_activation, $a_force_content, $a_lm_id, $a_lang);
     }
 }
 /**
  * 
  * @see		ilLinkCheckerGUIRowHandling::formatInvalidLinkArray()
  * @param	array Unformatted array
  * @return	array Formatted array
  * @access	public
  * 
  */
 public function formatInvalidLinkArray(array $row)
 {
     $row['title'] = ilLMPageObject::_getPresentationTitle($row['page_id'], $this->object->getPageHeader());
     require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
     $actions = new ilAdvancedSelectionListGUI();
     $actions->setSelectionHeaderClass('small');
     $actions->setItemLinkClass('xsmall');
     $actions->setListTitle($this->lng->txt('actions'));
     $actions->setId($row['page_id']);
     $this->ctrl->setParameterByClass('ilLMPageObjectGUI', 'obj_id', $row['page_id']);
     $actions->addItem($this->lng->txt('edit'), '', $this->ctrl->getLinkTargetByClass('ilLMPageObjectGUI', 'edit'));
     $this->ctrl->clearParametersByClass('ilLMPageObjectGUI');
     $row['action_html'] = $actions->getHTML();
     return $row;
 }
 /**
  * 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();
     }
 }
Пример #6
0
 /**
  * export page object to fo
  *
  * @param	object		$a_xml_writer	ilXmlWriter object that receives the
  *										xml data
  */
 function exportFO(&$a_xml_writer)
 {
     global $ilBench;
     //$attrs = array();
     //$a_xml_writer->xmlStartTag("PageObject", $attrs);
     $title = ilLMPageObject::_getPresentationTitle($this->getId());
     if ($title != "") {
         $attrs = array();
         $attrs["font-family"] = "Times";
         $attrs["font-size"] = "14pt";
         $a_xml_writer->xmlElement("fo:block", $attrs, $title);
     }
     // PageContent
     $this->page_object->buildDom();
     $fo = $this->page_object->getFO();
     $a_xml_writer->appendXML($fo);
     //$a_xml_writer->xmlEndTag("PageObject");
 }
Пример #7
0
 /**
  * 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);
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $tpl, $ilCtrl, $ilTabs, $ilSetting;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     //echo "<br>:cmd:".$this->ctrl->getCmd().":cmdClass:".$this->ctrl->getCmdClass().":".
     //	":nextClass:".$next_class.":"; flush();
     switch ($next_class) {
         case "illmpagegui":
             // Determine whether the view of a learning resource should
             // be shown in the frameset of ilias, or in a separate window.
             //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
             $showViewInFrameset = true;
             $lm_set = new ilSetting("lm");
             $this->ctrl->setReturn($this, "edit");
             if (!ilPageObject::_exists("lm", $this->obj->getId(), $_GET["transl"]) && ilPageObject::_exists("lm", $this->obj->getId(), "-")) {
                 if ($_GET["totransl"] == "") {
                     $_GET["totransl"] = $_GET["transl"];
                     $ilCtrl->setCmd("switchToLanguage");
                 }
                 $ilCtrl->setCmdClass("illmpagegui");
                 $page_gui = new ilLMPageGUI($this->obj->getId(), 0, false, "-");
             } else {
                 $page_gui = new ilLMPageGUI($this->obj->getId());
             }
             $page_gui->setEditPreview(true);
             $page_gui->activateMetaDataEditor($this->content_object->getID(), $this->obj->getId(), $this->obj->getType(), $this->obj, "MDUpdateListener");
             if ($ilSetting->get("block_activated_news")) {
                 $page_gui->setEnabledNews(true, $this->obj->content_object->getId(), $this->obj->content_object->getType());
             }
             // set page view link
             if ($showViewInFrameset) {
                 $view_frame = ilFrameTargetInfo::_getFrame("MainContent");
             } else {
                 $view_frame = "ilContObj" . $this->content_object->getID();
             }
             $page_gui->setViewPageLink(ILIAS_HTTP_PATH . "/goto.php?target=pg_" . $this->obj->getId() . "_" . $_GET["ref_id"], $view_frame);
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->content_object->getStyleSheetId(), "lm"));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->getPageObject()->buildDom();
             $int_links = $page_gui->getPageObject()->getInternalLinks();
             $link_xml = $this->getLinkXML($int_links);
             $page_gui->setLinkXML($link_xml);
             $page_gui->enableChangeComments($this->content_object->isActiveHistoryUserComments());
             $page_gui->setFileDownloadLink("ilias.php?cmd=downloadFile&ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setFullscreenLink("ilias.php?cmd=fullscreen&ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setLinkParams("ref_id=" . $this->content_object->getRefId());
             $page_gui->setSourcecodeDownloadScript("ilias.php?ref_id=" . $_GET["ref_id"] . "&baseClass=ilLMPresentationGUI");
             $page_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($this->obj->getId(), $this->content_object->getPageHeader(), $this->content_object->isActiveNumbering()));
             $page_gui->setLocator($contObjLocator);
             $page_gui->setHeader($this->lng->txt("page") . ": " . $this->obj->getTitle());
             $page_gui->setActivationListener($this, "activatePage");
             $up_gui = $this->content_object->getType() == "dbk" ? "ilobjdlbookgui" : "ilobjlearningmodulegui";
             $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
             $page_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
             $tpl->setTitleIcon(ilUtil::getImagePath("icon_pg_b.png"));
             $tpl->setTitle($this->lng->txt("page") . ": " . $this->obj->getTitle());
             if ($this->content_object->getLayoutPerPage()) {
                 $page_gui->setTabHook($this, "addPageTabs");
             }
             $ret = $this->ctrl->forwardCommand($page_gui);
             $tpl->setContent($ret);
             break;
         default:
             $ret =& $this->{$cmd}();
             break;
     }
 }
Пример #9
0
 /**
  * Get node content
  *
  * @param array $a_node node array
  * @return string node content
  */
 function getNodeContent($a_node)
 {
     if ($a_node["type"] == "st") {
         return ilStructureObject::_getPresentationTitle($a_node["child"], $this->lm->isActiveNumbering(), false, $this->lm->getId(), $this->lang);
     } else {
         if ($a_node["type"] == "pg") {
             return ilLMPageObject::_getPresentationTitle($a_node["child"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm->getId(), $this->lang);
         } else {
             if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
                 return $this->lm->getTitle();
             }
         }
     }
     if ($a_node["type"] == "pg") {
         return ilLMPageObject::_getPresentationTitle($a_node["child"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm->getId(), $this->lang);
     }
     return $a_node["title"];
 }
 /**
  * standard implementation for title, maybe overwritten by derived classes
  */
 function buildTitle($a_title, $a_id, $a_type)
 {
     global $lng;
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     $access_str = "";
     if (!ilObjContentObject::_checkPreconditionsOfPage($_GET['ref_id'], ilObject::_lookupObjId($_GET["ref_id"]), $a_id)) {
         $access_str = " (" . $lng->txt("cont_no_access") . ")";
     }
     if ($a_type == "st") {
         return ilStructureObject::_getPresentationTitle($a_id, $this->lm_obj->isActiveNumbering()) . $access_str;
     }
     if ($this->lm_obj->getTOCMode() == "chapters" || $a_type != "pg") {
         return $a_title . $access_str;
     } else {
         if ($a_type == "pg") {
             return ilLMPageObject::_getPresentationTitle($a_id, $this->lm_obj->getPageHeader(), $this->lm_obj->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation")) . $access_str;
         }
     }
 }