ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLMPresentationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
5require_once("./Services/MainMenu/classes/class.ilMainMenuGUI.php");
6require_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
7
24{
28 protected $user;
29
33 protected $rbacsystem;
34
38 protected $ctrl;
39
43 protected $error;
44
48 protected $nav_history;
49
53 protected $access;
54
58 protected $settings;
59
63 protected $main_menu;
64
68 protected $locator;
69
73 protected $tree;
74
78 protected $help;
79
80 public $lm;
81 public $tpl;
82 public $lng;
84 public $offline;
86 protected $current_page_id = false;
87 protected $focus_id = 0; // focus id is set e.g. from learning objectives course, we focus on a chapter/page
88 protected $export_all_languages = false;
89
90 public function __construct()
91 {
92 global $DIC;
93
94 $this->user = $DIC->user();
95 $this->rbacsystem = $DIC->rbac()->system();
96 $this->error = $DIC["ilErr"];
97 $this->nav_history = $DIC["ilNavigationHistory"];
98 $this->access = $DIC->access();
99 $this->settings = $DIC->settings();
100 $this->locator = $DIC["ilLocator"];
101 $this->tree = $DIC->repositoryTree();
102 $this->help = $DIC["ilHelp"];
103 $ilUser = $DIC->user();
104 $lng = $DIC->language();
105 $tpl = $DIC["tpl"];
106 $rbacsystem = $DIC->rbac()->system();
107 $ilCtrl = $DIC->ctrl();
108 $ilErr = $DIC["ilErr"];
109
110 // load language vars
111 $lng->loadLanguageModule("content");
112
113 $this->lng = $lng;
114 $this->tpl = $tpl;
115 $this->offline = false;
116 $this->frames = array();
117 $this->ctrl = $ilCtrl;
118 $this->ctrl->saveParameter($this, array("ref_id", "transl", "focus_id", "focus_return"));
119 $this->lm_set = new ilSetting("lm");
120
121 include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php");
122 $this->lm_gui = new ilObjLearningModuleGUI($data, $_GET["ref_id"], true, false);
123 $this->lm = $this->lm_gui->object;
124
125 // language translation
126 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
127 $this->ot = ilObjectTranslation::getInstance($this->lm->getId());
128 //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
129 //$this->ml = new ilPageMultiLang("lm", $this->lm->getId());
130 $this->lang = "-";
131 if ($this->ot->getContentActivated()) {
132 $langs = $this->ot->getLanguages();
133 if (isset($langs[$_GET["transl"]]) || $_GET["transl"] == $this->ot->getMasterLanguage()) {
134 $this->lang = $_GET["transl"];
135 } elseif (isset($langs[$ilUser->getCurrentLanguage()])) {
136 $this->lang = $ilUser->getCurrentLanguage();
137 }
138 if ($this->lang == $this->ot->getMasterLanguage()) {
139 $this->lang = "-";
140 }
141 }
142
143 // check, if learning module is online
144 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
145 if (!$this->lm->getOnline()) {
146 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
147 }
148 }
149
150 include_once("./Modules/LearningModule/classes/class.ilLMTree.php");
151 $this->lm_tree = ilLMTree::getInstance($this->lm->getId());
152
153 /*$this->lm_tree = new ilTree($this->lm->getId());
154 $this->lm_tree->setTableNames('lm_tree','lm_data');
155 $this->lm_tree->setTreeTablePK("lm_id");*/
156
157 if ((int) $_GET["focus_id"] > 0 && $this->lm_tree->isInTree((int) $_GET["focus_id"])) {
158 $this->focus_id = (int) $_GET["focus_id"];
159 }
160 }
161
162
166 public function executeCommand()
167 {
168 $ilNavigationHistory = $this->nav_history;
169 $ilAccess = $this->access;
173
174 // check read permission and parent conditions
175 // todo: replace all this by ilAccess call
176 if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) &&
177 (!(($this->ctrl->getCmd() == "infoScreen" || $this->ctrl->getNextClass() == "ilinfoscreengui")
178 && $ilAccess->checkAccess("visible", "", $_GET["ref_id"])))) {
179 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
180 }
181
182 $next_class = $this->ctrl->getNextClass($this);
183 $cmd = $this->ctrl->getCmd("layout", array("showPrintView"));
184
185 $cmd = (isset($_POST['cmd']['citation']))
186 ? "ilCitation"
187 : $cmd;
188
189 $obj_id = $_GET["obj_id"];
190 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
191 $ilNavigationHistory->addItem($_GET["ref_id"], $this->ctrl->getLinkTarget($this), "lm");
192 $this->ctrl->setParameter($this, "obj_id", $obj_id);
193
194 switch ($next_class) {
195 case "ilnotegui":
196 $ret = $this->layout();
197 break;
198
199 case "ilinfoscreengui":
200 $ret = $this->outputInfoScreen();
201 break;
202
203 case "ilcommonactiondispatchergui":
204 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
206 $gui->enableCommentsSettings(false);
207 $this->ctrl->forwardCommand($gui);
208 break;
209
210 case "illmpagegui":
211 include_once("./Modules/LearningModule/classes/class.ilLMPageGUI.php");
212 $page_gui = $this->getLMPageGUI($_GET["obj_id"]);
213 $this->basicPageGuiInit($page_gui);
214 $ret = $ilCtrl->forwardCommand($page_gui);
215 break;
216
217 case "ilglossarydefpagegui":
218 include_once("./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php");
219 $page_gui = new ilGlossaryDefPageGUI($_GET["obj_id"]);
220 $this->basicPageGuiInit($page_gui);
221 $ret = $ilCtrl->forwardCommand($page_gui);
222 break;
223
224 case "illearningprogressgui":
225 $this->initScreenHead("learning_progress");
226 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
228 $this->ctrl->forwardCommand($new_gui);
229 break;
230
231 case "ilratinggui":
232 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
233 $rating_gui = new ilRatingGUI();
234 $rating_gui->setObject($this->lm->getId(), "lm", $_GET["obj_id"], "lm");
235 $this->ctrl->forwardCommand($rating_gui);
236 break;
237
238 default:
239 $ret = $this->$cmd();
240 break;
241 }
242 }
243
244
248 public function setOfflineMode($a_offline = true, $a_all_languages = false)
249 {
250 $this->offline = $a_offline;
251 $this->export_all_languages = $a_all_languages;
252 }
253
254
258 public function offlineMode()
259 {
260 return $this->offline;
261 }
262
268 public function setExportFormat($a_format)
269 {
270 $this->export_format = $a_format;
271 }
272
278 public function getExportFormat()
279 {
280 return $this->export_format;
281 }
282
286 public function nop()
287 {
288 }
289
298 public function export()
299 {
300 }
301
307 public function getTracker()
308 {
309 include_once("./Modules/LearningModule/classes/class.ilLMTracker.php");
310 $tracker = ilLMTracker::getInstance($this->lm->getRefId());
311 $tracker->setCurrentPage($this->getCurrentPageId());
312 return $tracker;
313 }
314
315 public function attrib2arr($a_attributes)
316 {
317 $attr = array();
318 if (!is_array($a_attributes)) {
319 return $attr;
320 }
321 foreach ($a_attributes as $attribute) {
322 $attr[$attribute->name()] = $attribute->value();
323 }
324 return $attr;
325 }
326
330 public function getCurrentFrameSet()
331 {
332 return $this->frames;
333 }
334
338 public function determineLayout()
339 {
340 if ($this->getExportFormat() == "scorm") {
341 $layout = "1window";
342 } else {
343 $layout = $this->lm->getLayout();
344 if ($this->lm->getLayoutPerPage()) {
345 $pg_id = $this->getCurrentPageId();
346 if (!in_array($_GET["frame"], array("", "_blank")) && $_GET["from_page"] > 0) {
347 $pg_id = (int) $_GET["from_page"];
348 }
349
350 // this is needed, e.g. lm is toc2win, page is 3window and media linked to media frame
351 if (in_array($_GET["cmd"], array("media", "glossary")) && $_GET["back_pg"] > 0) {
352 $pg_id = (int) $_GET["back_pg"];
353 }
354
355 if ($pg_id > 0) {
356 $lay = ilLMObject::lookupLayout($pg_id);
357 if ($lay != "") {
358 $layout = $lay;
359 }
360 }
361 }
362 }
363
364 return $layout;
365 }
366
367 public function resume()
368 {
370
371 if ($ilUser->getId() != ANONYMOUS_USER_ID && $_GET["focus_id"] == "") {
372 include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php");
373 $last_accessed_page = ilObjLearningModuleAccess::_getLastAccessedPage((int) $_GET["ref_id"], $ilUser->getId());
374
375 // if last accessed page was final page do nothing, start over
376 if ($last_accessed_page &&
377 $last_accessed_page != $this->lm_tree->getLastActivePage()) {
378 $_GET["obj_id"] = $last_accessed_page;
379 }
380 }
381
382 $this->layout();
383 }
384
388 public function layout($a_xml = "main.xml", $doShow = true)
389 {
390 global $DIC;
391
396
397 $layout = $this->determineLayout();
398
399 // xmldocfile is deprecated! Use domxml_open_file instead.
400 // But since using relative pathes with domxml under windows don't work,
401 // we need another solution:
402 $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/" . $layout . "/" . $a_xml);
403
404 if (!$doc = domxml_open_mem($xmlfile)) {
405 include_once("./Modules/LearningModule/exceptions/class.ilLMPresentationException.php");
406 throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Error reading " .
407 $layout . "/" . $a_xml . ".");
408 }
409 $this->layout_doc = $doc;
410 //echo ":".htmlentities($xmlfile).":$layout:$a_xml:";
411
412 // get current frame node
413 $xpc = xpath_new_context($doc);
414 $path = (empty($_GET["frame"]) || ($_GET["frame"] == "_blank"))
415 ? "/ilLayout/ilFrame[1]"
416 : "//ilFrame[@name='" . $_GET["frame"] . "']";
417 $result = xpath_eval($xpc, $path);
418 $found = $result->nodeset;
419 if (count($found) != 1) {
420 include_once("./Modules/LearningModule/exceptions/class.ilLMPresentationException.php");
421 throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Found " . count($found) . " nodes for " .
422 " path " . $path . " in " . $layout . "/" . $a_xml . ". LM Layout is " . $this->lm->getLayout());
423 }
424 $node = $found[0];
425
426 // ProcessFrameset
427 // node is frameset, if it has cols or rows attribute
428 $attributes = $this->attrib2arr($node->attributes());
429
430 $this->frames = array();
431 if ((!empty($attributes["rows"])) || (!empty($attributes["cols"]))) {
432 $content .= $this->buildTag("start", "frameset", $attributes);
433 //$this->frames = array();
434 $this->processNodes($content, $node);
435 $content .= $this->buildTag("end", "frameset");
436 $this->tpl = new ilTemplate("tpl.frameset.html", true, true, "Modules/LearningModule");
437 $this->renderPageTitle();
438 $this->tpl->setVariable("FS_CONTENT", $content);
439 if (!$doshow) {
440 $content = $this->tpl->get();
441 }
442 } else { // node is frame -> process the content tags
443 // ProcessContentTag
444 //if ((empty($attributes["template"]) || !empty($_GET["obj_type"])))
445 if ((empty($attributes["template"]) || !empty($_GET["obj_type"]))
446 && ($_GET["frame"] != "_blank" || $_GET["obj_type"] != "MediaObject")) {
447 // we got a variable content frame (can display different
448 // object types (PageObject, MediaObject, GlossarItem)
449 // and contains elements for them)
450
451 // determine object type
452 if (empty($_GET["obj_type"])) {
453 $obj_type = "PageObject";
454 } else {
455 $obj_type = $_GET["obj_type"];
456 }
457
458 // get object specific node
459 $childs = $node->child_nodes();
460 $found = false;
461 foreach ($childs as $child) {
462 if ($child->node_name() == $obj_type) {
463 $found = true;
464 $attributes = $this->attrib2arr($child->attributes());
465 $node = $child;
466 //echo "<br>2node:".$node->node_name();
467 break;
468 }
469 }
470 if (!$found) {
471 include_once("./Modules/LearningModule/exceptions/class.ilLMPresentationException.php");
472 throw new ilLMPresentationException("ilLMPresentation: No template specified for frame '" .
473 $_GET["frame"] . "' and object type '" . $obj_type . "'.");
474 }
475 }
476
477 // get template
478 $in_module = ($attributes["template_location"] == "module")
479 ? true
480 : false;
481 if ($in_module) {
482 $this->tpl = new ilTemplate($attributes["template"], true, true, $in_module);
483 $this->tpl->setBodyClass("");
484 } else {
485 $this->tpl = $tpl;
486 }
487
488 // set style sheets
489 if (!$this->offlineMode()) {
490 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
491 } else {
492 $style_name = $ilUser->getPref("style") . ".css";
493 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
494 }
495
496 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
497
498 iljQueryUtil::initjQuery($this->tpl);
499 iljQueryUtil::initjQueryUI($this->tpl);
500
501 include_once("./Services/UICore/classes/class.ilUIFramework.php");
502 ilUIFramework::init($this->tpl);
503
504 // to make e.g. advanced seletions lists work:
505 $GLOBALS["tpl"] = $this->tpl;
506
507 $childs = $node->child_nodes();
508
509 foreach ($childs as $child) {
510 $child_attr = $this->attrib2arr($child->attributes());
511
512 switch ($child->node_name()) {
513 case "ilMainMenu":
514 $this->ilMainMenu();
515 //$this->renderPageTitle();
516 break;
517
518 case "ilTOC":
519 $this->ilTOC($child_attr["target_frame"]);
520 break;
521
522 case "ilPage":
523 $this->renderPageTitle();
524 switch ($this->lm->getType()) {
525 case "lm":
526 unset($_SESSION["tr_id"]);
527 unset($_SESSION["bib_id"]);
528 unset($_SESSION["citation"]);
529 $content = $this->ilPage($child);
530 break;
531 }
532 break;
533
534 case "ilGlossary":
535 $content = $this->ilGlossary($child);
536 break;
537
538 case "ilLMNavigation":
539 $this->ilLMNavigation();
540 break;
541
542 case "ilMedia":
543 $this->ilMedia();
544 break;
545
546 case "ilLocator":
547 $this->ilLocator();
548 break;
549
550 case "ilJavaScript":
551 $this->ilJavaScript(
552 $child_attr["inline"],
553 $child_attr["file"],
554 $child_attr["location"]
555 );
556 break;
557
558 case "ilLMMenu":
559 $this->ilLMMenu();
560 break;
561
562 case "ilLMHead":
563 $this->ilLMHead();
564 break;
565
566 case "ilLMSubMenu":
567 $this->ilLMSubMenu();
568 break;
569
570 case "ilLMNotes":
571 $this->ilLMNotes();
572 break;
573 }
574 }
575
576 // TODO: Very dirty hack to force the import of JavaScripts in learning content in the FAQ frame (e.g. if jsMath is in the content)
577 // Unfortunately there is no standardized way to do this somewhere else. Calling fillJavaScripts always in ilTemplate causes multiple additions of the the js files.
578 // 19.7.2014: outcommented, since fillJavaScriptFiles is called in the next blocks, and the
579 // following lines would add the js files two times
580 // if (strcmp($_GET["frame"], "topright") == 0) $this->tpl->fillJavaScriptFiles();
581 // if (strcmp($_GET["frame"], "right") == 0) $this->tpl->fillJavaScriptFiles();
582 // if (strcmp($_GET["frame"], "botright") == 0) $this->tpl->fillJavaScriptFiles();
583
584 if (!$this->offlineMode()) {
585 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
588
589
590 $this->tpl->addJavascript("./Modules/LearningModule/js/LearningModule.js");
591 include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
592 $close_call = "il.LearningModule.setCloseHTML('" . ilGlyphGUI::get(ilGlyphGUI::CLOSE) . "');";
593 $this->tpl->addOnLoadCode($close_call);
594
595 //$store->set("cf_".$this->lm->getId());
596
597 // handle initial content
598 if ($_GET["frame"] == "") {
599 include_once("./Services/Authentication/classes/class.ilSessionIStorage.php");
600 $store = new ilSessionIStorage("lm");
601 $last_frame_url = $store->get("cf_" . $this->lm->getId());
602 if ($last_frame_url != "") {
603 $this->tpl->addOnLoadCode("il.LearningModule.setLastFrameUrl('" . $last_frame_url . "', 'center_bottom');");
604 }
605
606 if (in_array($layout, array("toc2windyn"))) {
607 $this->tpl->addOnLoadCode("il.LearningModule.setSaveUrl('" .
608 $ilCtrl->getLinkTarget($this, "saveFrameUrl", "", false, false) . "');
609 il.LearningModule.openInitFrames();
610 ");
611 }
612 $this->tpl->addOnLoadCode("il.LearningModule.setTocRefreshUrl('" .
613 $ilCtrl->getLinkTarget($this, "refreshToc", "", false, false) . "');
614 ");
615 }
616
617 // from main menu
618 // $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
619 $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js");
620 ilYuiUtil::initConnection($this->tpl);
621 $this->tpl->fillJavaScriptFiles();
622 $this->tpl->fillScreenReaderFocus();
623
624 $this->tpl->fillCssFiles();
625 } else {
626 // reset standard css files
627 $this->tpl->resetJavascript();
628 $this->tpl->resetCss();
629 $this->tpl->setBodyClass("ilLMNoMenu");
630
631 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
633 if ($f["type"] == "js") {
634 $this->tpl->addJavascript($f["target"]);
635 }
636 if ($f["type"] == "css") {
637 $this->tpl->addCSS($f["target"]);
638 }
639 }
640 $this->tpl->fillJavaScriptFiles(true);
641 $this->tpl->fillCssFiles(true);
642 }
643
644
645 $this->tpl->fillBodyClass();
646 }
647
648 if ($doShow) {
649 // (horrible) workaround for preventing template engine
650 // from hiding paragraph text that is enclosed
651 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
652
653 $this->tpl->fillTabs();
654 if ($this->fill_on_load_code) {
655 $this->tpl->fillOnLoadCode();
656 //$this->tpl->fillViewAppendInlineCss();
657 }
658 $content = $this->tpl->get();
659 $content = str_replace("&#123;", "{", $content);
660 $content = str_replace("&#125;", "}", $content);
661
662 header('Content-type: text/html; charset=UTF-8');
663 echo $content;
664 } else {
665 $this->tpl->fillLeftNav();
666 $this->tpl->fillOnLoadCode();
667 //$this->tpl->fillViewAppendInlineCss();
668 $content = $this->tpl->get();
669 }
670
671 return($content);
672 }
673
680 public function saveFrameUrl()
681 {
682 include_once("./Services/Authentication/classes/class.ilSessionIStorage.php");
683 $store = new ilSessionIStorage("lm");
684 if ($_GET["url"] != "") {
685 $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
686 } else {
687 $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
688 }
689 }
690
691
692 public function fullscreen()
693 {
694 return $this->layout("fullscreen.xml", !$this->offlineMode());
695 }
696
697 public function media()
698 {
699 if ($_GET["frame"] != "_blank") {
700 return $this->layout("main.xml", !$this->offlineMode());
701 } else {
702 return $this->layout("fullscreen.xml", !$this->offlineMode());
703 }
704 }
705
706 public function glossary()
707 {
708 global $DIC;
709
711
712 if ($_GET["frame"] != "_blank") {
713 $this->layout();
714 } else {
715 $this->tpl = new ilTemplate("tpl.glossary_term_output.html", true, true, true);
716 $GLOBALS["tpl"] = $this->tpl;
717 $this->renderPageTitle();
718
719 // set style sheets
720 if (!$this->offlineMode()) {
721 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
722 } else {
723 $style_name = $ilUser->getPref("style") . ".css";
724 ;
725 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
726 }
727
728 $this->ilGlossary($child);
729 if (!$this->offlineMode()) {
730 $this->tpl->show();
731 } else {
732 return $this->tpl->get();
733 }
734 }
735 }
736
740 public function ilMainMenu()
741 {
742 // LTI
743 global $DIC;
744 $ltiview = $DIC["lti"];
745 if ($ltiview->isActive()) {
746 include_once './Services/LTI/classes/class.ilMainMenuGUI.php';
747 $ilMainMenu = new LTI\ilMainMenuGUI("_top", false, $this->tpl);
748 } else {
749 include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
750 $ilMainMenu = new ilMainMenuGUI("_top", false, $this->tpl);
751 }
752
753 if ($this->offlineMode()) {
754 $this->tpl->touchBlock("pg_intro");
755 $this->tpl->touchBlock("pg_outro");
756 return;
757 }
758
759 $page_id = $this->getCurrentPageId();
760 if ($page_id > 0) {
761 $ilMainMenu->setLoginTargetPar("pg_" . $page_id . "_" . $this->lm->getRefId());
762 }
763
764 //$this->tpl->touchBlock("mm_intro");
765 //$this->tpl->touchBlock("mm_outro");
766 $this->tpl->touchBlock("pg_intro");
767 $this->tpl->touchBlock("pg_outro");
768 $this->tpl->setBodyClass("std");
769 $this->tpl->setVariable("MAINMENU", $ilMainMenu->getHTML());
770 // LTI
771 $this->tpl->setVariable("MAINMENU_SPACER", $ilMainMenu->getSpacerClass());
772 }
773
777 public function ilTOC($a_get_explorer = false)
778 {
779 include_once("./Modules/LearningModule/classes/class.ilLMTOCExplorerGUI.php");
780 $exp = new ilLMTOCExplorerGUI($this, "ilTOC", $this, $this->lang, $this->focus_id, $this->export_all_languages);
781 $exp->setMainTemplate($this->tpl);
782 $exp->setTracker($this->getTracker());
783 if (!$exp->handleCommand()) {
784 // determine highlighted and force open nodes
785 $page_id = $this->getCurrentPageId();
786 if ($this->deactivated_page) {
787 $page_id = $_GET["obj_id"];
788 }
789 if ($page_id > 0) {
790 $exp->setPathOpen((int) $page_id);
791 }
792 // empty chapter
793 if ($this->chapter_has_no_active_page &&
794 ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
795 $exp->setHighlightNode($_GET["obj_id"]);
796 } else {
797 if ($this->lm->getTOCMode() == "pages") {
798 if ($this->deactivated_page) {
799 $exp->setHighlightNode($_GET["obj_id"]);
800 } else {
801 $exp->setHighlightNode($page_id);
802 }
803 } else {
804 $exp->setHighlightNode($this->lm_tree->getParentId($page_id));
805 }
806 }
807 if ($this->offlineMode()) {
808 $exp->setOfflineMode(true);
809 }
810
811 if ($a_get_explorer) {
812 return $exp;
813 } else {
814 $this->tpl->setCurrentBlock("il_toc");
815 $this->tpl->setVariable("EXPLORER", $exp->getHTML());
816 $this->tpl->parseCurrentBlock();
817 }
818 }
819 }
820
827 public function getLMPresentationTitle()
828 {
829 if ($this->offlineMode() && $this->lang != "" && $this->lang != "-") {
830 include_once("./Services/Object/classes/class.ilObjectTranslation.php");
831 $ot = ilObjectTranslation::getInstance($this->lm->getId());
832 $data = $ot->getLanguages();
833 $ltitle = $data[$this->lang]["title"];
834 if ($ltitle != "") {
835 return $ltitle;
836 }
837 }
838 return $this->lm->getTitle();
839 }
840
841
845 public function ilLMMenu()
846 {
847 $this->tpl->setVariable("MENU", $this->lm_gui->setilLMMenu(
848 $this->offlineMode(),
849 $this->getExportFormat(),
850 "content",
851 false,
852 true,
853 $this->getCurrentPageId(),
854 $this->lang,
855 $this->export_all_languages
856 ));
857 }
858
862 public function ilLMHead()
863 {
864 $this->tpl->setCurrentBlock("header_image");
865 if ($this->offlineMode()) {
866 $this->tpl->setVariable("IMG_HEADER", "./images/icon_lm.svg");
867 } else {
868 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_lm.svg"));
869 }
870 $this->tpl->parseCurrentBlock();
871 $this->tpl->setCurrentBlock("lm_head");
872 $this->tpl->setVariable("HEADER", $this->getLMPresentationTitle());
873 $this->tpl->parseCurrentBlock();
874 }
875
879 public function ilLMSubMenu()
880 {
882
883 if ($this->abstract) {
884 return;
885 }
886
887 $showViewInFrameset = true;
888
889 if ($showViewInFrameset) {
890 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
891 } else {
892 $buttonTarget = "_top";
893 }
894
895
896 include_once("./Services/UICore/classes/class.ilTemplate.php");
897 $tpl_menu = new ilTemplate("tpl.lm_sub_menu.html", true, true, true);
898
899 $pg_id = $this->getCurrentPageId();
900 if ($pg_id == 0) {
901 return;
902 }
903
904 // edit learning module
905 if (!$this->offlineMode()) {
906 if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
907 $tpl_menu->setCurrentBlock("edit_page");
908 $page_id = $this->getCurrentPageId();
909 $tpl_menu->setVariable("EDIT_LINK", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] .
910 "&obj_id=" . $page_id . "&to_page=1");
911 $tpl_menu->setVariable("EDIT_TXT", $this->lng->txt("edit_page"));
912 $tpl_menu->setVariable("EDIT_TARGET", $buttonTarget);
913 $tpl_menu->parseCurrentBlock();
914 }
915
916 $page_id = $this->getCurrentPageId();
917
918 include_once("./Services/PermanentLink/classes/class.ilPermanentLinkGUI.php");
919 $plinkgui = new ilPermanentLinkGUI(
920 "pg",
921 $page_id . "_" . $this->lm->getRefId(),
922 "",
923 "_top"
924 );
925
928 $page_id,
929 $this->lm->getPageHeader(),
930 $this->lm->isActiveNumbering(),
931 $this->lm_set->get("time_scheduled_page_activation"),
932 false,
933 0,
934 $this->lang
935 );
936 if ($pg_title != "") {
937 $title.= ": " . $pg_title;
938 }
939
940 $plinkgui->setTitle($title);
941
942 $tpl_menu->setCurrentBlock("perma_link");
943 $tpl_menu->setVariable("PERMA_LINK", $plinkgui->getHTML());
944 $tpl_menu->parseCurrentBlock();
945 }
946
947 $this->tpl->setVariable("SUBMENU", $tpl_menu->get());
948 }
949
950
954 public function redrawHeaderAction()
955 {
956 echo $this->addHeaderAction(true);
957 exit;
958 }
959
963 public function addHeaderAction($a_redraw = false)
964 {
965 $ilAccess = $this->access;
967
968 include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
969 $dispatcher = new ilCommonActionDispatcherGUI(
971 $ilAccess,
972 $this->lm->getType(),
973 $_GET["ref_id"],
974 $this->lm->getId()
975 );
976 $dispatcher->setSubObject("pg", $this->getCurrentPageId());
977
978 include_once "Services/Object/classes/class.ilObjectListGUI.php";
979 ilObjectListGUI::prepareJSLinks(
980 $this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true),
981 $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
982 $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false),
983 $this->tpl
984 );
985
986 $lg = $dispatcher->initHeaderAction();
987 $lg->enableNotes(true);
988 $lg->enableComments($this->lm->publicNotes(), false);
989
990 if ($this->lm->hasRating() && !$this->offlineMode()) {
991 $lg->enableRating(
992 true,
993 $this->lng->txt("lm_rating"),
994 false,
995 array("ilcommonactiondispatchergui", "ilratinggui")
996 );
997 }
998
999 if (!$a_redraw) {
1000 $this->tpl->setVariable("HEAD_ACTION", $lg->getHeaderAction($this->tpl));
1001 } else {
1002 // we need to add onload code manually (rating, comments, etc.)
1003 return $lg->getHeaderAction() .
1004 $tpl->getOnLoadCodeForAsynch();
1005 }
1006 }
1007
1011 public function ilLMNotes()
1012 {
1013 $ilAccess = $this->access;
1015
1016
1017 // no notes in offline (export) mode
1018 if ($this->offlineMode()) {
1019 return;
1020 }
1021
1022 // output notes (on top)
1023
1024 if (!$ilSetting->get("disable_notes")) {
1025 $this->addHeaderAction();
1026 }
1027
1028 // now output comments
1029
1030 if ($ilSetting->get("disable_comments")) {
1031 return;
1032 }
1033
1034 if (!$this->lm->publicNotes()) {
1035 return;
1036 }
1037
1038 $next_class = $this->ctrl->getNextClass($this);
1039
1040 include_once("Services/Notes/classes/class.ilNoteGUI.php");
1041 $pg_id = $this->getCurrentPageId();
1042 if ($pg_id == 0) {
1043 return;
1044 }
1045
1046 $notes_gui = new ilNoteGUI($this->lm->getId(), $this->getCurrentPageId(), "pg");
1047
1048 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) &&
1049 $ilSetting->get("comments_del_tutor", 1)) {
1050 $notes_gui->enablePublicNotesDeletion(true);
1051 }
1052
1053 $this->ctrl->setParameter($this, "frame", $_GET["frame"]);
1054 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
1055
1056 $notes_gui->enablePrivateNotes();
1057 if ($this->lm->publicNotes()) {
1058 $notes_gui->enablePublicNotes();
1059 }
1060
1061 if ($next_class == "ilnotegui") {
1062 $html = $this->ctrl->forwardCommand($notes_gui);
1063 } else {
1064 $html = $notes_gui->getNotesHTML();
1065 }
1066 $this->tpl->setVariable("NOTES", $html);
1067 }
1068
1069
1073 public function ilLocator($a_std_templ_loaded = false)
1074 {
1075 global $DIC;
1076 $ltiview = $DIC["lti"];
1077 $ilLocator = $this->locator;
1080
1081 require_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
1082
1083 if (empty($_GET["obj_id"])) {
1084 $a_id = $this->lm_tree->getRootId();
1085 } else {
1086 $a_id = $_GET["obj_id"];
1087 }
1088
1089 if (!$a_std_templ_loaded) {
1090 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1091 }
1092
1093 if (!$this->lm->cleanFrames()) {
1094 $frame_param = $_GET["frame"];
1095 $frame_target = "";
1096 } elseif (!$this->offlineMode()) {
1097 $frame_param = "";
1098 $frame_target = ilFrameTargetInfo::_getFrame("MainContent");
1099 } else {
1100 $frame_param = "";
1101 $frame_target = "_top";
1102 }
1103
1104 if (!$this->offlineMode()) {
1105 // LTI
1106 if ($ltiview->isActive()) {
1107 // Do nothing, its complicated...
1108 } else {
1109 $ilLocator->addItem("...", "");
1110
1111 $par_id = $tree->getParentId($_GET["ref_id"]);
1112 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $par_id);
1113 $ilLocator->addItem(
1115 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
1116 ilFrameTargetInfo::_getFrame("MainContent"),
1117 $par_id
1118 );
1119 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1120 }
1121 } else {
1122 $ilLocator->setOffline(true);
1123 }
1124
1125 if ($this->lm_tree->isInTree($a_id)) {
1126 $path = $this->lm_tree->getPathFull($a_id);
1127
1128 foreach ($path as $key => $row) {
1129 if ($row["type"] != "pg") {
1130 if ($row["child"] != $this->lm_tree->getRootId()) {
1131 $ilLocator->addItem(
1134 $row["child"],
1136 $this->lm->isActiveNumbering(),
1137 $this->lm_set->get("time_scheduled_page_activation"),
1138 false,
1139 0,
1140 $this->lang
1141 ),
1142 50,
1143 true
1144 ),
1145 $this->getLink($_GET["ref_id"], "layout", $row["child"], $frame_param, "StructureObject"),
1146 $frame_target
1147 );
1148 } else {
1149 $ilLocator->addItem(
1150 ilUtil::shortenText($this->getLMPresentationTitle(), 50, true),
1151 $this->getLink($_GET["ref_id"], "layout", "", $frame_param),
1152 $frame_target,
1153 $_GET["ref_id"]
1154 );
1155 }
1156 }
1157 }
1158 } else { // lonely page
1159 $ilLocator->addItem(
1160 $this->getLMPresentationTitle(),
1161 $this->getLink($_GET["ref_id"], "layout", "", $_GET["frame"])
1162 );
1163
1164 require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
1165 $lm_obj = ilLMObjectFactory::getInstance($this->lm, $a_id);
1166
1167 $ilLocator->addItem(
1168 $lm_obj->getTitle(),
1169 $this->getLink($_GET["ref_id"], "layout", $a_id, $frame_param),
1170 $frame_target
1171 );
1172 }
1173
1174 if (DEBUG) {
1175 $debug = "DEBUG: <font color=\"red\">" . $this->type . "::" . $this->id . "::" . $_GET["cmd"] . "</font><br/>";
1176 }
1177
1178 //$prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
1179
1180
1181 $this->tpl->setLocator();
1182 }
1183
1189 public function getCurrentPageId()
1190 {
1192
1193 if (!$this->offlineMode() && $this->current_page_id !== false) {
1195 }
1196
1197 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1198
1199 $this->chapter_has_no_active_page = false;
1200 $this->deactivated_page = false;
1201
1202 // determine object id
1203 if (empty($_GET["obj_id"])) {
1204 $obj_id = $this->lm_tree->getRootId();
1205 } else {
1206 $obj_id = $_GET["obj_id"];
1207 $active = ilLMPage::_lookupActive(
1208 $obj_id,
1209 $this->lm->getType(),
1210 $this->lm_set->get("time_scheduled_page_activation")
1211 );
1212
1213 if (!$active &&
1214 ilLMPageObject::_lookupType($obj_id) == "pg") {
1215 $this->deactivated_page = true;
1216 }
1217 }
1218
1219 // obj_id not in tree -> it is a unassigned page -> return page id
1220 if (!$this->lm_tree->isInTree($obj_id)) {
1221 return $obj_id;
1222 }
1223
1224 $curr_node = $this->lm_tree->getNodeData($obj_id);
1225
1226 $active = ilLMPage::_lookupActive(
1227 $obj_id,
1228 $this->lm->getType(),
1229 $this->lm_set->get("time_scheduled_page_activation")
1230 );
1231
1232 if ($curr_node["type"] == "pg" &&
1233 $active) { // page in tree -> return page id
1234 $page_id = $curr_node["obj_id"];
1235 } else { // no page -> search for next page and return its id
1236 $succ_node = true;
1237 $active = false;
1238 $page_id = $obj_id;
1239 while ($succ_node && !$active) {
1240 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
1241 $page_id = $succ_node["obj_id"];
1242 $active = ilLMPage::_lookupActive(
1243 $page_id,
1244 $this->lm->getType(),
1245 $this->lm_set->get("time_scheduled_page_activation")
1246 );
1247 }
1248
1249 if ($succ_node["type"] != "pg") {
1250 $this->chapter_has_no_active_page = true;
1251 return 0;
1252 }
1253
1254 // if public access get first public page in chapter
1255 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
1256 $this->lm_gui->object->getPublicAccessMode() == 'selected') {
1257 $public = ilLMObject::_isPagePublic($page_id);
1258
1259 while ($public === false && $page_id > 0) {
1260 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, 'pg');
1261 $page_id = $succ_node['obj_id'];
1262 $public = ilLMObject::_isPagePublic($page_id);
1263 }
1264 }
1265
1266 // check whether page found is within "clicked" chapter
1267 if ($this->lm_tree->isInTree($page_id)) {
1268 $path = $this->lm_tree->getPathId($page_id);
1269 if (!in_array($_GET["obj_id"], $path)) {
1270 $this->chapter_has_no_active_page = true;
1271 }
1272 }
1273 }
1274
1275 $this->current_page_id = $page_id;
1276 return $page_id;
1277 }
1278
1279 public function ilCitation()
1280 {
1281 $page_id = $this->getCurrentPageId();
1282 $this->tpl = new ilTemplate("tpl.page.html", true, true, true);
1283 $this->ilLocator();
1284 $this->tpl->setVariable("MENU", $this->lm_gui->setilCitationMenu());
1285
1286 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1287
1288 $this->pg_obj = $this->getLMPage($page_id);
1289 $xml = $this->pg_obj->getXMLContent();
1290 $this->lm_gui->showCitation($xml);
1291 $this->tpl->show();
1292 }
1293
1294
1295 public function getLayoutLinkTargets()
1296 {
1297 if (!is_object($this->layout_doc)) {
1298 return array();
1299 }
1300
1301 $xpc = xpath_new_context($this->layout_doc);
1302
1303 $path = "/ilLayout/ilLinkTargets/LinkTarget";
1304 $res = xpath_eval($xpc, $path);
1305 $targets = array();
1306 for ($i = 0; $i < count($res->nodeset); $i++) {
1307 $type = $res->nodeset[$i]->get_attribute("Type");
1308 $frame = $res->nodeset[$i]->get_attribute("Frame");
1309 $onclick = $res->nodeset[$i]->get_attribute("OnClick");
1310 $targets[$type] = array("Type" => $type, "Frame" => $frame, "OnClick" => $onclick);
1311 }
1312
1313 return $targets;
1314 }
1315
1323 public function ilPage(&$a_page_node, $a_page_id = 0)
1324 {
1326
1328 $ilHelp = $this->help;
1329
1330
1331 $ilHelp = $this->help;
1332 $ilHelp->setScreenIdComponent("lm");
1333 $ilHelp->setScreenId("content");
1334 $ilHelp->setSubScreenId("content");
1335
1336 $this->fill_on_load_code = true;
1337
1338
1339 // check page id
1340 $requested_page_lm = ilLMPage::lookupParentId($this->getCurrentPageId(), "lm");
1341 if ($requested_page_lm != $this->lm->getId()) {
1342 if ($_REQUEST["frame"] == "") {
1343 $this->showNoPageAccess();
1344 return "";
1345 } else {
1346 $read_access = false;
1347 foreach (ilObject::_getAllReferences($requested_page_lm) as $ref_id) {
1348 if ($access->checkAccess("read", "", $ref_id)) {
1349 $read_access = true;
1350 }
1351 }
1352 if (!$read_access) {
1353 $this->showNoPageAccess();
1354 return "";
1355 }
1356 }
1357 }
1358
1359 // check if page is (not) visible in public area
1360 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
1361 $this->lm_gui->object->getPublicAccessMode() == 'selected') {
1362 $public = ilLMObject::_isPagePublic($this->getCurrentPageId());
1363
1364 if (!$public) {
1365 return $this->showNoPublicAccess($this->getCurrentPageId());
1366 }
1367 }
1368
1369 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId())) {
1370 return $this->showPreconditionsOfPage($this->getCurrentPageId());
1371 }
1372
1373 // if navigation is restricted based on correct answered questions
1374 // check if we have preceeding pages including unsanswered/incorrect answered questions
1375 if (!$this->offlineMode()) {
1376 if ($this->lm->getRestrictForwardNavigation()) {
1377 if ($this->getTracker()->hasPredIncorrectAnswers($this->getCurrentPageId())) {
1379 return;
1380 }
1381 }
1382 }
1383
1384
1385 require_once("./Modules/LearningModule/classes/class.ilLMPageGUI.php");
1386 require_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
1387
1388 // page id is e.g. > 0 when footer or header page is processed
1389 if ($a_page_id == 0) {
1390 $page_id = $this->getCurrentPageId();
1391 //echo ":".$page_id.":";
1392 // highlighting?
1393
1394 if ($_GET["srcstring"] != "" && !$this->offlineMode()) {
1395 include_once './Services/Search/classes/class.ilUserSearchCache.php';
1396 $cache = ilUserSearchCache::_getInstance($ilUser->getId());
1397 $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
1398 $search_string = $cache->getQuery();
1399
1400 // advanced search?
1401 if (is_array($search_string)) {
1402 $search_string = $search_string["lom_content"];
1403 }
1404
1405 include_once("./Services/UIComponent/TextHighlighter/classes/class.ilTextHighlighterGUI.php");
1406 include_once("./Services/Search/classes/class.ilQueryParser.php");
1407 $p = new ilQueryParser($search_string);
1408 $p->parse();
1409
1410 $words = $p->getQuotedWords();
1411 if (is_array($words)) {
1412 foreach ($words as $w) {
1413 ilTextHighlighterGUI::highlight("ilLMPageContent", $w, $this->tpl);
1414 }
1415 }
1416
1417 $this->fill_on_load_code = true;
1418 }
1419 } else {
1420 $page_id = $a_page_id;
1421 }
1422
1423 // content style
1424 $this->tpl->setCurrentBlock("ContentStyle");
1425 if (!$this->offlineMode()) {
1426 $this->tpl->setVariable(
1427 "LOCATION_CONTENT_STYLESHEET",
1428 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
1429 );
1430 } else {
1431 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
1432 }
1433 $this->tpl->parseCurrentBlock();
1434
1435 // no active page found in chapter
1436 if ($this->chapter_has_no_active_page &&
1437 ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
1438 $mtpl = new ilTemplate(
1439 "tpl.no_content_message.html",
1440 true,
1441 true,
1442 "Modules/LearningModule"
1443 );
1444 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
1445 //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_st.svg",
1446 // false, "output", $this->offlineMode()));
1447 $mtpl->setVariable(
1448 "ITEM_TITLE",
1450 );
1451 $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
1452 return $mtpl->get();
1453 }
1454
1455 // current page is deactivated
1456 if ($this->deactivated_page) {
1457 $mtpl = new ilTemplate(
1458 "tpl.no_content_message.html",
1459 true,
1460 true,
1461 "Modules/LearningModule"
1462 );
1463 $m = $this->lng->txt("cont_page_currently_deactivated");
1464 $act_data = ilLMPage::_lookupActivationData((int) $_GET["obj_id"], $this->lm->getType());
1465 if ($act_data["show_activation_info"] &&
1466 (ilUtil::now() < $act_data["activation_start"])) {
1467 $m.= "<p>" . sprintf(
1468 $this->lng->txt("cont_page_activation_on"),
1470 new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME)
1471 )
1472 ) .
1473 "</p>";
1474 }
1475 $mtpl->setVariable("MESSAGE", $m);
1476 //$mtpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_pg.svg",
1477 // false, "output", $this->offlineMode()));
1478 $mtpl->setVariable(
1479 "ITEM_TITLE",
1481 );
1482 $this->tpl->setVariable("PAGE_CONTENT", $mtpl->get());
1483 return $mtpl->get();
1484 }
1485
1486 // check if page is out of focus
1487 $focus_mess = "";
1488 if ($this->focus_id > 0) {
1489 $path = $this->lm_tree->getPathId($page_id);
1490
1491 // out of focus
1492 if (!in_array($this->focus_id, $path)) {
1493 $mtpl = new ilTemplate(
1494 "tpl.out_of_focus_message.html",
1495 true,
1496 true,
1497 "Modules/LearningModule"
1498 );
1499 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message"));
1500 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
1501
1502 if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
1503 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
1504 $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
1505 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
1506 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
1507 } else {
1508 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
1509 include_once("./Services/Link/classes/class.ilLink.php");
1510 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
1511 }
1512
1513 $this->ctrl->setParameter($this, "focus_id", "");
1514 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
1515 $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
1516
1517 $focus_mess = $mtpl->get();
1518 } else {
1519 $sp = $this->getSuccessorPage();
1520 $path2 = array();
1521 if ($sp > 0) {
1522 $path2 = $this->lm_tree->getPathId($this->getSuccessorPage());
1523 }
1524 if ($sp == 0 || !in_array($this->focus_id, $path2)) {
1525 $mtpl = new ilTemplate(
1526 "tpl.out_of_focus_message.html",
1527 true,
1528 true,
1529 "Modules/LearningModule"
1530 );
1531 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message_last_page"));
1532 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
1533
1534 if ($_GET["focus_return"] == "" || ilObject::_lookupType((int) $_GET["focus_return"], true) != "crs") {
1535 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
1536 $this->ctrl->setParameter($this, "obj_id", $this->focus_id);
1537 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this, "layout"));
1538 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
1539 } else {
1540 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
1541 include_once("./Services/Link/classes/class.ilLink.php");
1542 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink((int) $_GET["focus_return"]));
1543 }
1544
1545 $this->ctrl->setParameter($this, "focus_id", "");
1546 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this, "layout"));
1547 $this->ctrl->setParameter($this, "focus_id", $_GET["focus_id"]);
1548
1549 $focus_mess = $mtpl->get();
1550 }
1551 }
1552 }
1553
1554 // no page found
1555 if ($page_id == 0) {
1556 $cont = $this->lng->txt("cont_no_page");
1557 $this->tpl->setVariable("PAGE_CONTENT", $cont);
1558 return $cont;
1559 }
1560
1561
1562 $page_object_gui = $this->getLMPageGUI($page_id);
1563 $this->basicPageGuiInit($page_object_gui);
1564 $page_object = $page_object_gui->getPageObject();
1565 $page_object->buildDom();
1566 $page_object->registerOfflineHandler($this);
1567
1568 $int_links = $page_object->getInternalLinks();
1569
1570
1571
1572 $page_object_gui->setTemplateOutput(false);
1573
1574 // Update personal desktop items
1575 $ilUser->setDesktopItemParameters($this->lm->getRefId(), $this->lm->getType(), $page_id);
1576
1577 // Update course items
1578 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
1579 ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
1580
1581 // read link targets
1582 $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
1583 $link_xml.= $this->getLinkTargetsXML();
1584
1585 // get lm page object
1586 $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
1587 $lm_pg_obj->setLMId($this->lm->getId());
1588 //$pg_obj->setParentId($this->lm->getId());
1589 $page_object_gui->setLinkXML($link_xml);
1590
1591 // determine target frames for internal links
1592 //$pg_frame = $_GET["frame"];
1593 $page_object_gui->setLinkFrame($_GET["frame"]);
1594
1595 // page title and tracking (not for header or footer page)
1596 if ($page_id == 0 || ($page_id != $this->lm->getHeaderPage() &&
1597 $page_id != $this->lm->getFooterPage())) {
1598 $page_object_gui->setPresentationTitle(
1600 $lm_pg_obj->getId(),
1601 $this->lm->getPageHeader(),
1602 $this->lm->isActiveNumbering(),
1603 $this->lm_set->get("time_scheduled_page_activation"),
1604 false,
1605 0,
1606 $this->lang
1607 )
1608 );
1609
1610 // track access
1611 if ($ilUser->getId() != ANONYMOUS_USER_ID && $page_id != 0 && !$this->offlineMode()) {
1612 $this->getTracker()->trackAccess($page_id);
1613 }
1614 } else {
1615 $page_object_gui->setEnabledPageFocus(false);
1616 $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
1617 }
1618
1619 // ADDED FOR CITATION
1620 $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
1621 $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
1622 $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
1623
1624 // syntax style
1625 $this->tpl->setCurrentBlock("SyntaxStyle");
1626 if (!$this->offlineMode()) {
1627 $this->tpl->setVariable(
1628 "LOCATION_SYNTAX_STYLESHEET",
1630 );
1631 } else {
1632 $this->tpl->setVariable(
1633 "LOCATION_SYNTAX_STYLESHEET",
1634 "syntaxhighlight.css"
1635 );
1636 }
1637 $this->tpl->parseCurrentBlock();
1638
1639
1640 $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
1641
1642 // process header
1643 if ($this->lm->getHeaderPage() > 0 &&
1644 $page_id != $this->lm->getHeaderPage() &&
1645 ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
1646 if (ilLMObject::_exists($this->lm->getHeaderPage())) {
1647 $head = $this->ilPage($a_page_node, $this->lm->getHeaderPage());
1648 }
1649 }
1650
1651 // process footer
1652 if ($this->lm->getFooterPage() > 0 &&
1653 $page_id != $this->lm->getFooterPage() &&
1654 ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
1655 if (ilLMObject::_exists($this->lm->getFooterPage())) {
1656 $foot = $this->ilPage($a_page_node, $this->lm->getFooterPage());
1657 }
1658 }
1659
1660 // rating
1661 $rating = "";
1662 if ($this->lm->hasRatingPages() && !$this->offlineMode()) {
1663 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
1664 $rating_gui = new ilRatingGUI();
1665 $rating_gui->setObject($this->lm->getId(), "lm", $page_id, "lm");
1666 $rating_gui->setYourRatingText($this->lng->txt("lm_rate_page"));
1667
1668 /*
1669 $this->tpl->setVariable("VAL_RATING", $rating->getHTML(false, true,
1670 "il.ExcPeerReview.saveComments(".$a_set["peer_id"].", %rating%)"));
1671 */
1672
1673 $this->ctrl->setParameter($this, "pgid", $page_id);
1674 $this->tpl->addOnLoadCode("il.LearningModule.setRatingUrl('" .
1675 $this->ctrl->getLinkTarget($this, "updatePageRating", "", true, false) .
1676 "')");
1677 $this->ctrl->setParameter($this, "pgid", "");
1678
1679 $rating = '<div id="ilrtrpg" style="text-align:right">' .
1680 $rating_gui->getHtml(true, true, "il.LearningModule.saveRating(%rating%);") .
1681 "</div>";
1682 }
1683
1684 $this->tpl->setVariable("PAGE_CONTENT", $rating . $head . $focus_mess . $ret . $foot);
1685 //echo htmlentities("-".$ret."-");
1686 return $head . $focus_mess . $ret . $foot;
1687 }
1688
1689 public function updatePageRating()
1690 {
1692
1693 $pg_id = $_GET["pgid"];
1694 if (!$this->ctrl->isAsynch() || !$pg_id) {
1695 exit();
1696 }
1697
1698 include_once './Services/Rating/classes/class.ilRating.php';
1699 $rating = (int) $_POST["rating"];
1700 if ($rating) {
1702 $this->lm->getId(),
1703 "lm",
1704 $pg_id,
1705 "lm",
1706 $ilUser->getId(),
1707 $_POST["rating"]
1708 );
1709 } else {
1711 $this->lm->getId(),
1712 "lm",
1713 $pg_id,
1714 "lm",
1715 $ilUser->getId()
1716 );
1717 }
1718
1719 include_once './Services/Rating/classes/class.ilRatingGUI.php';
1720 $rating = new ilRatingGUI();
1721 $rating->setObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
1722 $rating->setYourRatingText($this->lng->txt("lm_rate_page"));
1723
1724 echo $rating->getHtml(true, true, "il.LearningModule.saveRating(%rating%);");
1725
1726 echo $this->tpl->getOnLoadCodeForAsynch();
1727 exit();
1728 }
1729
1736 public function basicPageGuiInit($a_page_gui)
1737 {
1738 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1739 $a_page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
1740 $this->lm->getStyleSheetId(),
1741 "lm"
1742 ));
1743 if (!$this->offlineMode()) {
1744 $a_page_gui->setOutputMode("presentation");
1745 $this->fill_on_load_code = true;
1746 } else {
1747 $a_page_gui->setOutputMode("offline");
1748 $a_page_gui->setOfflineDirectory($this->getOfflineDirectory());
1749 $this->fill_on_load_code = false;
1750 }
1751 if (!$this->offlineMode()) {
1752 $this->ctrl->setParameter($this, "obj_id", $this->getCurrentPageId()); // see #22403
1753 }
1754 $a_page_gui->setFileDownloadLink($this->getLink($_GET["ref_id"], "downloadFile"));
1755 if (!$this->offlineMode()) {
1756 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
1757 }
1758 $a_page_gui->setFullscreenLink($this->getLink($_GET["ref_id"], "fullscreen"));
1759 }
1760
1764 public function showPreconditionsOfPage()
1765 {
1766 $conds = ilObjContentObject::_getMissingPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
1767 $topchap = ilObjContentObject::_getMissingPreconditionsTopChapter($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
1768
1769 $page_id = $this->getCurrentPageId();
1770
1771 // content style
1772 $this->tpl->setCurrentBlock("ContentStyle");
1773 if (!$this->offlineMode()) {
1774 $this->tpl->setVariable(
1775 "LOCATION_CONTENT_STYLESHEET",
1776 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
1777 );
1778 } else {
1779 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
1780 }
1781 $this->tpl->parseCurrentBlock();
1782
1783 $this->tpl->addBlockFile("PAGE_CONTENT", "pg_content", "tpl.page_preconditions.html", true);
1784
1785 // list all missing preconditions
1786 include_once("./Services/Repository/classes/class.ilRepositoryExplorer.php");
1787 foreach ($conds as $cond) {
1788 include_once("./Services/Link/classes/class.ilLink.php");
1789 $obj_link = ilLink::_getLink($cond["trigger_ref_id"]);
1790 $this->tpl->setCurrentBlock("condition");
1791 $this->tpl->setVariable("VAL_ITEM", ilObject::_lookupTitle($cond["trigger_obj_id"]));
1792 $this->tpl->setVariable("LINK_ITEM", $obj_link);
1793 if ($cond["operator"] == "passed") {
1794 $cond_str = $this->lng->txt("passed");
1795 } else {
1796 $cond_str = $this->lng->txt("condition_" . $cond["operator"]);
1797 }
1798 $this->tpl->setVariable("VAL_CONDITION", $cond_str . " " . $cond["value"]);
1799 $this->tpl->parseCurrentBlock();
1800 }
1801 $this->tpl->setCurrentBlock("pg_content");
1802
1803 $this->tpl->setVariable(
1804 "TXT_MISSING_PRECONDITIONS",
1805 sprintf(
1806 $this->lng->txt("cont_missing_preconditions"),
1807 ilLMObject::_lookupTitle($topchap)
1808 )
1809 );
1810 $this->tpl->setVariable("TXT_ITEM", $this->lng->txt("object"));
1811 $this->tpl->setVariable("TXT_CONDITION", $this->lng->txt("condition"));
1812
1813 // output skip chapter link
1814 $parent = $this->lm_tree->getParentId($topchap);
1815 $childs = $this->lm_tree->getChildsByType($parent, "st");
1816 $next = "";
1817 $j=-2;
1818 $i=1;
1819 foreach ($childs as $child) {
1820 if ($child["child"] == $topchap) {
1821 $j = $i;
1822 }
1823 if ($i++ == ($j+1)) {
1824 $succ_node = $this->lm_tree->fetchSuccessorNode($child["child"], "pg");
1825 }
1826 }
1827 if ($succ_node != "") {
1828 $framestr = (!empty($_GET["frame"]))
1829 ? "frame=" . $_GET["frame"] . "&"
1830 : "";
1831
1832 $showViewInFrameset = true;
1833 $link = "<br /><a href=\"" .
1834 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]) .
1835 "\">" . $this->lng->txt("cont_skip_chapter") . "</a>";
1836 $this->tpl->setVariable("LINK_SKIP_CHAPTER", $link);
1837 }
1838
1839 $this->tpl->parseCurrentBlock();
1840 }
1841
1845 public function getLinkXML($a_int_links, $a_layoutframes)
1846 {
1848
1849 // Determine whether the view of a learning resource should
1850 // be shown in the frameset of ilias, or in a separate window.
1851 $showViewInFrameset = true;
1852
1853 if ($a_layoutframes == "") {
1854 $a_layoutframes = array();
1855 }
1856 $link_info = "<IntLinkInfos>";
1857 foreach ($a_int_links as $int_link) {
1858 $target = $int_link["Target"];
1859 if (substr($target, 0, 4) == "il__") {
1860 $target_arr = explode("_", $target);
1861 $target_id = $target_arr[count($target_arr) - 1];
1862 $type = $int_link["Type"];
1863 $targetframe = ($int_link["TargetFrame"] != "")
1864 ? $int_link["TargetFrame"]
1865 : "None";
1866
1867 // anchor
1868 $anc = $anc_add = "";
1869 if ($int_link["Anchor"] != "") {
1870 $anc = $int_link["Anchor"];
1871 $anc_add = "_" . rawurlencode($int_link["Anchor"]);
1872 }
1873 $lcontent = "";
1874 switch ($type) {
1875 case "PageObject":
1876 case "StructureObject":
1878 if ($lm_id == $this->lm->getId() ||
1879 ($targetframe != "None" && $targetframe != "New")) {
1880 $ltarget = $a_layoutframes[$targetframe]["Frame"];
1881 //$nframe = ($ltarget == "")
1882 // ? $_GET["frame"]
1883 // : $ltarget;
1884 $nframe = ($ltarget == "")
1885 ? ""
1886 : $ltarget;
1887 if ($ltarget == "") {
1888 if ($showViewInFrameset) {
1889 $ltarget="_parent";
1890 } else {
1891 $ltarget="_top";
1892 }
1893 }
1894 // scorm always in 1window view and link target
1895 // is always same frame
1896 if ($this->getExportFormat() == "scorm" &&
1897 $this->offlineMode()) {
1898 $ltarget = "";
1899 }
1900 $href =
1901 $this->getLink(
1902 $_GET["ref_id"],
1903 "layout",
1904 $target_id,
1905 $nframe,
1906 $type,
1907 "append",
1908 $anc
1909 );
1910 if ($lm_id == "") {
1911 $href = "";
1912 }
1913 } else {
1914 if (!$this->offlineMode()) {
1915 if ($type == "PageObject") {
1916 $href = "./goto.php?target=pg_" . $target_id . $anc_add;
1917 } else {
1918 $href = "./goto.php?target=st_" . $target_id;
1919 }
1920 } else {
1921 if ($type == "PageObject") {
1922 $href = ILIAS_HTTP_PATH . "/goto.php?target=pg_" . $target_id . $anc_add . "&amp;client_id=" . CLIENT_ID;
1923 } else {
1924 $href = ILIAS_HTTP_PATH . "/goto.php?target=st_" . $target_id . "&amp;client_id=" . CLIENT_ID;
1925 }
1926 }
1927 if ($targetframe != "New") {
1928 $ltarget = ilFrameTargetInfo::_getFrame("MainContent");
1929 } else {
1930 $ltarget = "_blank";
1931 }
1932 }
1933 break;
1934
1935 case "GlossaryItem":
1936 if ($targetframe == "None") {
1937 $targetframe = "Glossary";
1938 }
1939 $ltarget = $a_layoutframes[$targetframe]["Frame"];
1940 $nframe = ($ltarget == "")
1941 ? $_GET["frame"]
1942 : $ltarget;
1943 $href =
1944 $this->getLink($_GET["ref_id"], $a_cmd = "glossary", $target_id, $nframe, $type);
1945 break;
1946
1947 case "MediaObject":
1948 $ltarget = $a_layoutframes[$targetframe]["Frame"];
1949 $nframe = ($ltarget == "")
1950 ? $_GET["frame"]
1951 : $ltarget;
1952 $href =
1953 $this->getLink($_GET["ref_id"], $a_cmd = "media", $target_id, $nframe, $type);
1954 break;
1955
1956 case "RepositoryItem":
1957 $obj_type = ilObject::_lookupType($target_id, true);
1959 if (!$this->offlineMode()) {
1960 $href = "./goto.php?target=" . $obj_type . "_" . $target_id;
1961 } else {
1962 $href = ILIAS_HTTP_PATH . "/goto.php?target=" . $obj_type . "_" . $target_id . "&amp;client_id=" . CLIENT_ID;
1963 }
1964 $ltarget = ilFrameTargetInfo::_getFrame("MainContent");
1965 break;
1966
1967 case "WikiPage":
1968 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
1970 break;
1971
1972 case "File":
1973 if (!$this->offlineMode()) {
1974 $ilCtrl->setParameter($this, "obj_id", $this->getCurrentPageId());
1975 $ilCtrl->setParameter($this, "file_id", "il__file_" . $target_id);
1976 $href = $ilCtrl->getLinkTarget($this, "downloadFile");
1977 $ilCtrl->setParameter($this, "file_id", "");
1978 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
1979 }
1980 break;
1981
1982 case "User":
1983 $obj_type = ilObject::_lookupType($target_id);
1984 if ($obj_type == "usr") {
1985 include_once("./Services/User/classes/class.ilUserUtil.php");
1986 $back = $this->ctrl->getLinkTarget($this, "layout");
1987 //var_dump($back); exit;
1988 $this->ctrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $target_id);
1989 $this->ctrl->setParameterByClass(
1990 "ilpublicuserprofilegui",
1991 "back_url",
1992 rawurlencode($back)
1993 );
1994 $href = "";
1995 include_once("./Services/User/classes/class.ilUserUtil.php");
1997 $href = $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML");
1998 }
1999 $this->ctrl->setParameterByClass("ilpublicuserprofilegui", "user_id", "");
2000 $lcontent = ilUserUtil::getNamePresentation($target_id, false, false);
2001 }
2002 break;
2003
2004 }
2005
2006 $anc_par = 'Anchor="' . $anc . '"';
2007
2008 if ($href != "") {
2009 $link_info .= "<IntLinkInfo Target=\"$target\" Type=\"$type\" " .
2010 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" LinkContent=\"$lcontent\" $anc_par/>";
2011 }
2012
2013 // set equal link info for glossary links of target "None" and "Glossary"
2014 /*
2015 if ($targetframe=="None" && $type=="GlossaryItem")
2016 {
2017 $link_info.="<IntLinkInfo Target=\"$target\" Type=\"$type\" ".
2018 "TargetFrame=\"Glossary\" LinkHref=\"$href\" LinkTarget=\"$ltarget\" />";
2019 }*/
2020 }
2021 }
2022 $link_info.= "</IntLinkInfos>";
2023 return $link_info;
2024 }
2025
2029 public function getLinkTargetsXML()
2030 {
2031 $link_info = "<LinkTargets>";
2032 foreach ($this->getLayoutLinkTargets() as $k => $t) {
2033 $link_info.="<LinkTarget TargetFrame=\"" . $t["Type"] . "\" LinkTarget=\"" . $t["Frame"] . "\" OnClick=\"" . $t["OnClick"] . "\" />";
2034 }
2035 $link_info.= "</LinkTargets>";
2036 return $link_info;
2037 }
2038
2042 public function ilGlossary()
2043 {
2045
2046 require_once("./Modules/Glossary/classes/class.ilGlossaryTermGUI.php");
2047 $term_gui = new ilGlossaryTermGUI($_GET["obj_id"]);
2048
2049 // content style
2050 $this->tpl->setCurrentBlock("ContentStyle");
2051 if (!$this->offlineMode()) {
2052 $this->tpl->setVariable(
2053 "LOCATION_CONTENT_STYLESHEET",
2054 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
2055 );
2056 } else {
2057 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
2058 }
2059 $this->tpl->parseCurrentBlock();
2060
2061 // syntax style
2062 $this->tpl->setCurrentBlock("SyntaxStyle");
2063
2064 if (!$this->offlineMode()) {
2065 $this->tpl->setVariable(
2066 "LOCATION_SYNTAX_STYLESHEET",
2068 );
2069 } else {
2070 $this->tpl->setVariable(
2071 "LOCATION_SYNTAX_STYLESHEET",
2072 "syntaxhighlight.css"
2073 );
2074 }
2075 $this->tpl->parseCurrentBlock();
2076
2077 $int_links = $term_gui->getInternalLinks();
2078 $link_xml = $this->getLinkXML($int_links, $this->getLayoutLinkTargets());
2079 $link_xml.= $this->getLinkTargetsXML();
2080 $term_gui->setLinkXML($link_xml);
2081
2082 $term_gui->setOfflineDirectory($this->getOfflineDirectory());
2083 if (!$this->offlineMode()) {
2084 $ilCtrl->setParameter($this, "pg_type", "glo");
2085 }
2086 $term_gui->output($this->offlineMode(), $this->tpl);
2087
2088
2089
2090 if (!$this->offlineMode()) {
2091 $ilCtrl->setParameter($this, "pg_type", "");
2092 }
2093 }
2094
2098 public function ilMedia()
2099 {
2101
2102 $this->tpl->setCurrentBlock("ContentStyle");
2103 if (!$this->offlineMode()) {
2104 $this->tpl->setVariable(
2105 "LOCATION_CONTENT_STYLESHEET",
2106 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
2107 );
2108 } else {
2109 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
2110 }
2111 $this->tpl->parseCurrentBlock();
2112
2113 $this->renderPageTitle();
2114
2115 // set style sheets
2116 if (!$this->offlineMode()) {
2117 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2118 } else {
2119 $style_name = $ilUser->getPref("style") . ".css";
2120 ;
2121 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
2122 }
2123
2124 $this->tpl->setCurrentBlock("ilMedia");
2125
2126 //$int_links = $page_object->getInternalLinks();
2127 $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
2128 $link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
2129 $link_xml.= $this->getLinkTargetsXML();
2130 //echo "<br><br>".htmlentities($link_xml);
2131 require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2132 $media_obj = new ilObjMediaObject($_GET["mob_id"]);
2133 if (!empty($_GET["pg_id"])) {
2134 require_once("./Modules/LearningModule/classes/class.ilLMPage.php");
2135 $pg_obj = $this->getLMPage($_GET["pg_id"]);
2136 $pg_obj->buildDom();
2137
2138 $xml = "<dummy>";
2139 // todo: we get always the first alias now (problem if mob is used multiple
2140 // times in page)
2141 $xml.= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
2142 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2143 $xml.= $link_xml;
2144 $xml.="</dummy>";
2145 } else {
2146 $xml = "<dummy>";
2147 // todo: we get always the first alias now (problem if mob is used multiple
2148 // times in page)
2149 $xml.= $media_obj->getXML(IL_MODE_ALIAS);
2150 $xml.= $media_obj->getXML(IL_MODE_OUTPUT);
2151 $xml.= $link_xml;
2152 $xml.="</dummy>";
2153 }
2154
2155 //echo htmlentities($xml); exit;
2156
2157 // todo: utf-header should be set globally
2158 //header('Content-type: text/html; charset=UTF-8');
2159
2160 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
2161 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
2162 $xh = xslt_create();
2163
2164 //echo "<b>XML:</b>".htmlentities($xml);
2165 // determine target frames for internal links
2166 //$pg_frame = $_GET["frame"];
2167 if (!$this->offlineMode()) {
2168 $wb_path = ilUtil::getWebspaceDir("output") . "/";
2169 } else {
2170 $wb_path = "";
2171 }
2172
2173 $mode = ($_GET["cmd"] == "fullscreen")
2174 ? "fullscreen"
2175 : "media";
2176 $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output", $this->offlineMode());
2177 $fullscreen_link =
2178 $this->getLink($this->lm->getRefId(), "fullscreen");
2179 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
2180 'link_params' => "ref_id=" . $this->lm->getRefId(),'fullscreen_link' => $fullscreen_link,
2181 'ref_id' => $this->lm->getRefId(), 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
2182 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
2183 echo xslt_error($xh);
2184 xslt_free($xh);
2185
2186 // unmask user html
2187 $this->tpl->setVariable("MEDIA_CONTENT", $output);
2188
2189 // add js
2190 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
2192 }
2193
2197 public function ilJavaScript($a_inline = "", $a_file = "", $a_location = "")
2198 {
2199 if ($a_inline != "") {
2200 $js_tpl = new ilTemplate($a_inline, true, false, $a_location);
2201 $js = $js_tpl->get();
2202 $this->tpl->setVariable("INLINE_JS", $js);
2203 }
2204 }
2205
2212 public function getSuccessorPage()
2213 {
2215
2216 $page_id = $this->getCurrentPageId();
2217
2218 if (empty($page_id)) {
2219 return 0;
2220 }
2221
2222 // determine successor page_id
2223 $found = false;
2224
2225 // empty chapter
2226 if ($this->chapter_has_no_active_page &&
2227 ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
2228 $c_id = $_GET["obj_id"];
2229 } else {
2230 if ($this->deactivated_page) {
2231 $c_id = $_GET["obj_id"];
2232 } else {
2233 $c_id = $page_id;
2234 }
2235 }
2236 while (!$found) {
2237 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
2238 $c_id = $succ_node["obj_id"];
2239
2240 $active = ilLMPage::_lookupActive(
2241 $c_id,
2242 $this->lm->getType(),
2243 $this->lm_set->get("time_scheduled_page_activation")
2244 );
2245
2246 if ($succ_node["obj_id"] > 0 &&
2247 $ilUser->getId() == ANONYMOUS_USER_ID &&
2248 ($this->lm->getPublicAccessMode() == "selected" &&
2249 !ilLMObject::_isPagePublic($succ_node["obj_id"]))) {
2250 $found = false;
2251 } elseif ($succ_node["obj_id"] > 0 && !$active) {
2252 // look, whether activation data should be shown
2253 $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType());
2254 if ($act_data["show_activation_info"] &&
2255 (ilUtil::now() < $act_data["activation_start"])) {
2256 $found = true;
2257 } else {
2258 $found = false;
2259 }
2260 } else {
2261 $found = true;
2262 }
2263 }
2264
2265 if ($found) {
2266 return $succ_node["obj_id"];
2267 }
2268 return 0;
2269 }
2270
2271
2276 public function ilLMNavigation()
2277 {
2279
2280 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
2281
2282 include_once("./Services/Accessibility/classes/class.ilAccessKeyGUI.php");
2283
2284 $page_id = $this->getCurrentPageId();
2285
2286 if (empty($page_id)) {
2287 return;
2288 }
2289
2290 // process navigation for free page
2291 if (!$this->lm_tree->isInTree($page_id)) {
2292 if ($this->offlineMode() || $_GET["back_pg"] == "") {
2293 return;
2294 }
2295 $limpos = strpos($_GET["back_pg"], ":");
2296 if ($limpos > 0) {
2297 $back_pg = substr($_GET["back_pg"], 0, $limpos);
2298 } else {
2299 $back_pg = $_GET["back_pg"];
2300 }
2301 if (!$this->lm->cleanFrames()) {
2302 $back_href =
2303 $this->getLink(
2304 $this->lm->getRefId(),
2305 "layout",
2306 $back_pg,
2307 $_GET["frame"],
2308 "",
2309 "reduce"
2310 );
2311 $back_target = "";
2312 } else {
2313 $back_href =
2314 $this->getLink(
2315 $this->lm->getRefId(),
2316 "layout",
2317 $back_pg,
2318 "",
2319 "",
2320 "reduce"
2321 );
2322 $back_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
2323 }
2324 $back_img =
2325 ilUtil::getImagePath("nav_arr2_L.png", false, "output", $this->offlineMode());
2326 $this->tpl->setCurrentBlock("ilLMNavigation_Prev");
2327 $this->tpl->setVariable("IMG_PREV", $back_img);
2328 $this->tpl->setVariable("HREF_PREV", $back_href);
2329 $this->tpl->setVariable("FRAME_PREV", $back_target);
2330 $this->tpl->setVariable("TXT_PREV", $this->lng->txt("back"));
2331 $this->tpl->setVariable("ALT_PREV", $this->lng->txt("back"));
2332 $this->tpl->setVariable(
2333 "PREV_ACC_KEY",
2335 );
2336 $this->tpl->setVariable("SPACER_PREV", $this->offlineMode()
2337 ? "images/spacer.png"
2338 : ilUtil::getImagePath("spacer.png"));
2339 $this->tpl->parseCurrentBlock();
2340 $this->tpl->setCurrentBlock("ilLMNavigation_Prev2");
2341 $this->tpl->setVariable("IMG_PREV2", $back_img);
2342 $this->tpl->setVariable("HREF_PREV2", $back_href);
2343 $this->tpl->setVariable("FRAME_PREV2", $back_target);
2344 $this->tpl->setVariable("TXT_PREV2", $this->lng->txt("back"));
2345 $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("back"));
2346 $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode()
2347 ? "images/spacer.png"
2348 : ilUtil::getImagePath("spacer.png"));
2349 $this->tpl->parseCurrentBlock();
2350 return;
2351 }
2352
2353 // determine successor page_id
2354 $found = false;
2355
2356 // empty chapter
2357 if ($this->chapter_has_no_active_page &&
2358 ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
2359 $c_id = $_GET["obj_id"];
2360 } else {
2361 if ($this->deactivated_page) {
2362 $c_id = $_GET["obj_id"];
2363 } else {
2364 $c_id = $page_id;
2365 }
2366 }
2367 while (!$found) {
2368 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
2369 $c_id = $succ_node["obj_id"];
2370
2371 $active = ilLMPage::_lookupActive(
2372 $c_id,
2373 $this->lm->getType(),
2374 $this->lm_set->get("time_scheduled_page_activation")
2375 );
2376
2377 if ($succ_node["obj_id"] > 0 &&
2378 $ilUser->getId() == ANONYMOUS_USER_ID &&
2379 ($this->lm->getPublicAccessMode() == "selected" &&
2380 !ilLMObject::_isPagePublic($succ_node["obj_id"]))) {
2381 $found = false;
2382 } elseif ($succ_node["obj_id"] > 0 && !$active) {
2383 // look, whether activation data should be shown
2384 $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType());
2385 if ($act_data["show_activation_info"] &&
2386 (ilUtil::now() < $act_data["activation_start"])) {
2387 $found = true;
2388 } else {
2389 $found = false;
2390 }
2391 } else {
2392 $found = true;
2393 }
2394 }
2395
2396 $succ_str = ($succ_node !== false)
2397 ? " -> " . $succ_node["obj_id"] . "_" . $succ_node["type"]
2398 : "";
2399
2400 // determine predecessor page id
2401 $found = false;
2402 if ($this->deactivated_page) {
2403 $c_id = $_GET["obj_id"];
2404 } else {
2405 $c_id = $page_id;
2406 }
2407 while (!$found) {
2408 $pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg");
2409 $c_id = $pre_node["obj_id"];
2410 $active = ilLMPage::_lookupActive(
2411 $c_id,
2412 $this->lm->getType(),
2413 $this->lm_set->get("time_scheduled_page_activation")
2414 );
2415 if ($pre_node["obj_id"] > 0 &&
2416 $ilUser->getId() == ANONYMOUS_USER_ID &&
2417 ($this->lm->getPublicAccessMode() == "selected" &&
2418 !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
2419 $found = false;
2420 } elseif ($pre_node["obj_id"] > 0 && !$active) {
2421 // look, whether activation data should be shown
2422 $act_data = ilLMPage::_lookupActivationData((int) $pre_node["obj_id"], $this->lm->getType());
2423 if ($act_data["show_activation_info"] &&
2424 (ilUtil::now() < $act_data["activation_start"])) {
2425 $found = true;
2426 } else {
2427 $found = false;
2428 }
2429 } else {
2430 $found = true;
2431 }
2432 }
2433
2434 $pre_str = ($pre_node !== false)
2435 ? $pre_node["obj_id"] . "_" . $pre_node["type"] . " -> "
2436 : "";
2437
2438 // determine target frame
2439 $framestr = (!empty($_GET["frame"]))
2440 ? "frame=" . $_GET["frame"] . "&"
2441 : "";
2442
2443
2444 // Determine whether the view of a learning resource should
2445 // be shown in the frameset of ilias, or in a separate window.
2446 $showViewInFrameset = true;
2447
2448 if ($pre_node != "") {
2449 // get presentation title
2451 $pre_node["obj_id"],
2452 $this->lm->getPageHeader(),
2453 $this->lm->isActiveNumbering(),
2454 $this->lm_set->get("time_scheduled_page_activation"),
2455 false,
2456 0,
2457 $this->lang,
2458 true
2459 );
2460 $prev_title = ilUtil::shortenText($prev_title, 50, true);
2461 $prev_img =
2462 ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offlineMode());
2463
2464 if (!$this->lm->cleanFrames()) {
2465 $prev_href =
2466 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"], $_GET["frame"]);
2467 $prev_target = "";
2468 } elseif ($showViewInFrameset && !$this->offlineMode()) {
2469 $prev_href =
2470 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
2471 $prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
2472 } else {
2473 $prev_href =
2474 $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
2475 $prev_target = 'target="_top" ';
2476 }
2477
2478 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2479 ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
2480 $output = $this->lng->txt("msg_page_not_public");
2481 }
2482
2483 $this->tpl->setCurrentBlock("ilLMNavigation_Prev");
2484 $this->tpl->setVariable("IMG_PREV", $prev_img);
2485 $this->tpl->setVariable("HREF_PREV", $prev_href);
2486 $this->tpl->setVariable("FRAME_PREV", $prev_target);
2487 $this->tpl->setVariable("TXT_PREV", $prev_title);
2488 $this->tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
2489 $this->tpl->setVariable("SPACER_PREV", $this->offlineMode()
2490 ? "images/spacer.png"
2491 : ilUtil::getImagePath("spacer.png"));
2492 $this->tpl->setVariable(
2493 "PREV_ACC_KEY",
2495 );
2496 $this->tpl->parseCurrentBlock();
2497 $this->tpl->setCurrentBlock("ilLMNavigation_Prev2");
2498 $this->tpl->setVariable("IMG_PREV2", $prev_img);
2499 $this->tpl->setVariable("HREF_PREV2", $prev_href);
2500 $this->tpl->setVariable("FRAME_PREV2", $prev_target);
2501 $this->tpl->setVariable("TXT_PREV2", $prev_title);
2502 $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("previous"));
2503 $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode()
2504 ? "images/spacer.png"
2505 : ilUtil::getImagePath("spacer.png"));
2506 $this->tpl->parseCurrentBlock();
2507 }
2508 if ($succ_node != "") {
2509 // get presentation title
2511 $succ_node["obj_id"],
2512 $this->lm->getPageHeader(),
2513 $this->lm->isActiveNumbering(),
2514 $this->lm_set->get("time_scheduled_page_activation"),
2515 false,
2516 0,
2517 $this->lang,
2518 true
2519 );
2520 $succ_title = ilUtil::shortenText($succ_title, 50, true);
2521 $succ_img =
2522 ilUtil::getImagePath("nav_arr_R.png", false, "output", $this->offlineMode());
2523 if (!$this->lm->cleanFrames()) {
2524 $succ_href =
2525 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]);
2526 $succ_target = "";
2527 } elseif ($showViewInFrameset && !$this->offlineMode()) {
2528 $succ_href =
2529 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]);
2530 $succ_target = ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
2531 } else {
2532 $succ_href =
2533 $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]);
2534 $succ_target = ' target="_top" ';
2535 }
2536
2537 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2538 ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
2539 $output = $this->lng->txt("msg_page_not_public");
2540 }
2541
2542 $this->tpl->setCurrentBlock("ilLMNavigation_Next");
2543 $this->tpl->setVariable("IMG_SUCC", $succ_img);
2544 $this->tpl->setVariable("HREF_SUCC", $succ_href);
2545 $this->tpl->setVariable("FRAME_SUCC", $succ_target);
2546 $this->tpl->setVariable("TXT_SUCC", $succ_title);
2547 $this->tpl->setVariable("ALT_SUCC", $this->lng->txt("next"));
2548 $this->tpl->setVariable("SPACER_SUCC", $this->offlineMode()
2549 ? "images/spacer.png"
2550 : ilUtil::getImagePath("spacer.png"));
2551 $this->tpl->setVariable(
2552 "NEXT_ACC_KEY",
2554 );
2555 $this->tpl->parseCurrentBlock();
2556 $this->tpl->setCurrentBlock("ilLMNavigation_Next2");
2557 $this->tpl->setVariable("IMG_SUCC2", $succ_img);
2558 $this->tpl->setVariable("HREF_SUCC2", $succ_href);
2559 $this->tpl->setVariable("FRAME_SUCC2", $succ_target);
2560 $this->tpl->setVariable("TXT_SUCC2", $succ_title);
2561 $this->tpl->setVariable("ALT_SUCC2", $this->lng->txt("next"));
2562 $this->tpl->setVariable("SPACER_SUCC2", $this->offlineMode()
2563 ? "images/spacer.png"
2564 : ilUtil::getImagePath("spacer.png"));
2565 $this->tpl->parseCurrentBlock();
2566
2567 // check if successor page is not restricted
2568 if (!$this->offlineMode()) {
2569 if ($this->lm->getRestrictForwardNavigation()) {
2570 if ($this->getTracker()->hasPredIncorrectAnswers($succ_node["obj_id"])) {
2571 $this->tpl->addOnLoadCode("$('.ilc_page_rnav_RightNavigation').addClass('ilNoDisplay');");
2572 }
2573 }
2574 }
2575 }
2576 }
2577
2578
2579 public function processNodes(&$a_content, &$a_node)
2580 {
2581 $child_nodes = $a_node->child_nodes();
2582 foreach ($child_nodes as $child) {
2583 if ($child->node_name() == "ilFrame") {
2584 $attributes = $this->attrib2arr($child->attributes());
2585 // node is frameset, if it has cols or rows attribute
2586 if ((!empty($attributes["rows"])) || (!empty($attrubtes["cols"]))) {
2587 // if framset has name, another http request is necessary
2588 // (html framesets don't have names, so we need a wrapper frame)
2589 if (!empty($attributes["name"])) {
2590 unset($attributes["template"]);
2591 unset($attributes["template_location"]);
2592 $attributes["src"] =
2593 $this->getLink(
2594 $this->lm->getRefId(),
2595 "layout",
2596 $_GET["obj_id"],
2597 $attributes["name"],
2598 "",
2599 "keep",
2600 "",
2601 $_GET["srcstring"]
2602 );
2603 $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
2604 $a_content .= $this->buildTag("", "frame", $attributes);
2605 $this->frames[$attributes["name"]] = $attributes["name"];
2606 //echo "<br>processNodes:add1 ".$attributes["name"];
2607 } else { // ok, no name means that we can easily output the frameset tag
2608 $a_content .= $this->buildTag("start", "frameset", $attributes);
2609 $this->processNodes($a_content, $child);
2610 $a_content .= $this->buildTag("end", "frameset");
2611 }
2612 } else { // frame with
2613 unset($attributes["template"]);
2614 unset($attributes["template_location"]);
2615 $attributes["src"] =
2616 $this->getLink(
2617 $this->lm->getRefId(),
2618 "layout",
2619 $_GET["obj_id"],
2620 $attributes["name"],
2621 "",
2622 "keep",
2623 "",
2624 $_GET["srcstring"]
2625 );
2626 $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
2627 if ($attributes["name"] == "toc") {
2628 $attributes["src"].= "#" . $_GET["obj_id"];
2629 } else {
2630 // Handle Anchors
2631 if ($_GET["anchor"] != "") {
2632 $attributes["src"].= "#" . rawurlencode($_GET["anchor"]);
2633 }
2634 }
2635 $a_content .= $this->buildTag("", "frame", $attributes);
2636 $this->frames[$attributes["name"]] = $attributes["name"];
2637 }
2638 }
2639 }
2640 }
2641
2649 public function buildTag($type, $name, $attr="")
2650 {
2651 $tag = "<";
2652
2653 if ($type == "end") {
2654 $tag.= "/";
2655 }
2656
2657 $tag.= $name;
2658
2659 if (is_array($attr)) {
2660 foreach ($attr as $k => $v) {
2661 $tag .= " " . $k . "=\"$v\"";
2662 }
2663 }
2664
2665 if ($type == "") {
2666 $tag.= "/";
2667 }
2668
2669 $tag.= ">\n";
2670
2671 return $tag;
2672 }
2673
2674
2678 public function showTableOfContents()
2679 {
2681
2682 if (!$this->lm->isActiveTOC() || !$this->lm->isActiveLMMenu()) {
2683 return;
2684 }
2685
2686 //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
2687 $this->tpl->setCurrentBlock("ContentStyle");
2688 if (!$this->offlineMode()) {
2689 $this->tpl->setVariable(
2690 "LOCATION_CONTENT_STYLESHEET",
2691 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
2692 );
2693 } else {
2694 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
2695 }
2696 $this->tpl->parseCurrentBlock();
2697
2698 $this->renderPageTitle();
2699
2700 // set style sheets
2701 if (!$this->offlineMode()) {
2702 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2703 } else {
2704 $style_name = $ilUser->getPref("style") . ".css";
2705 ;
2706 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
2707 }
2708
2709 //$this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_toc.html", true);
2710 //var_dump($GLOBALS["tpl"]); echo "<br><br>";
2711 //exit;
2712 $this->tpl->getStandardTemplate();
2713 $this->ilLocator(true);
2714
2715 $a_global_tabs = !$this->offlineMode();
2716
2717 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu(
2718 $this->offlineMode(),
2719 $this->getExportFormat(),
2720 "toc",
2721 $a_global_tabs,
2722 false,
2723 0,
2724 $this->lang,
2725 $this->export_all_languages
2726 ));
2727
2728 // set title header
2729 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
2730 $this->tpl->setTitle($this->getLMPresentationTitle());
2731 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2732
2733 include_once("./Modules/LearningModule/classes/class.ilLMTableOfContentsExplorerGUI.php");
2734 $exp = new ilLMTableOfContentsExplorerGUI($this, "showTableOfContents", $this, $this->lang, $this->export_all_languages);
2735 $exp->setMainTemplate($this->tpl);
2736 $exp->setTracker($this->getTracker());
2737 if (!$exp->handleCommand()) {
2738 // determine highlighted and force open nodes
2739 $page_id = $this->getCurrentPageId();
2740 if ($this->deactivated_page) {
2741 $page_id = $_GET["obj_id"];
2742 }
2743
2744 // highlight current node
2745 if (!$this->offlineMode()) {
2746 // empty chapter
2747 if ($this->chapter_has_no_active_page &&
2748 ilLMObject::_lookupType($_GET["obj_id"]) == "st") {
2749 $exp->setHighlightNode($_GET["obj_id"]);
2750 } else {
2751 if ($this->lm->getTOCMode() == "pages") {
2752 if ($this->deactivated_page) {
2753 $exp->setHighlightNode($_GET["obj_id"]);
2754 } else {
2755 $exp->setHighlightNode($page_id);
2756 }
2757 } else {
2758 $exp->setHighlightNode($this->lm_tree->getParentId($page_id));
2759 }
2760 }
2761 }
2762 if ($this->offlineMode()) {
2763 $exp->setOfflineMode(true);
2764 }
2765 // var_dump($exp->getHTML()."_");
2766 $this->tpl->setVariable("ADM_CONTENT", $exp->getHTML());
2767 }
2768 if ($this->offlineMode()) {
2769 // reset standard css files
2770 $this->tpl->resetJavascript();
2771 $this->tpl->resetCss();
2772 $this->tpl->setBodyClass("ilLMNoMenu");
2773
2774 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
2776 if ($f["type"] == "js") {
2777 $this->tpl->addJavascript($f["target"]);
2778 }
2779 if ($f["type"] == "css") {
2780 $this->tpl->addCSS($f["target"]);
2781 }
2782 }
2783 $this->tpl->fillJavaScriptFiles(true);
2784 $this->tpl->fillOnLoadCode();
2785 //var_dump(htmlentities($this->tpl->get())); exit;
2786 return $this->tpl->get();
2787 } else {
2788 $this->tpl->show();
2789 }
2790 }
2791
2792
2798 public function infoScreen()
2799 {
2800 $this->ctrl->setCmd("showSummary");
2801 $this->ctrl->setCmdClass("ilinfoscreengui");
2802 $this->outputInfoScreen();
2803 }
2804
2808 public function showInfoScreen()
2809 {
2810 $this->outputInfoScreen(true);
2811 }
2812
2813 protected function initScreenHead($a_active_tab = "info")
2814 {
2815 $ilAccess = $this->access;
2816 $ilLocator = $this->locator;
2818
2819 $this->renderPageTitle();
2820
2821 // set style sheets
2822 if (!$this->offlineMode()) {
2823 $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
2824 } else {
2825 $style_name = $ilUser->getPref("style") . ".css";
2826 ;
2827 $this->tpl->setStyleSheetLocation("./" . $style_name);
2828 }
2829
2830 $this->tpl->getStandardTemplate();
2831 $this->tpl->setTitle($this->getLMPresentationTitle());
2832 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2833
2834 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu(
2835 $this->offlineMode(),
2836 $this->getExportFormat(),
2837 $a_active_tab,
2838 true,
2839 false,
2840 0,
2841 $this->lang,
2842 $this->export_all_languages
2843 ));
2844
2845 // Full locator, if read permission is given
2846 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
2847 $this->ilLocator(true);
2848 } else {
2849 $ilLocator->addRepositoryItems();
2850 $this->tpl->setLocator();
2851 }
2852 }
2853
2857 public function outputInfoScreen($a_standard_locator = false)
2858 {
2859 $ilAccess = $this->access;
2860
2861 $this->initScreenHead();
2862
2863 $this->lng->loadLanguageModule("meta");
2864
2865 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
2866
2867 $info = new ilInfoScreenGUI($this->lm_gui);
2868 $info->enablePrivateNotes();
2869 $info->enableLearningProgress();
2870
2871 $info->enableNews();
2872 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
2873 $news_set = new ilSetting("news");
2874 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
2875
2876 $info->enableNewsEditing();
2877
2878 if ($enable_internal_rss) {
2879 $info->setBlockProperty("news", "settings", true);
2880 }
2881 }
2882
2883 // add read / back button
2884 /*
2885 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
2886 {
2887 if ($_GET["obj_id"] > 0)
2888 {
2889 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
2890 $info->addButton($this->lng->txt("back"),
2891 $this->ctrl->getLinkTarget($this, "layout"));
2892 }
2893 else
2894 {
2895 $info->addButton($this->lng->txt("view"),
2896 $this->ctrl->getLinkTarget($this, "layout"));
2897 }
2898 }*/
2899
2900 // show standard meta data section
2901 $info->addMetaDataSections($this->lm->getId(), 0, $this->lm->getType());
2902
2903 if ($this->offlineMode()) {
2904 $this->tpl->setContent($info->getHTML());
2905 return $this->tpl->get();
2906 } else {
2907 // forward the command
2908 $this->ctrl->forwardCommand($info);
2909 //$this->tpl->setContent("aa");
2910 $this->tpl->show();
2911 }
2912 }
2913
2917 public function showPrintViewSelection()
2918 {
2920 $lng = $this->lng;
2921
2922 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
2923 if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
2924 return;
2925 }
2926
2927 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
2928
2929 //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
2930 $this->tpl->setCurrentBlock("ContentStyle");
2931 if (!$this->offlineMode()) {
2932 $this->tpl->setVariable(
2933 "LOCATION_CONTENT_STYLESHEET",
2934 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
2935 );
2936 } else {
2937 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
2938 }
2939 $this->tpl->parseCurrentBlock();
2940
2941 $this->renderPageTitle();
2942 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
2943 $this->tpl->getStandardTemplate();
2944
2945 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu(
2946 $this->offlineMode(),
2947 $this->getExportFormat(),
2948 "print",
2949 true,
2950 false,
2951 0,
2952 $this->lang,
2953 $this->export_all_languages
2954 ));
2955
2956 $this->ilLocator(true);
2957 $this->tpl->addBlockFile(
2958 "ADM_CONTENT",
2959 "adm_content",
2960 "tpl.lm_print_selection.html",
2961 "Modules/LearningModule"
2962 );
2963
2964 // set title header
2965 $this->tpl->setTitle($this->getLMPresentationTitle());
2966 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2967
2968 /*$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
2969 $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2970 $this->tpl->setVariable("LINK_BACK",
2971 $this->ctrl->getLinkTargetByClass("illmpresentationgui", ""));*/
2972
2973 $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
2974 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this));
2975
2976 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
2977 $nodes = $this->filterNonAccessibleNode($nodes);
2978
2979 if (!is_array($_POST["item"])) {
2980 if ($_GET["obj_id"] != "") {
2981 $_POST["item"][$_GET["obj_id"]] = "y";
2982 } else {
2983 $_POST["item"][1] = "y";
2984 }
2985 }
2986
2988
2989 foreach ($nodes as $node) {
2990
2991 // check page activation
2992 $active = ilLMPage::_lookupActive(
2993 $node["obj_id"],
2994 $this->lm->getType(),
2995 $this->lm_set->get("time_scheduled_page_activation")
2996 );
2997
2998 if ($node["type"] == "pg" &&
2999 !$active) {
3000 continue;
3001 }
3002
3003 $text = $img_scr = $img_alt = "";
3004 $disabled = false;
3005 $checked = false;
3006
3007 switch ($node["type"]) {
3008 // page
3009 case "pg":
3010 $text =
3012 $node["obj_id"],
3013 $this->lm->getPageHeader(),
3014 $this->lm->isActiveNumbering(),
3015 $this->lm_set->get("time_scheduled_page_activation"),
3016 false,
3017 0,
3018 $this->lang
3019 );
3020
3021 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3022 $this->lm_gui->object->getPublicAccessMode() == "selected") {
3023 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
3024 $disabled = true;
3025 $text.= " (" . $this->lng->txt("cont_no_access") . ")";
3026 }
3027 }
3028 $img_src = ilUtil::getImagePath("icon_pg.svg");
3029 $img_alt = $lng->txt("icon") . " " . $lng->txt("pg");
3030 break;
3031
3032 // learning module
3033 case "du":
3034 $text = $this->getLMPresentationTitle();
3035 $img_src = ilUtil::getImagePath("icon_lm.svg");
3036 $img_alt = $lng->txt("icon") . " " . $lng->txt("obj_lm");
3037 break;
3038
3039 // chapter
3040 case "st":
3041 $text =
3043 $node["obj_id"],
3045 $this->lm->isActiveNumbering(),
3046 $this->lm_set->get("time_scheduled_page_activation"),
3047 false,
3048 0,
3049 $this->lang
3050 );
3051 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3052 $this->lm_gui->object->getPublicAccessMode() == "selected") {
3053 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
3054 $disabled = true;
3055 $text.= " (" . $this->lng->txt("cont_no_access") . ")";
3056 }
3057 }
3058 $img_src = ilUtil::getImagePath("icon_st.svg");
3059 $img_alt = $lng->txt("icon") . " " . $lng->txt("st");
3060 break;
3061 }
3062
3063 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
3064 $text.= " (" . $this->lng->txt("cont_no_access") . ")";
3065 }
3066
3067 $this->nl->addListNode(
3068 $node["obj_id"],
3069 $text,
3070 $node["parent"],
3071 $checked,
3072 $disabled,
3073 $img_src,
3074 $img_alt
3075 );
3076 }
3077
3078
3079 // check for free page
3080 if ($_GET["obj_id"] > 0 && !$this->lm_tree->isInTree($_GET["obj_id"])) {
3081 $text =
3083 $_GET["obj_id"],
3084 $this->lm->getPageHeader(),
3085 $this->lm->isActiveNumbering(),
3086 $this->lm_set->get("time_scheduled_page_activation"),
3087 false,
3088 0,
3089 $this->lang
3090 );
3091
3092 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3093 $this->lm_gui->object->getPublicAccessMode() == "selected") {
3094 if (!ilLMObject::_isPagePublic($_GET["obj_id"])) {
3095 $disabled = true;
3096 $text.= " (" . $this->lng->txt("cont_no_access") . ")";
3097 }
3098 }
3099 $img_src = ilUtil::getImagePath("icon_pg.svg");
3100 $id = $_GET["obj_id"];
3101
3102 $checked = true;
3103
3104 $this->nl->addListNode(
3105 $id,
3106 $text,
3107 0,
3108 $checked,
3109 $disabled,
3110 $img_src,
3111 $img_alt
3112 );
3113 }
3114
3115 $f = $this->form->getHTML();
3116
3117 // submit toolbar
3118 $tb = new ilToolbarGUI();
3119 $tb->addFormButton($lng->txt("cont_show_print_view"), "showPrintView");
3120 $this->tpl->setVariable("TOOLBAR", $tb->getHTML());
3121
3122 $this->tpl->setVariable("ITEM_SELECTION", $f);
3123 $this->tpl->show();
3124 }
3125
3130 protected function filterNonAccessibleNode($nodes)
3131 {
3132 $tracker = $this->getTracker();
3133 // if navigation is restricted based on correct answered questions
3134 // check if we have preceeding pages including unsanswered/incorrect answered questions
3135 if (!$this->offlineMode()) {
3136 if ($this->lm->getRestrictForwardNavigation()) {
3137 $nodes = array_filter($nodes, function ($node) use ($tracker) {
3138 return !$tracker->hasPredIncorrectAnswers($node["child"]);
3139 });
3140 }
3141 }
3142 return $nodes;
3143 }
3144
3145
3150 {
3151 $lng = $this->lng;
3153
3154 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
3155 $this->form = new ilPropertyFormGUI();
3156
3157 // selection type
3158 $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
3159 $radg->setValue("page");
3160 $op1 = new ilRadioOption($lng->txt("cont_current_page"), "page");
3161 $radg->addOption($op1);
3162 $op2 = new ilRadioOption($lng->txt("cont_current_chapter"), "chapter");
3163 $radg->addOption($op2);
3164 $op3= new ilRadioOption($lng->txt("cont_selected_pg_chap"), "selection");
3165 $radg->addOption($op3);
3166
3167 include_once("./Services/Form/classes/class.ilNestedListInputGUI.php");
3168 $nl = new ilNestedListInputGUI("", "obj_id");
3169 $this->nl = $nl;
3170 $op3->addSubItem($nl);
3171
3172
3173 $this->form->addItem($radg);
3174
3175 $this->form->addCommandButton("showPrintView", $lng->txt("cont_show_print_view"));
3176 $this->form->setOpenTag(false);
3177 $this->form->setCloseTag(false);
3178
3179 $this->form->setTitle($lng->txt("cont_print_selection"));
3180 $this->form->setFormAction($ilCtrl->getFormAction($this));
3181 }
3182
3186 public function showPrintView()
3187 {
3189 $lng = $this->lng;
3191
3192 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
3193
3194 if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
3195 return;
3196 }
3197
3198 $this->renderPageTitle();
3199
3200 $c_obj_id = $this->getCurrentPageId();
3201 // set values according to selection
3202 if ($_POST["sel_type"] == "page") {
3203 if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) {
3204 $_POST["obj_id"][] = $c_obj_id;
3205 }
3206 }
3207 if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) {
3208 $path = $this->lm_tree->getPathFull($c_obj_id);
3209 $chap_id = $path[1]["child"];
3210 if ($chap_id > 0) {
3211 $_POST["obj_id"][] = $chap_id;
3212 }
3213 }
3214
3215 //var_dump($_GET);
3216 //var_dump($_POST);
3217 // set style sheets
3218 if (!$this->offlineMode()) {
3219 $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
3220 } else {
3221 $style_name = $ilUser->getPref("style") . ".css";
3222 ;
3223 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
3224 }
3225
3226 // content style
3227 $this->tpl->setCurrentBlock("ContentStyle");
3228 if (!$this->offlineMode()) {
3229 $this->tpl->setVariable(
3230 "LOCATION_CONTENT_STYLESHEET",
3231 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
3232 );
3233 } else {
3234 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
3235 }
3236 $this->tpl->parseCurrentBlock();
3237
3238 // syntax style
3239 $this->tpl->setCurrentBlock("SyntaxStyle");
3240 $this->tpl->setVariable(
3241 "LOCATION_SYNTAX_STYLESHEET",
3243 );
3244 $this->tpl->parseCurrentBlock();
3245
3246 //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3247 $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true);
3248
3249 // set title header
3250 $this->tpl->setVariable("HEADER", $this->getLMPresentationTitle());
3251
3252 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
3253
3254 include_once("./Modules/LearningModule/classes/class.ilLMPageGUI.php");
3255 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
3256 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
3257
3258 $act_level = 99999;
3259 $activated = false;
3260
3261 $glossary_links = array();
3262 $output_header = false;
3263 $media_links = array();
3264
3265 // get header and footer
3266 if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
3267 if (ilLMObject::_exists($this->lm->getFooterPage())) {
3268 $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage());
3269 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3270 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
3271 $this->lm->getStyleSheetId(),
3272 "lm"
3273 ));
3274
3275
3276 // determine target frames for internal links
3277 $page_object_gui->setLinkFrame($_GET["frame"]);
3278 $page_object_gui->setOutputMode("print");
3279 $page_object_gui->setPresentationTitle("");
3280 $page_object_gui->setFileDownloadLink("#");
3281 $page_object_gui->setFullscreenLink("#");
3282 $page_object_gui->setSourceCodeDownloadScript("#");
3283 $footer_page_content = $page_object_gui->showPage();
3284 }
3285 }
3286 if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
3287 if (ilLMObject::_exists($this->lm->getHeaderPage())) {
3288 $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage());
3289 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3290 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
3291 $this->lm->getStyleSheetId(),
3292 "lm"
3293 ));
3294
3295
3296 // determine target frames for internal links
3297 $page_object_gui->setLinkFrame($_GET["frame"]);
3298 $page_object_gui->setOutputMode("print");
3299 $page_object_gui->setPresentationTitle("");
3300 $page_object_gui->setFileDownloadLink("#");
3301 $page_object_gui->setFullscreenLink("#");
3302 $page_object_gui->setSourceCodeDownloadScript("#");
3303 $header_page_content = $page_object_gui->showPage();
3304 }
3305 }
3306
3307 // add free selected pages
3308 if (is_array($_POST["obj_id"])) {
3309 foreach ($_POST["obj_id"] as $k) {
3310 if ($k > 0 && !$this->lm_tree->isInTree($k)) {
3311 if (ilLMObject::_lookupType($k) == "pg") {
3312 $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true);
3313 }
3314 }
3315 }
3316 } else {
3317 ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true);
3318 $ilCtrl->redirect($this, "showPrintViewSelection");
3319 }
3320
3321 foreach ($nodes as $node_key => $node) {
3322 // check page activation
3323 $active = ilLMPage::_lookupActive(
3324 $node["obj_id"],
3325 $this->lm->getType(),
3326 $this->lm_set->get("time_scheduled_page_activation")
3327 );
3328 if ($node["type"] == "pg" && !$active) {
3329 continue;
3330 }
3331
3332 // print all subchapters/subpages if higher chapter
3333 // has been selected
3334 if ($node["depth"] <= $act_level) {
3335 if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) {
3336 $act_level = $node["depth"];
3337 $activated = true;
3338 } else {
3339 $act_level = 99999;
3340 $activated = false;
3341 }
3342 }
3343 if ($this->lm->getRestrictForwardNavigation()) {
3344 if ($this->getTracker()->hasPredIncorrectAnswers($node["obj_id"])) {
3345 continue;
3346 }
3347 }
3348 if ($activated &&
3349 ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
3350 // output learning module header
3351 if ($node["type"] == "du") {
3352 $output_header = true;
3353 }
3354
3355 // output chapter title
3356 if ($node["type"] == "st") {
3357 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3358 $this->lm_gui->object->getPublicAccessMode() == "selected") {
3359 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
3360 continue;
3361 }
3362 }
3363
3364 $chap = new ilStructureObject($this->lm, $node["obj_id"]);
3365 $this->tpl->setCurrentBlock("print_chapter");
3366
3367 $chapter_title = $chap->_getPresentationTitle(
3368 $node["obj_id"],
3369 $this->lm->isActiveNumbering(),
3370 $this->lm_set->get("time_scheduled_page_activation"),
3371 0,
3372 $this->lang
3373 );
3374 $this->tpl->setVariable(
3375 "CHAP_TITLE",
3376 $chapter_title
3377 );
3378
3379 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) {
3380 if ($nodes[$node_key + 1]["type"] == "pg") {
3381 $this->tpl->setVariable(
3382 "CHAP_HEADER",
3383 $header_page_content
3384 );
3385 $did_chap_page_header = true;
3386 }
3387 }
3388
3389 $this->tpl->parseCurrentBlock();
3390 $this->tpl->setCurrentBlock("print_block");
3391 $this->tpl->parseCurrentBlock();
3392 }
3393
3394 // output page
3395 if ($node["type"] == "pg") {
3396 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
3397 $this->lm_gui->object->getPublicAccessMode() == "selected") {
3398 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
3399 continue;
3400 }
3401 }
3402
3403 $this->tpl->setCurrentBlock("print_item");
3404
3405 // get page
3406 $page_id = $node["obj_id"];
3407 $page_object_gui = $this->getLMPageGUI($page_id);
3408 $page_object = $page_object_gui->getPageObject();
3409 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
3410 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
3411 $this->lm->getStyleSheetId(),
3412 "lm"
3413 ));
3414
3415
3416 // get lm page
3417 $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
3418 $lm_pg_obj->setLMId($this->lm->getId());
3419
3420 // determine target frames for internal links
3421 $page_object_gui->setLinkFrame($_GET["frame"]);
3422 $page_object_gui->setOutputMode("print");
3423 $page_object_gui->setPresentationTitle("");
3424
3425 if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) {
3427 $lm_pg_obj->getId(),
3428 $this->lm->getPageHeader(),
3429 $this->lm->isActiveNumbering(),
3430 $this->lm_set->get("time_scheduled_page_activation"),
3431 false,
3432 0,
3433 $this->lang
3434 );
3435
3436 // prevent page title after chapter title
3437 // that have the same content
3438 if ($this->lm->isActiveNumbering()) {
3439 $chapter_title = trim(substr(
3440 $chapter_title,
3441 strpos($chapter_title, " ")
3442 ));
3443 }
3444
3445 if ($page_title != $chapter_title) {
3446 $page_object_gui->setPresentationTitle($page_title);
3447 }
3448 }
3449
3450 // handle header / footer
3451 $hcont = $header_page_content;
3452 $fcont = $footer_page_content;
3453
3454 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) {
3455 if ($did_chap_page_header) {
3456 $hcont = "";
3457 }
3458 if ($nodes[$node_key + 1]["type"] == "pg" &&
3459 !($nodes[$node_key + 1]["depth"] <= $act_level
3460 && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) {
3461 $fcont = "";
3462 }
3463 }
3464
3465 $page_object_gui->setFileDownloadLink("#");
3466 $page_object_gui->setFullscreenLink("#");
3467 $page_object_gui->setSourceCodeDownloadScript("#");
3468 $page_content = $page_object_gui->showPage();
3469 if ($this->lm->getPageHeader() != IL_PAGE_TITLE) {
3470 $this->tpl->setVariable(
3471 "CONTENT",
3472 $hcont . $page_content . $fcont
3473 );
3474 } else {
3475 $this->tpl->setVariable(
3476 "CONTENT",
3477 $hcont . $page_content . $fcont . "<br />"
3478 );
3479 }
3480 $chapter_title = "";
3481 $this->tpl->parseCurrentBlock();
3482 $this->tpl->setCurrentBlock("print_block");
3483 $this->tpl->parseCurrentBlock();
3484
3485 // get internal links
3486 $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]);
3487
3488 $got_mobs = false;
3489
3490 foreach ($int_links as $key => $link) {
3491 if ($link["type"] == "git" &&
3492 ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
3493 $glossary_links[$key] = $link;
3494 }
3495 if ($link["type"] == "mob" &&
3496 ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
3497 $got_mobs = true;
3498 $mob_links[$key] = $link;
3499 }
3500 }
3501
3502 // this is not cool because of performance reasons
3503 // unfortunately the int link table does not
3504 // store the target frame (we want to append all linked
3505 // images but not inline images (i.e. mobs with no target
3506 // frame))
3507 if ($got_mobs) {
3508 $page_object->buildDom();
3509 $links = $page_object->getInternalLinks();
3510 foreach ($links as $link) {
3511 if ($link["Type"] == "MediaObject"
3512 && $link["TargetFrame"] != ""
3513 && $link["TargetFrame"] != "None") {
3514 $media_links[] = $link;
3515 }
3516 }
3517 }
3518 }
3519 }
3520 }
3521
3522 $annex_cnt = 0;
3523 $annexes = array();
3524
3525 // glossary
3526 if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) {
3527 include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
3528 include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
3529
3530 // sort terms
3531 $terms = array();
3532
3533 foreach ($glossary_links as $key => $link) {
3534 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]);
3535 $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term);
3536 }
3537 $terms = ilUtil::sortArray($terms, "term", "asc");
3538 //ksort($terms);
3539
3540 foreach ($terms as $t) {
3541 $link = $t["link"];
3542 $key = $t["key"];
3543 $defs = ilGlossaryDefinition::getDefinitionList($link["id"]);
3544 $def_cnt = 1;
3545
3546 // output all definitions of term
3547 foreach ($defs as $def) {
3548 // definition + number, if more than 1 definition
3549 if (count($defs) > 1) {
3550 $this->tpl->setCurrentBlock("def_title");
3551 $this->tpl->setVariable(
3552 "TXT_DEFINITION",
3553 $this->lng->txt("cont_definition") . " " . ($def_cnt++)
3554 );
3555 $this->tpl->parseCurrentBlock();
3556 }
3557 include_once("./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php");
3558 $page_gui = new ilGlossaryDefPageGUI($def["id"]);
3559 $page_gui->setTemplateOutput(false);
3560 $page_gui->setOutputMode("print");
3561
3562 $this->tpl->setCurrentBlock("definition");
3563 $page_gui->setFileDownloadLink("#");
3564 $page_gui->setFullscreenLink("#");
3565 $page_gui->setSourceCodeDownloadScript("#");
3566 $output = $page_gui->showPage();
3567 $this->tpl->setVariable("VAL_DEFINITION", $output);
3568 $this->tpl->parseCurrentBlock();
3569 }
3570
3571 // output term
3572 $this->tpl->setCurrentBlock("term");
3573 $this->tpl->setVariable(
3574 "VAL_TERM",
3575 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])
3576 );
3577 $this->tpl->parseCurrentBlock();
3578 }
3579
3580 // output glossary header
3581 $annex_cnt++;
3582 $this->tpl->setCurrentBlock("glossary");
3583 $annex_title = $this->lng->txt("cont_annex") . " " .
3584 chr(64+$annex_cnt) . ": " . $this->lng->txt("glo");
3585 $this->tpl->setVariable("TXT_GLOSSARY", $annex_title);
3586 $this->tpl->parseCurrentBlock();
3587
3588 $annexes[] = $annex_title;
3589 }
3590
3591 // referenced images
3592 if (count($media_links) > 0) {
3593 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3594 include_once("./Services/MediaObjects/classes/class.ilMediaItem.php");
3595
3596 foreach ($media_links as $media) {
3597 if (substr($media["Target"], 0, 4) == "il__") {
3598 $arr = explode("_", $media["Target"]);
3599 $id = $arr[count($arr) - 1];
3600
3601 $med_obj = new ilObjMediaObject($id);
3602 $med_item = $med_obj->getMediaItem("Standard");
3603 if (is_object($med_item)) {
3604 if (is_int(strpos($med_item->getFormat(), "image"))) {
3605 $this->tpl->setCurrentBlock("ref_image");
3606
3607 // image source
3608 if ($med_item->getLocationType() == "LocalFile") {
3609 $this->tpl->setVariable(
3610 "IMG_SOURCE",
3611 ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id .
3612 "/" . $med_item->getLocation()
3613 );
3614 } else {
3615 $this->tpl->setVariable(
3616 "IMG_SOURCE",
3617 $med_item->getLocation()
3618 );
3619 }
3620
3621 if ($med_item->getCaption() != "") {
3622 $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption());
3623 } else {
3624 $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
3625 }
3626 $this->tpl->parseCurrentBlock();
3627 }
3628 }
3629 }
3630 }
3631
3632 // output glossary header
3633 $annex_cnt++;
3634 $this->tpl->setCurrentBlock("ref_images");
3635 $annex_title = $this->lng->txt("cont_annex") . " " .
3636 chr(64+$annex_cnt) . ": " . $this->lng->txt("cont_ref_images");
3637 $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title);
3638 $this->tpl->parseCurrentBlock();
3639
3640 $annexes[] = $annex_title;
3641 }
3642
3643 // output learning module title and toc
3644 if ($output_header) {
3645 $this->tpl->setCurrentBlock("print_header");
3646 $this->tpl->setVariable("LM_TITLE", $this->getLMPresentationTitle());
3647 if ($this->lm->getDescription() != "none") {
3648 include_once("Services/MetaData/classes/class.ilMD.php");
3649 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
3650 $md_gen = $md->getGeneral();
3651 foreach ($md_gen->getDescriptionIds() as $id) {
3652 $md_des = $md_gen->getDescription($id);
3653 $description = $md_des->getDescription();
3654 }
3655
3656 $this->tpl->setVariable(
3657 "LM_DESCRIPTION",
3659 );
3660 }
3661 $this->tpl->parseCurrentBlock();
3662
3663 // output toc
3664 $nodes2 = $nodes;
3665 foreach ($nodes2 as $node2) {
3666 if ($node2["type"] == "st"
3667 && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) {
3668 for ($j=1; $j < $node2["depth"]; $j++) {
3669 $this->tpl->setCurrentBlock("indent");
3670 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
3671 $this->tpl->parseCurrentBlock();
3672 }
3673 $this->tpl->setCurrentBlock("toc_entry");
3674 $this->tpl->setVariable(
3675 "TXT_TOC_TITLE",
3677 $node2["obj_id"],
3679 $this->lm->isActiveNumbering(),
3680 $this->lm_set->get("time_scheduled_page_activation"),
3681 false,
3682 0,
3683 $this->lang
3684 )
3685 );
3686 $this->tpl->parseCurrentBlock();
3687 }
3688 }
3689
3690 // annexes
3691 foreach ($annexes as $annex) {
3692 $this->tpl->setCurrentBlock("indent");
3693 $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
3694 $this->tpl->parseCurrentBlock();
3695 $this->tpl->setCurrentBlock("toc_entry");
3696 $this->tpl->setVariable("TXT_TOC_TITLE", $annex);
3697 $this->tpl->parseCurrentBlock();
3698 }
3699
3700 $this->tpl->setCurrentBlock("toc");
3701 $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
3702 $this->tpl->parseCurrentBlock();
3703
3704 $this->tpl->setCurrentBlock("print_start_block");
3705 $this->tpl->parseCurrentBlock();
3706 }
3707
3708 // output author information
3709 include_once 'Services/MetaData/classes/class.ilMD.php';
3710 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
3711 if (is_object($lifecycle = $md->getLifecycle())) {
3712 $sep = $author = "";
3713 foreach (($ids = $lifecycle->getContributeIds()) as $con_id) {
3714 $md_con = $lifecycle->getContribute($con_id);
3715 if ($md_con->getRole() == "Author") {
3716 foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
3717 $md_ent = $md_con->getEntity($ent_id);
3718 $author = $author . $sep . $md_ent->getEntity();
3719 $sep = ", ";
3720 }
3721 }
3722 }
3723 if ($author != "") {
3724 $this->lng->loadLanguageModule("meta");
3725 $this->tpl->setCurrentBlock("author");
3726 $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
3727 $this->tpl->setVariable("LM_AUTHOR", $author);
3728 $this->tpl->parseCurrentBlock();
3729 }
3730 }
3731
3732
3733 // output copyright information
3734 if (is_object($md_rights = $md->getRights())) {
3735 $copyright = $md_rights->getDescription();
3736 include_once('Services/MetaData/classes/class.ilMDUtils.php');
3737 $copyright = ilMDUtils::_parseCopyright($copyright);
3738
3739 if ($copyright != "") {
3740 $this->lng->loadLanguageModule("meta");
3741 $this->tpl->setCurrentBlock("copyright");
3742 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
3743 $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
3744 $this->tpl->parseCurrentBlock();
3745 }
3746 }
3747
3748 $this->tpl->show(false);
3749 }
3750
3754 public function downloadFile()
3755 {
3756 $page_gui = $this->getLMPageGUI($this->getCurrentPageId());
3757 $page_gui->downloadFile();
3758 }
3759
3760
3764 public function download_paragraph()
3765 {
3766 require_once("./Modules/LearningModule/classes/class.ilLMPage.php");
3767 $pg_obj = $this->getLMPage($_GET["pg_id"]);
3768 $pg_obj->send_paragraph($_GET["par_id"], $_GET["downloadtitle"]);
3769 }
3770
3774 public function showDownloadList()
3775 {
3776 if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
3777 return;
3778 }
3779
3780 //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
3781 $this->tpl->setCurrentBlock("ContentStyle");
3782 if (!$this->offlineMode()) {
3783 $this->tpl->setVariable(
3784 "LOCATION_CONTENT_STYLESHEET",
3785 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
3786 );
3787 } else {
3788 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
3789 }
3790 $this->tpl->parseCurrentBlock();
3791
3792 $this->renderPageTitle();
3793 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
3794 $this->tpl->getStandardTemplate();
3795
3796 $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu(
3797 $this->offlineMode(),
3798 $this->getExportFormat(),
3799 "download",
3800 true,
3801 false,
3802 0,
3803 $this->lang,
3804 $this->export_all_languages
3805 ));
3806
3807 $this->ilLocator(true);
3808 //$this->tpl->stopTitleFloating();
3809 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
3810
3811 // set title header
3812 $this->tpl->setTitle($this->getLMPresentationTitle());
3813 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
3814
3815 /*
3816 $this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
3817 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
3818 $this->tpl->setVariable("LINK_BACK",
3819 $this->ctrl->getLinkTarget($this, "")); */
3820
3821 // output copyright information
3822 include_once 'Services/MetaData/classes/class.ilMD.php';
3823 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
3824 if (is_object($md_rights = $md->getRights())) {
3825 $copyright = $md_rights->getDescription();
3826
3827 include_once('Services/MetaData/classes/class.ilMDUtils.php');
3828 $copyright = ilMDUtils::_parseCopyright($copyright);
3829
3830 if ($copyright != "") {
3831 $this->lng->loadLanguageModule("meta");
3832 $this->tpl->setCurrentBlock("copyright");
3833 $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
3834 $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
3835 $this->tpl->parseCurrentBlock();
3836 }
3837 }
3838
3839
3840 include_once("./Modules/LearningModule/classes/class.ilLMDownloadTableGUI.php");
3841 $download_table = new ilLMDownloadTableGUI($this, "showDownloadList", $this->lm);
3842 $this->tpl->setVariable("DOWNLOAD_TABLE", $download_table->getHTML());
3843 $this->tpl->show();
3844 }
3845
3846
3850 public function downloadExportFile()
3851 {
3852 if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
3853 return;
3854 }
3855
3856 $base_type = explode("_", $_GET["type"]);
3857 $base_type = $base_type[0];
3858 $file = $this->lm->getPublicExportFile($base_type);
3859 if ($this->lm->getPublicExportFile($base_type) != "") {
3860 $dir = $this->lm->getExportDirectory($_GET["type"]);
3861 if (is_file($dir . "/" . $file)) {
3862 ilUtil::deliverFile($dir . "/" . $file, $file);
3863 exit;
3864 }
3865 }
3866 }
3867
3877 public function getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
3878 {
3879 return "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=" . $a_ref_id . "&amp;obj_id=" . $a_obj_id . "&amp;focus_id=" .
3880 $a_obj_id . "&amp;focus_return=" . $a_return_ref_id;
3881 }
3882
3883
3887 public function getLink(
3888 $a_ref_id,
3889 $a_cmd = "",
3890 $a_obj_id = "",
3891 $a_frame = "",
3892 $a_type = "",
3893 $a_back_link = "append",
3894 $a_anchor = "",
3895 $a_srcstring = ""
3896 ) {
3898
3899 if ($a_cmd == "") {
3900 $a_cmd = "layout";
3901 }
3902
3903 // handling of free pages
3904 $cur_page_id = $this->getCurrentPageId();
3905 $back_pg = $_GET["back_pg"];
3906 if ($a_obj_id != "" && !$this->lm_tree->isInTree($a_obj_id) && $cur_page_id != "" &&
3907 $a_back_link == "append") {
3908 if ($back_pg != "") {
3909 $back_pg = $cur_page_id . ":" . $back_pg;
3910 } else {
3911 $back_pg = $cur_page_id;
3912 }
3913 } else {
3914 if ($a_back_link == "reduce") {
3915 $limpos = strpos($_GET["back_pg"], ":");
3916
3917 if ($limpos > 0) {
3918 $back_pg = substr($back_pg, strpos($back_pg, ":") + 1);
3919 } else {
3920 $back_pg = "";
3921 }
3922 } elseif ($a_back_link != "keep") {
3923 $back_pg = "";
3924 }
3925 }
3926
3927 // handle online links
3928 if (!$this->offlineMode()) {
3929 if ($_GET["from_page"] == "") {
3930 // added if due to #23216 (from page has been set in lots of usual navigation links)
3931 if (!in_array($a_frame, array("", "_blank"))) {
3932 $this->ctrl->setParameter($this, "from_page", $cur_page_id);
3933 }
3934 } else {
3935 // faq link on page (in faq frame) includes faq link on other page
3936 // if added due to bug #11007
3937 if (!in_array($a_frame, array("", "_blank"))) {
3938 $this->ctrl->setParameter($this, "from_page", $_GET["from_page"]);
3939 }
3940 }
3941
3942 if ($a_anchor != "") {
3943 $this->ctrl->setParameter($this, "anchor", rawurlencode($a_anchor));
3944 }
3945 if ($a_srcstring != "") {
3946 $this->ctrl->setParameter($this, "srcstring", $a_srcstring);
3947 }
3948 switch ($a_cmd) {
3949 case "fullscreen":
3950 $link = $this->ctrl->getLinkTarget($this, "fullscreen", "", false, false);
3951 break;
3952
3953 default:
3954
3955 if ($back_pg != "") {
3956 $this->ctrl->setParameter($this, "back_pg", $back_pg);
3957 }
3958 if ($a_frame != "") {
3959 $this->ctrl->setParameter($this, "frame", $a_frame);
3960 }
3961 if ($a_obj_id != "") {
3962 switch ($a_type) {
3963 case "MediaObject":
3964 $this->ctrl->setParameter($this, "mob_id", $a_obj_id);
3965 break;
3966
3967 default:
3968 $this->ctrl->setParameter($this, "obj_id", $a_obj_id);
3969 $link.= "&amp;obj_id=" . $a_obj_id;
3970 break;
3971 }
3972 }
3973 if ($a_type != "") {
3974 $this->ctrl->setParameter($this, "obj_type", $a_type);
3975 }
3976 $link = $this->ctrl->getLinkTarget($this, $a_cmd, $a_anchor);
3977// $link = str_replace("&", "&amp;", $link);
3978
3979 $this->ctrl->setParameter($this, "frame", "");
3980 $this->ctrl->setParameter($this, "obj_id", "");
3981 $this->ctrl->setParameter($this, "mob_id", "");
3982 break;
3983 }
3984 } else { // handle offline links
3985 $lang_suffix = "";
3986 if ($this->export_all_languages) {
3987 if ($this->lang != "" && $this->lang != "-") {
3988 $lang_suffix = "_" . $this->lang;
3989 }
3990 }
3991
3992 switch ($a_cmd) {
3993 case "downloadFile":
3994 break;
3995
3996 case "fullscreen":
3997 $link = "fullscreen.html"; // id is handled by xslt
3998 break;
3999
4000 case "layout":
4001
4002 if ($a_obj_id == "") {
4003 $a_obj_id = $this->lm_tree->getRootId();
4004 $pg_node = $this->lm_tree->fetchSuccessorNode($a_obj_id, "pg");
4005 $a_obj_id = $pg_node["obj_id"];
4006 }
4007 if ($a_type == "StructureObject") {
4008 $pg_node = $this->lm_tree->fetchSuccessorNode($a_obj_id, "pg");
4009 $a_obj_id = $pg_node["obj_id"];
4010 }
4011 if ($a_frame != "" && $a_frame != "_blank") {
4012 if ($a_frame != "toc") {
4013 $link = "frame_" . $a_obj_id . "_" . $a_frame . $lang_suffix . ".html";
4014 } else { // don't save multiple toc frames (all the same)
4015 $link = "frame_" . $a_frame . $lang_suffix . ".html";
4016 }
4017 } else {
4018 //if ($nid = ilLMObject::_lookupNID($this->lm->getId(), $a_obj_id, "pg"))
4019 if ($nid = ilLMPageObject::getExportId($this->lm->getId(), $a_obj_id)) {
4020 $link = "lm_pg_" . $nid . $lang_suffix . ".html";
4021 } else {
4022 $link = "lm_pg_" . $a_obj_id . $lang_suffix . ".html";
4023 }
4024 }
4025 break;
4026
4027 case "glossary":
4028 $link = "term_" . $a_obj_id . ".html";
4029 break;
4030
4031 case "media":
4032 $link = "media_" . $a_obj_id . ".html";
4033 break;
4034
4035 default:
4036 break;
4037 }
4038 }
4039
4040 $this->ctrl->clearParameters($this);
4041
4042 return $link;
4043 }
4044
4052 {
4053 // content style
4054 $this->tpl->setCurrentBlock("ContentStyle");
4055 if (!$this->offlineMode()) {
4056 $this->tpl->setVariable(
4057 "LOCATION_CONTENT_STYLESHEET",
4058 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())
4059 );
4060 } else {
4061 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
4062 }
4063 $this->tpl->parseCurrentBlock();
4064
4065 $tpl = new ilTemplate("tpl.page_message_screen.html", true, true, "Modules/LearningModule");
4066 $tpl->setVariable("TXT_PAGE_NO_PUBLIC_ACCESS", $a_content);
4067
4068 $this->tpl->setVariable("PAGE_CONTENT", $tpl->get());
4069 }
4070
4071
4075 public function showNoPublicAccess()
4076 {
4077 $this->showMessageScreen($this->lng->txt("msg_page_no_public_access"));
4078 }
4079
4083 public function showNoPageAccess()
4084 {
4085 $this->showMessageScreen($this->lng->txt("msg_no_page_access"));
4086 }
4087
4093 {
4094 $this->showMessageScreen($this->lng->txt("cont_no_page_access_unansw_q"));
4095 }
4096
4097
4099 {
4100 if (!$this->offlineMode()) {
4101 //$this->ctrl->setParameter($this, session_name(), session_id());
4102 $target = $this->ctrl->getLinkTarget($this, "");
4103 $target = ilUtil::appendUrlParameterString($target, session_name() . "=" . session_id());
4104 return $this->ctrl->getLinkTarget($this, "");
4105 } else {
4106 return "";
4107 }
4108 }
4109
4117 public function setOfflineDirectory($offdir)
4118 {
4119 $this->offline_directory = $offdir;
4120 }
4121
4122
4129 public function getOfflineDirectory()
4130 {
4132 }
4133
4138 public function handleCodeParagraph($page_id, $paragraph_id, $title, $text)
4139 {
4140 $directory = $this->getOfflineDirectory() . "/codefiles/" . $page_id . "/" . $paragraph_id;
4141 ilUtil::makeDirParents($directory);
4142 $file = $directory . "/" . $title;
4143 if (!($fp = @fopen($file, "w+"))) {
4144 die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
4145 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
4146 }
4147 chmod($file, 0770);
4148 fwrite($fp, $text);
4149 fclose($fp);
4150 }
4151
4152 // #8613
4153 protected function renderPageTitle()
4154 {
4155 $this->tpl->setHeaderPageTitle($this->getLMPresentationTitle());
4156 $this->tpl->fillWindowTitle();
4157 $this->tpl->fillContentLanguage();
4158 }
4159
4160
4167 public function getLMPageGUI($a_id)
4168 {
4169 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
4170 include_once("./Modules/LearningModule/classes/class.ilLMPageGUI.php");
4171 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
4172 return new ilLMPageGUI($a_id, 0, false, $this->lang);
4173 }
4174 return new ilLMPageGUI($a_id);
4175 }
4176
4183 public function getLMPage($a_id)
4184 {
4185 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
4186 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
4187 return new ilLMPage($a_id, 0, $this->lang);
4188 }
4189 return new ilLMPage($a_id);
4190 }
4191
4195 public function refreshToc()
4196 {
4197 $exp = $this->ilTOC(true);
4198
4199 echo $exp->getHTML() .
4200 "<script>" . $exp->getOnLoadCode() . "</script>";
4201 exit;
4202 }
4203}
sprintf('%.4f', $callTime)
$result
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
Handles display of the main menu for LTI.
const IL_CAL_DATETIME
error($a_errmsg)
set error message @access public
const IL_PAGE_TITLE
const IL_CHAPTER_TITLE
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
static getAttribute($a_func_id)
Get accesskey HTML attribute.
static addCss()
Add required css.
static addJavaScript(ilTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _updateLastAccess($a_user_id, $a_lm_ref_id, $a_page_id)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static _getFrame($a_class, $a_type='')
Get content frame name.
Glossary definition page GUI class.
static getDefinitionList($a_term_id)
static
GUI class for glossary terms.
static _lookGlossaryTerm($term_id)
get glossary term
static get($a_glyph, $a_text="")
Get glyph html.
Class ilInfoScreenGUI.
TableGUI class for lm download files.
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _isPagePublic($a_node_id, $a_check_public_mode=false)
static _lookupTitle($a_obj_id)
Lookup title.
static lookupLayout($a_obj_id)
Lookup type.
static _exists($a_id)
checks wether a lm content object with specified id exists or not
Extension of ilPageObjectGUI for learning modules.
Class ilLMPageObject.
static _getPresentationTitle( $a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
Extension of ilPageObject for learning modules.
Base exception class for learning module presentation.
Class ilLMPresentationGUI.
offlineMode()
checks wether offline content generation is activated
ilLMNotes()
output notes of page
outputInfoScreen($a_standard_locator=false)
info screen
ilLMNavigation()
inserts sequential learning module navigation at template variable LMNAVIGATION_CONTENT
setOfflineMode($a_offline=true, $a_all_languages=false)
set offline mode (content is generated for offline package)
handleCodeParagraph($page_id, $paragraph_id, $title, $text)
store paragraph into file directory files/codefile_$pg_id_$paragraph_id/downloadtitle
getCurrentPageId()
Get the current page id.
ilLMMenu()
output learning module menu
initPrintViewSelectionForm()
Init print view selection form.
layout($a_xml="main.xml", $doShow=true)
generates frame layout
processNodes(&$a_content, &$a_node)
download_paragraph()
download source code paragraph
getExportFormat()
get export format
export()
calls export of digilib-object at this point other lm-objects can be exported
addHeaderAction($a_redraw=false)
Add header action.
initScreenHead($a_active_tab="info")
nop()
this dummy function is needed for offline package creation
downloadFile()
download file of file lists
showMessageScreen($a_content)
Show message screen.
showPreconditionsOfPage()
show preconditions of the page
getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
Get focused link (used in learning objectives courses)
showNavRestrictionDueToQuestions()
Show message if navigation to page is not allowed due to unanswered questions.
showDownloadList()
show download list
getLMPageGUI($a_id)
Get lm page gui object.
showInfoScreen()
info screen call from inside learning module
getLMPage($a_id)
Get lm page object.
setOfflineDirectory($offdir)
set offline directory to offdir
getOfflineDirectory()
get offline directory
getCurrentFrameSet()
get frames of current frame set
ilTOC($a_get_explorer=false)
table of contents
getSuccessorPage()
Get successor page.
showPrintViewSelection()
show selection screen for print view
setExportFormat($a_format)
set export format
ilLMSubMenu()
output learning module submenu
showTableOfContents()
table of contents
getLinkXML($a_int_links, $a_layoutframes)
get xml for links
redrawHeaderAction()
Redraw header action.
downloadExportFile()
send download file (xml/html)
getLinkTargetsXML()
Get XMl for Link Targets.
determineLayout()
Determine layout.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
ilPage(&$a_page_node, $a_page_id=0)
process <ilPage> content tag
getLink( $a_ref_id, $a_cmd="", $a_obj_id="", $a_frame="", $a_type="", $a_back_link="append", $a_anchor="", $a_srcstring="")
handles links for learning module presentation
basicPageGuiInit($a_page_gui)
Basic page gui initialisation.
refreshToc()
Refresh toc (called if questions have been answered correctly)
showNoPageAccess()
Show info message, if page is not accessible in public area.
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
ilLocator($a_std_templ_loaded=false)
locator
ilJavaScript($a_inline="", $a_file="", $a_location="")
Puts JS into template.
showNoPublicAccess()
Show info message, if page is not accessible in public area.
getLMPresentationTitle()
Get lm presentationtitle.
LM presentation (left frame) explorer GUI class.
LM presentation (separate toc screen) explorer GUI class.
static getInstance($a_ref_id, $a_user_id=0)
Get instance.
static getInstance($a_tree_id)
Get Instance.
Class ilObjUserTrackingGUI.
static _parseCopyright($a_copyright)
Parse copyright.
Handles display of the main menu.
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
This class represents a (nested) list of checkboxes (could be extended for radio items,...
Notes GUI class.
static _getLastAccessedPage($a_ref_id, $a_user_id="")
get last accessed page
static getSupplyingExportFiles($a_target_dir=".")
Get supplying export files.
static _getMissingPreconditionsTopChapter($cont_obj_ref_id, $cont_obj_id, $page_id)
get top chapter of page for that any precondition is missing
static _checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
static _getMissingPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
gets all missing preconditions of page
Class ilLearningModuleGUI.
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
Class ilObjMediaObject.
static getContentPrintStyle()
get content print style
static getSyntaxStylePath()
get syntax style path
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static getInstance($a_obj_id)
Get instance.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static lookupParentId($a_id, $a_type)
Lookup parent id.
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Class for permanent links.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
Class ilRatingGUI.
static resetRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id)
Reset rating for a user and an object.
static writeRatingForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id, $a_rating, $a_category_id=0)
Write rating for a user and an object.
Session based immediate storage.
ILIAS Setting Class.
Class ilStructreObject.
static _getPresentationTitle( $a_st_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
special template class to simplify handling of ITX/PEAR
static highlight($a_dom_node_id, $a_text, $a_tpl=null)
Searches for all occurences of a text (case-insensitive) and highlights it.
static init($a_tpl=null)
Init.
static _getInstance($a_usr_id)
Get singleton instance.
static hasPublicProfile($a_user_id)
Has public profile.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getWebspaceDir($mode="filesystem")
get webspace directory
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static now()
Return current timestamp in Y-m-d H:i:s format.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getGotoForWikiPageTarget($a_target, $a_offline=false)
Get goto href for internal wiki page link target.
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$tracker
$lang
Definition: consent.php:3
$def
Definition: croninfo.php:21
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
$w
$js
$lg
Definition: example_018.php:62
if(!array_key_exists('StateId', $_REQUEST)) $id
$links
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(! $oauthconfig->getBoolean('getUserInfo.enable', FALSE)) $store
Definition: getUserInfo.php:11
$target_id
Definition: goto.php:49
$target_arr
Definition: goto.php:47
global $ilCtrl
Definition: ilias.php:18
const DEBUG
xslt_error(&$proc)
xslt_free(&$proc)
xslt_create()
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
if($format !==null) $name
Definition: metadata.php:146
$xml
Definition: metadata.php:240
$info
Definition: index.php:5
$debug
Definition: loganalyzer.php:16
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
global $ilErr
Definition: raiseError.php:16
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$attributes
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
$a_content
Definition: workflow.php:93
$a_type
Definition: workflow.php:92
$params
Definition: disable.php:11
$text
Definition: errorreport.php:18