コード例 #1
0
 /**
  * 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();
     }
 }
コード例 #2
0
 /**
  * process <ilPage> content tag
  *
  * @param	object		page node
  * @param	integer		footer/header page id
  */
 function ilPage(&$a_page_node, $a_page_id = 0)
 {
     global $ilUser, $ilHelp;
     global $ilHelp;
     $ilHelp->setScreenIdComponent("lm");
     $ilHelp->setScreenId("content");
     $ilHelp->setSubScreenId("content");
     $this->fill_on_load_code = true;
     // check if page is (not) visible in public area
     if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == 'selected') {
         $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
         if (!$public) {
             return $this->showNoPublicAccess($this->getCurrentPageId());
         }
     }
     if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) {
         return $this->showPreconditionsOfPage($this->getCurrentPageId());
     }
     // if navigation is restricted based on correct answered questions
     // check if we have preceeding pages including unsanswered/incorrect answered questions
     if (!$this->offlineMode()) {
         if ($this->lm->getRestrictForwardNavigation()) {
             if ($this->getTracker()->hasPredIncorrectAnswers($this->getCurrentPageId())) {
                 $this->showNavRestrictionDueToQuestions();
                 return;
             }
         }
     }
     require_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     require_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // page id is e.g. > 0 when footer or header page is processed
     if ($a_page_id == 0) {
         $page_id = $this->getCurrentPageId();
         //echo ":".$page_id.":";
         // 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();
             // advanced search?
             if (is_array($search_string)) {
                 $search_string = $search_string["lom_content"];
             }
             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("ilLMPageContent", $w, $this->tpl);
                 }
             }
             $this->fill_on_load_code = true;
         }
     } else {
         $page_id = $a_page_id;
     }
     // 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();
     // no active page found in chapter
     if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.svg",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // current page is deactivated
     if ($this->deactivated_page) {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $m = $this->lng->txt("cont_page_currently_deactivated");
         $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType());
         if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
             $m .= "<p>" . sprintf($this->lng->txt("cont_page_activation_on"), ilDatePresentation::formatDate(new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME))) . "</p>";
         }
         $mtpl->setVariable("MESSAGE", $m);
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.svg",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // check if page is out of focus
     $focus_mess = "";
     if ($this->focus_id > 0) {
         $path = $this->lm_tree->getPathId($page_id);
         // out of focus
         if (!in_array($this->focus_id, $path)) {
             $mtpl = new ilTemplate("tpl.out_of_focus_message.html", true, true, "Modules/LearningModule");
             $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message"));
             $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
             if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
                 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
                 $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
                 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
                 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
             } else {
                 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
                 include_once "./Services/Link/classes/class.ilLink.php";
                 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
             }
             $this->ctrl->setParameter($this, "focus_id", "");
             $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
             $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
             $focus_mess = $mtpl->get();
         } else {
             $sp = $this->getSuccessorPage();
             $path2 = array();
             if ($sp > 0) {
                 $path2 = $this->lm_tree->getPathId($this->getSuccessorPage());
             }
             if ($sp == 0 || !in_array($this->focus_id, $path2)) {
                 $mtpl = new ilTemplate("tpl.out_of_focus_message.html", true, true, "Modules/LearningModule");
                 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message_last_page"));
                 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
                 if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
                     $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
                     $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
                     $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
                     $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
                 } else {
                     $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
                     include_once "./Services/Link/classes/class.ilLink.php";
                     $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
                 }
                 $this->ctrl->setParameter($this, "focus_id", "");
                 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
                 $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
                 $focus_mess = $mtpl->get();
             }
         }
     }
     // no page found
     if ($page_id == 0) {
         $cont = $this->lng->txt("cont_no_page");
         $this->tpl->setVariable("PAGE_CONTENT", $cont);
         return $cont;
     }
     $page_object_gui = $this->getLMPageGUI($page_id);
     $this->basicPageGuiInit($page_object_gui);
     $page_object = $page_object_gui->getPageObject();
     $page_object->buildDom();
     $page_object->registerOfflineHandler($this);
     $int_links = $page_object->getInternalLinks();
     $page_object_gui->setTemplateOutput(false);
     // Update personal desktop items
     $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
     // Update course items
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
     // read link targets
     $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
     $link_xml .= $this->getLinkTargetsXML();
     //echo htmlentities($link_xml);
     // get lm page object
     $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
     $lm_pg_obj->setLMId($this->lm->getId());
     //$pg_obj->setParentId($this->lm->getId());
     $page_object_gui->setLinkXML($link_xml);
     // determine target frames for internal links
     //$pg_frame = $_GET["frame"];
     $page_object_gui->setLinkFrame($_GET["frame"]);
     // page title and tracking (not for header or footer page)
     if ($page_id == 0 || $page_id != $this->lm->getHeaderPage() && $page_id != $this->lm->getFooterPage()) {
         $page_object_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang));
         // track access
         if ($ilUser->getId() != ANONYMOUS_USER_ID && $page_id != 0 && !$this->offlineMode()) {
             $this->getTracker()->trackAccess($page_id);
         }
     } else {
         $page_object_gui->setEnabledPageFocus(false);
         $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
     }
     // ADDED FOR CITATION
     $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
     $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
     $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
     // 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();
     $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
     // process header
     if ($this->lm->getHeaderPage() > 0 && $page_id != $this->lm->getHeaderPage() && ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
         if (ilLMObject::_exists($this->lm->getHeaderPage())) {
             $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
         }
     }
     // process footer
     if ($this->lm->getFooterPage() > 0 && $page_id != $this->lm->getFooterPage() && ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
         if (ilLMObject::_exists($this->lm->getFooterPage())) {
             $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
         }
     }
     // rating
     $rating = "";
     if ($this->lm->hasRatingPages()) {
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         $rating_gui = new ilRatingGUI();
         $rating_gui->setObject($this->lm->getId(), "lm", $page_id, "lm");
         $rating_gui->setYourRatingText($this->lng->txt("lm_rate_page"));
         /*			
         	$this->tpl->setVariable("VAL_RATING", $rating->getHTML(false, true, 
         		"il.ExcPeerReview.saveComments(".$a_set["peer_id"].", %rating%)"));				
         */
         $this->ctrl->setParameter($this, "pgid", $page_id);
         $this->tpl->addOnLoadCode("il.LearningModule.setRatingUrl('" . $this->ctrl->getLinkTarget($this, "updatePageRating", "", true, false) . "')");
         $this->ctrl->setParameter($this, "pgid", "");
         $rating = '<div id="ilrtrpg" style="text-align:right">' . $rating_gui->getHtml(true, true, "il.LearningModule.saveRating(%rating%);") . "</div>";
     }
     $this->tpl->setVariable("PAGE_CONTENT", $rating . $head . $focus_mess . $ret . $foot);
     //echo htmlentities("-".$ret."-");
     return $head . $focus_mess . $ret . $foot;
 }
コード例 #3
0
 /**
  * View wiki page.
  */
 function preview()
 {
     global $ilCtrl, $ilAccess, $lng, $tpl, $ilUser, $ilSetting, $ilToolbar;
     // block/unblock
     if ($this->getPageObject()->getBlocked()) {
         ilUtil::sendInfo($lng->txt("wiki_page_status_blocked"));
     }
     $this->increaseViewCount();
     $this->addHeaderAction();
     // content
     $this->setSideBlock();
     $wtpl = new ilTemplate("tpl.wiki_page_view_main_column.html", true, true, "Modules/Wiki");
     $callback = array($this, "observeNoteAction");
     // notes
     if (!$ilSetting->get("disable_comments") && ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId())) {
         $wtpl->setVariable("NOTES", $this->getNotesHTML($this->getPageObject(), true, ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), $ilAccess->checkAccess("write", "", $_GET["ref_id"]), $callback));
     }
     // permanent link
     $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($_GET["page"]) : "";
     include_once "./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php";
     $perma_link = new ilPermanentLinkGUI("wiki", $_GET["ref_id"], $append);
     $wtpl->setVariable("PERMA_LINK", $perma_link->getHTML());
     // page content
     $this->setOutputMode(IL_PAGE_PRESENTATION);
     $this->setRenderPageContainer(true);
     $wtpl->setVariable("PAGE", $this->showPage());
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     // last edited info
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $wtpl->setVariable("LAST_EDITED_INFO", $lng->txt("wiki_last_edited") . ": " . ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getLastChange(), IL_CAL_DATETIME)) . ", " . ilUserUtil::getNamePresentation($this->getPageObject()->getLastChangeUser(), false, true, $ilCtrl->getLinkTarget($this, "preview")));
     $tpl->setLoginTargetPar("wiki_" . $_GET["ref_id"] . $append);
     //highlighting
     if ($_GET["srcstring"] != "") {
         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("ilCOPageContent", $w, $tpl);
             }
         }
         $this->fill_on_load_code = true;
     }
     return $wtpl->get();
 }
コード例 #4
0
 /**
  * process <ilPage> content tag
  *
  * @param	object		page node
  * @param	integer		footer/header page id
  */
 function ilPage(&$a_page_node, $a_page_id = 0)
 {
     global $ilUser;
     if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == 'selected') {
         $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
         if (!$public) {
             return $this->showNoPublicAccess($this->getCurrentPageId());
         }
     }
     if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) {
         return $this->showPreconditionsOfPage($this->getCurrentPageId());
     }
     require_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     require_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     // page id is e.g. > 0 when footer or header page is processed
     if ($a_page_id == 0) {
         $page_id = $this->getCurrentPageId();
         //echo ":".$page_id.":";
         // 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("ilLMPageContent", $w, $this->tpl);
                 }
             }
             $this->fill_on_load_code = true;
         }
     } else {
         $page_id = $a_page_id;
     }
     // 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();
     // no active page found in chapter
     if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.png",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // current page is deactivated
     if ($this->deactivated_page) {
         $mtpl = new ilTemplate("tpl.no_content_message.html", true, true, "Modules/LearningModule");
         $m = $this->lng->txt("cont_page_currently_deactivated");
         $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType());
         if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
             $m .= "<p>" . sprintf($this->lng->txt("cont_page_activation_on"), ilDatePresentation::formatDate(new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME))) . "</p>";
         }
         $mtpl->setVariable("MESSAGE", $m);
         //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.png",
         //	false, "output", $this->offlineMode()));
         $mtpl->setVariable("ITEM_TITLE", ilLMObject::_lookupTitle($_GET["obj_id"]));
         $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
         return $mtpl->get();
     }
     // no page found
     if ($page_id == 0) {
         $cont = $this->lng->txt("cont_no_page");
         $this->tpl->setVariable("PAGE_CONTENT", $cont);
         return $cont;
     }
     $page_object_gui = $this->getLMPageGUI($page_id);
     $this->basicPageGuiInit($page_object_gui);
     $page_object = $page_object_gui->getPageObject();
     $page_object->buildDom();
     $page_object->registerOfflineHandler($this);
     $int_links = $page_object->getInternalLinks();
     $page_object_gui->setTemplateOutput(false);
     // Update personal desktop items
     $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
     // Update course items
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
     // read link targets
     $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
     $link_xml .= $this->getLinkTargetsXML();
     //echo htmlentities($link_xml);
     // get lm page object
     $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
     $lm_pg_obj->setLMId($this->lm->getId());
     //$pg_obj->setParentId($this->lm->getId());
     $page_object_gui->setLinkXML($link_xml);
     // determine target frames for internal links
     //$pg_frame = $_GET["frame"];
     $page_object_gui->setLinkFrame($_GET["frame"]);
     // page title and tracking (not for header or footer page)
     if ($page_id == 0 || $page_id != $this->lm->getHeaderPage() && $page_id != $this->lm->getFooterPage()) {
         $page_object_gui->setPresentationTitle(ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation")));
         // update learning progress
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             // #9483
             include_once "./Services/Tracking/classes/class.ilLearningProgress.php";
             ilLearningProgress::_tracProgress($ilUser->getId(), $this->lm->getId(), $this->lm->getRefId(), $this->lm->getType());
             // obsolete?
             include_once "./Services/Tracking/classes/class.ilLPStatusWrapper.php";
             ilLPStatusWrapper::_updateStatus($this->lm->getId(), $ilUser->getId());
         }
     } else {
         $page_object_gui->setEnabledPageFocus(false);
         $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
     }
     // ADDED FOR CITATION
     $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
     $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
     $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
     // 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();
     $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
     // process header
     if ($this->lm->getHeaderPage() > 0 && $page_id != $this->lm->getHeaderPage() && ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
         if (ilLMObject::_exists($this->lm->getHeaderPage())) {
             $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
         }
     }
     // process footer
     if ($this->lm->getFooterPage() > 0 && $page_id != $this->lm->getFooterPage() && ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
         if (ilLMObject::_exists($this->lm->getFooterPage())) {
             $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
         }
     }
     $this->tpl->setVariable("PAGE_CONTENT", $head . $ret . $foot);
     //echo htmlentities("-".$ret."-");
     return $head . $ret . $foot;
 }