ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLMPresentationGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
22{
26 protected $user;
27
31 protected $rbacsystem;
32
36 protected $ctrl;
37
41 protected $error;
42
46 protected $nav_history;
47
51 protected $access;
52
56 protected $settings;
57
61 protected $main_menu;
62
66 protected $locator;
67
71 protected $tree;
72
76 protected $help;
77
81 protected $lm;
82
86 public $tpl;
87
88 public $lng;
90 public $offline;
92
93 protected $embed_mode = false;
94
98 protected $current_page_id = 0;
99
103 protected $focus_id = 0; // focus id is set e.g. from learning objectives course, we focus on a chapter/page
104
108 protected $export_all_languages = false;
109
114
118 public $deactivated_page = false;
119
124
129
134
139
144
149
154
159
163 protected $linker;
164
168 protected $service;
169
173 protected $ui;
174
178 protected $toolbar;
179
183 protected $additional_content = [];
184
188 protected $ot;
189
190 public function __construct(
191 $a_export_format = "",
192 $a_all_languages = false,
193 $a_export_dir = "",
194 bool $claim_repo_context = true,
195 $query_params = null,
196 $embed_mode = false
197 ) {
199 global $DIC;
200
201 $this->offline = ($a_export_format != "");
202 $this->export_all_languages = $a_all_languages;
203 $this->export_format = $a_export_format; // html/scorm
204 $this->offline_directory = $a_export_dir;
205
206 $this->tabs = $DIC->tabs();
207 $this->toolbar = $DIC->toolbar();
208 $this->user = $DIC->user();
209 $this->rbacsystem = $DIC->rbac()->system();
210 $this->error = $DIC["ilErr"];
211 $this->nav_history = $DIC["ilNavigationHistory"];
212 $this->access = $DIC->access();
213 $this->settings = $DIC->settings();
214 $this->locator = $DIC["ilLocator"];
215 $this->tree = $DIC->repositoryTree();
216 $this->help = $DIC["ilHelp"];
217
218 $lng = $DIC->language();
219 $rbacsystem = $DIC->rbac()->system();
220 $ilCtrl = $DIC->ctrl();
221 $ilErr = $DIC["ilErr"];
222
223 // load language vars
224 $lng->loadLanguageModule("content");
225
226 $this->lng = $lng;
227 $this->ui = $DIC->ui();
228 $this->tpl = $DIC->ui()->mainTemplate();
229 $this->frames = array();
230 $this->ctrl = $ilCtrl;
231 $this->ctrl->saveParameter($this, array("ref_id", "transl", "focus_id", "focus_return"));
232
233 // note: using $DIC->http()->request()->getQueryParams() here will
234 // fail, since the goto magic currently relies on setting $_GET
235 if (!is_array($query_params)) {
236 $query_params = $_GET;
237 }
238 $this->initByRequest($query_params, $embed_mode);
239
240 // check, if learning module is online
241 if (!$rbacsystem->checkAccess("write", $this->requested_ref_id)) {
242 if ($this->lm->getOfflineStatus()) {
243 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
244 }
245 }
246
247 if ($claim_repo_context) {
248 $DIC->globalScreen()->tool()->context()->claim()->repository();
249 }
250
251 if (!$ilCtrl->isAsynch()) {
252 // moved this into the if due to #0027200
253 if (!$embed_mode) {
254 if ($this->service->getPresentationStatus()->isTocNecessary()) {
255 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(ilLMGSToolProvider::SHOW_TOC_TOOL, true);
256 }
257 }
258 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(ilLMGSToolProvider::SHOW_LINK_SLATES, true);
259 }
260
261 if ($embed_mode) {
262 $ilCtrl->setParameter($this, "embed_mode", 1);
263 $params = [
264 "obj_id" => $this->requested_obj_id,
265 "ref_id" => $this->lm->getRefId(),
266 "frame" => ""
267 ];
268 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(\ilLMGSToolProvider::LM_QUERY_PARAMS, $params);
269 }
270 }
271
280 public function initByRequest($query_params, bool $embed_mode = false)
281 {
282 $this->service = new ilLMPresentationService(
283 $this->user,
284 $query_params,
285 $this->offline,
286 $this->export_all_languages,
287 $this->export_format,
288 null,
290 );
291
292 $request = $this->service->getRequest();
293
294 $this->requested_obj_type = $request->getRequestedObjType();
295 $this->requested_ref_id = $request->getRequestedRefId();
296 $this->requested_transl = $request->getRequestedTranslation(); // handled by presentation status
297 $this->requested_obj_id = $request->getRequestedObjId(); // handled by navigation status
298 $this->requested_back_pg = $request->getRequestedBackPage();
299 $this->requested_frame = $request->getRequestedFrame();
300 $this->requested_search_string = $request->getRequestedSearchString();
301 $this->requested_focus_return = $request->getRequestedFocusReturn();
302 $this->requested_mob_id = $request->getRequestedMobId();
303
304 $this->lm_set = $this->service->getSettings();
305 $this->lm_gui = $this->service->getLearningModuleGUI();
306 $this->lm = $this->service->getLearningModule();
307 $this->tracker = $this->service->getTracker();
308 $this->linker = $this->service->getLinker();
309 $this->embed_mode = $embed_mode;
310 if ($request->getRequestedEmbedMode()) {
311 $this->embed_mode = true;
312 }
313
314 // language translation
315 $this->lang = $this->service->getPresentationStatus()->getLang();
316 $this->lm_tree = $this->service->getLMTree();
317 $this->focus_id = $this->service->getPresentationStatus()->getFocusId();
318 $this->ot = ilObjectTranslation::getInstance($this->lm->getId());
319 }
320
326 {
327 return $this->service;
328 }
329
336 public function injectTemplate($tpl)
337 {
338 $this->tpl = $tpl;
339 }
340
345 protected function getTracker()
346 {
347 return $this->service->getTracker();
348 }
349
354 public function executeCommand()
355 {
356 $ilNavigationHistory = $this->nav_history;
357 $ilAccess = $this->access;
359 $ilCtrl = $this->ctrl;
362
363 // check read permission and parent conditions
364 // todo: replace all this by ilAccess call
365 if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id) &&
366 (!(($this->ctrl->getCmd() == "infoScreen" || $this->ctrl->getNextClass() == "ilinfoscreengui")
367 && $ilAccess->checkAccess("visible", "", $this->requested_ref_id)))) {
368 $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
369 }
370
371 $next_class = $this->ctrl->getNextClass($this);
372 $cmd = $this->ctrl->getCmd("layout", array("showPrintView"));
373
374
375 $obj_id = $this->requested_obj_id;
376 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
377 $ilNavigationHistory->addItem($this->requested_ref_id, $this->ctrl->getLinkTarget($this), "lm");
378 $this->ctrl->setParameter($this, "obj_id", $obj_id);
379
380 switch ($next_class) {
381 case "ilnotegui":
382 $ret = $this->layout();
383 break;
384
385 case "ilinfoscreengui":
386 $ret = $this->outputInfoScreen();
387 break;
388
389 case "ilcommonactiondispatchergui":
391 $gui->enableCommentsSettings(false);
392 $this->ctrl->forwardCommand($gui);
393 break;
394
395 case "illmpagegui":
396 $page_gui = $this->getLMPageGUI($this->requested_obj_id);
397 $this->basicPageGuiInit($page_gui);
398 $ret = $ilCtrl->forwardCommand($page_gui);
399 break;
400
401 case "ilassgenfeedbackpagegui":
402 $page_gui = new ilAssGenFeedbackPageGUI($_GET["pg_id"]);
403 //$this->basicPageGuiInit($page_gui);
404 $ret = $ilCtrl->forwardCommand($page_gui);
405 break;
406
407 case "ilglossarydefpagegui":
408 $page_gui = new ilGlossaryDefPageGUI($this->requested_obj_id);
409 $this->basicPageGuiInit($page_gui);
410 $ret = $ilCtrl->forwardCommand($page_gui);
411 break;
412
413 case "illearningprogressgui":
414 $this->initScreenHead("learning_progress");
415 $new_gui = new ilLearningProgressGUI(
417 $this->requested_ref_id,
418 $ilUser->getId()
419 );
420 $this->ctrl->forwardCommand($new_gui);
421 break;
422
423 case "ilratinggui":
424 $rating_gui = new ilRatingGUI();
425 $rating_gui->setObject($this->lm->getId(), "lm", $this->requested_obj_id, "lm");
426 $this->ctrl->forwardCommand($rating_gui);
427 break;
428
429 default:
430 if ($_GET["ntf"]) {
431 switch ($_GET["ntf"]) {
432 case 1:
433 ilNotification::setNotification(ilNotification::TYPE_LM, $this->user->getId(), $this->lm->getId(), false);
434 break;
435
436 case 2:
437 ilNotification::setNotification(ilNotification::TYPE_LM, $this->user->getId(), $this->lm->getId(), true);
438 break;
439
440 case 3:
441 ilNotification::setNotification(ilNotification::TYPE_LM_PAGE, $this->user->getId(), $this->getCurrentPageId(), false);
442 break;
443
444 case 4:
445 ilNotification::setNotification(ilNotification::TYPE_LM_PAGE, $this->user->getId(), $this->getCurrentPageId(), true);
446 break;
447 }
448 $ilCtrl->redirect($this, "layout");
449 }
450 $ret = $this->$cmd();
451 break;
452 }
453 }
454
455
456
460 public function offlineMode()
461 {
462 return $this->offline;
463 }
464
465
471 public function getExportFormat()
472 {
473 return $this->export_format;
474 }
475
479 public function nop()
480 {
481 }
482
483 public function attrib2arr($a_attributes)
484 {
485 $attr = array();
486 if (!is_array($a_attributes)) {
487 return $attr;
488 }
489 foreach ($a_attributes as $attribute) {
490 $attr[$attribute->name()] = $attribute->value();
491 }
492 return $attr;
493 }
494
498 public function getCurrentFrameSet()
499 {
500 return $this->frames;
501 }
502
507 public function determineLayout() : string
508 {
509 return "standard";
510 }
511
512 public function resume()
513 {
514 $this->layout();
515 }
516
520 public function layout($a_xml = "main.xml", $doShow = true)
521 {
522 global $DIC;
523
526 $layout = $this->determineLayout();
527
528 // xmldocfile is deprecated! Use domxml_open_file instead.
529 // But since using relative pathes with domxml under windows don't work,
530 // we need another solution:
531 $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/" . $layout . "/" . $a_xml);
532
533 if (!$doc = domxml_open_mem($xmlfile)) {
534 throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Error reading " .
535 $layout . "/" . $a_xml . ".");
536 }
537 $this->layout_doc = $doc;
538 //echo ":".htmlentities($xmlfile).":$layout:$a_xml:";
539
540 // get current frame node
541 $xpc = xpath_new_context($doc);
542 $path = (empty($this->requested_frame) || ($this->requested_frame == "_blank"))
543 ? "/ilLayout/ilFrame[1]"
544 : "//ilFrame[@name='" . $this->requested_frame . "']";
545 $result = xpath_eval($xpc, $path);
546 $found = $result->nodeset;
547 if (count($found) != 1) {
548 throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Found " . count($found) . " nodes for " .
549 " path " . $path . " in " . $layout . "/" . $a_xml . ". LM Layout is " . $this->lm->getLayout());
550 }
551 $node = $found[0];
552
553 // ProcessFrameset
554 // node is frameset, if it has cols or rows attribute
555 $attributes = $this->attrib2arr($node->attributes());
556
557 $this->frames = array();
558
559 // ProcessContentTag
560 if ((empty($attributes["template"]) || !empty($this->requested_obj_type))
561 && ($this->requested_frame != "_blank" || $this->requested_obj_type != "MediaObject")) {
562 // we got a variable content frame (can display different
563 // object types (PageObject, MediaObject, GlossarItem)
564 // and contains elements for them)
565
566 // determine object type
567 if (empty($this->requested_obj_type)) {
568 $obj_type = "PageObject";
569 } else {
570 $obj_type = $this->requested_obj_type;
571 }
572
573 // get object specific node
574 $childs = $node->child_nodes();
575 $found = false;
576 foreach ($childs as $child) {
577 if ($child->node_name() == $obj_type) {
578 $found = true;
579 $attributes = $this->attrib2arr($child->attributes());
580 $node = $child;
581 //echo "<br>2node:".$node->node_name();
582 break;
583 }
584 }
585 if (!$found) {
586 throw new ilLMPresentationException("ilLMPresentation: No template specified for frame '" .
587 $this->requested_frame . "' and object type '" . $obj_type . "'.");
588 }
589 }
590
591 // get template
592 $in_module = ($attributes["template_location"] == "module")
593 ? true
594 : false;
595 /* if ($in_module)
596 {
597 $this->tpl = new ilGlobalTemplate($attributes["template"], true, true, $in_module);
598 $this->tpl->setBodyClass("");
599 }
600 else
601 {
602 $this->tpl = $tpl;
603 }*/
604
605 // set style sheets
606 if (!$this->offlineMode()) {
607 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
608 } else {
609 $style_name = $ilUser->getPref("style") . ".css";
610 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
611 }
612
613
614 // to make e.g. advanced seletions lists work:
615 // $GLOBALS["tpl"] = $this->tpl;
616
617 $childs = $node->child_nodes();
618
619 foreach ($childs as $child) {
620 $child_attr = $this->attrib2arr($child->attributes());
621
622 switch ($child->node_name()) {
623 case "ilMainMenu":
624 // @todo 6.0
625// $this->ilMainMenu();
626 break;
627
628 case "ilTOC":
629 // @todo 6.0
630// $this->ilTOC($child_attr["target_frame"]);
631 break;
632
633 case "ilPage":
634 $this->renderPageTitle();
635 $this->setHeader();
636 $this->ilLMMenu();
637 $this->addHeaderAction();
638 $content = $this->getContent();
639 $content .= $this->ilLMNotes();
640 $additional = $this->ui->renderer() ->render($this->additional_content);
641 $this->tpl->setContent($content . $additional);
642 break;
643
644 case "ilGlossary":
645 $content = $this->ilGlossary($child);
646 break;
647
648 case "ilLMNavigation":
649 // @todo 6.0
650// $this->ilLMNavigation();
651 break;
652
653 case "ilMedia":
654 $this->media();
655 break;
656
657 case "ilLocator":
658 $this->ilLocator();
659 break;
660
661 case "ilJavaScript":
662 $this->ilJavaScript(
663 $child_attr["inline"],
664 $child_attr["file"],
665 $child_attr["location"]
666 );
667 break;
668
669 case "ilLMMenu":
670 //$this->ilLMMenu();
671 break;
672
673 case "ilLMHead":
674 // @todo 6.0
675// $this->ilLMHead();
676 break;
677
678 case "ilLMSubMenu":
679 $this->ilLMSubMenu();
680 break;
681
682 case "ilLMNotes":
683 $this->ilLMNotes();
684 break;
685 }
686 }
687
688 // 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)
689 // Unfortunately there is no standardized way to do this somewhere else. Calling fillJavaScripts always in ilTemplate causes multiple additions of the the js files.
690 // 19.7.2014: outcommented, since fillJavaScriptFiles is called in the next blocks, and the
691 // following lines would add the js files two times
692 // if (strcmp($this->requested_frame, "topright") == 0) $this->tpl->fillJavaScriptFiles();
693 // if (strcmp($this->requested_frame, "right") == 0) $this->tpl->fillJavaScriptFiles();
694 // if (strcmp($this->requested_frame, "botright") == 0) $this->tpl->fillJavaScriptFiles();
695
696 $this->addResourceFiles();
697
698 if ($doShow) {
699 // (horrible) workaround for preventing template engine
700 // from hiding paragraph text that is enclosed
701 // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
702
703 // @todo 6.0
704 /*$this->tpl->fillTabs();
705 if ($this->fill_on_load_code)
706 {
707 $this->tpl->fillOnLoadCode();
708 }
709 $content = $this->tpl->get();
710 $content = str_replace("&#123;", "{", $content);
711 $content = str_replace("&#125;", "}", $content);
712
713 header('Content-type: text/html; charset=UTF-8');
714 echo $content;*/
715 $tpl->printToStdout();
716 } else {
717 /*$tpl->printToStdout();
718 $this->tpl->fillLeftNav();
719 $this->tpl->fillOnLoadCode();*/
720
721 $content = $tpl->printToString();
722 }
723
724 return($content);
725 }
726
730 protected function addResourceFiles()
731 {
732 iljQueryUtil::initjQuery($this->tpl);
733 iljQueryUtil::initjQueryUI($this->tpl);
734 ilUIFramework::init($this->tpl);
735
736 if (!$this->offlineMode()) {
739
740 $this->tpl->addJavascript("./Modules/LearningModule/js/LearningModule.js");
741 $close_call = "il.LearningModule.setCloseHTML('" . ilGlyphGUI::get(ilGlyphGUI::CLOSE) . "');";
742 $this->tpl->addOnLoadCode($close_call);
743
744 //$store->set("cf_".$this->lm->getId());
745
746 // handle initial content
747 if ($this->requested_frame == "") {
748 $store = new ilSessionIStorage("lm");
749 $last_frame_url = $store->get("cf_" . $this->lm->getId());
750 if ($last_frame_url != "") {
751 $this->tpl->addOnLoadCode("il.LearningModule.setLastFrameUrl('" . $last_frame_url . "', 'center_bottom');");
752 }
753
754 if (true) {
755 $this->tpl->addOnLoadCode("il.LearningModule.setSaveUrl('" .
756 $this->ctrl->getLinkTarget($this, "saveFrameUrl", "", false, false) . "');
757 il.LearningModule.openInitFrames();
758 ");
759 }
760 $this->tpl->addOnLoadCode("il.LearningModule.setTocRefreshUrl('" .
761 $this->ctrl->getLinkTarget($this, "refreshToc", "", false, false) . "');
762 ");
763 }
764
765 // from main menu
766 // $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
767 $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js");
768 ilYuiUtil::initConnection($this->tpl);
769 }
770 }
771
778 public function saveFrameUrl()
779 {
780 $store = new ilSessionIStorage("lm");
781 if ($_GET["url"] != "") {
782 $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
783 } else {
784 $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
785 }
786 }
787
788
789 public function fullscreen()
790 {
791 return $this->media();
792 }
793
798 public function media()
799 {
800 $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
801 //$GLOBALS["tpl"] = $this->tpl;
802
803 // set style sheets
804 $this->setContentStyles();
805 $this->setSystemStyle();
806
807 $this->ilMedia();
808 if (!$this->offlineMode()) {
809 $this->tpl->printToStdout();
810 } else {
811 return $this->tpl->printToString();
812 }
813 return "";
814 }
815
820 public function glossary()
821 {
822 $this->tpl = new ilGlobalTemplate("tpl.glossary_term_output.html", true, true, "Modules/LearningModule");
823 //$GLOBALS["tpl"] = $this->tpl;
824 $this->renderPageTitle();
825
826 iljQueryUtil::initjQuery($this->tpl);
827 iljQueryUtil::initjQueryUI($this->tpl);
828 ilUIFramework::init($this->tpl);
830 ilAccordionGUI::addCss($this->tpl);
831
832 // set style sheets
833 $this->setContentStyles();
834 $this->setSystemStyle();
835
836 $this->ilGlossary();
837 if (!$this->offlineMode()) {
838 $this->tpl->printToStdout();
839 } else {
840 return $this->tpl->printToString();
841 }
842
843 return "";
844 }
845
846 public function page()
847 {
848 global $DIC;
849
851
852 //if ($this->requested_frame != "_blank")
853 //{
854 // $this->layout();
855 //}
856 //else
857 //{
858 $this->tpl = new ilGlobalTemplate("tpl.page_fullscreen.html", true, true, "Modules/LearningModule");
859 $GLOBALS["tpl"] = $this->tpl;
860 $this->renderPageTitle();
861
862 $this->setContentStyles();
863
864 // set style sheets
865 if (!$this->offlineMode()) {
866 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
867 } else {
868 $style_name = $ilUser->getPref("style") . ".css";
869 ;
870 $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
871 }
872
873 $this->tpl->setVariable("PAGE_CONTENT", $this->getPageContent());
874 if (!$this->offlineMode()) {
875 $this->tpl->printToStdout();
876 } else {
877 return $this->tpl->get();
878 }
879 //}
880 }
881
885 public function ilMainMenu()
886 {
887 // LTI
888 global $DIC;
889 $ltiview = $DIC["lti"];
890 if ($ltiview->isActive()) {
891 $ilMainMenu = new LTI\ilMainMenuGUI("_top", false, $this->tpl);
892 } else {
893 $ilMainMenu = new ilMainMenuGUI("_top", false, $this->tpl);
894 }
895
896 if ($this->offlineMode()) {
897 $this->tpl->touchBlock("pg_intro");
898 $this->tpl->touchBlock("pg_outro");
899 return;
900 }
901
902 $page_id = $this->getCurrentPageId();
903 if ($page_id > 0) {
904 $ilMainMenu->setLoginTargetPar("pg_" . $page_id . "_" . $this->lm->getRefId());
905 }
906
907 //$this->tpl->touchBlock("mm_intro");
908 //$this->tpl->touchBlock("mm_outro");
909 $this->tpl->touchBlock("pg_intro");
910 $this->tpl->touchBlock("pg_outro");
911 $this->tpl->setBodyClass("std");
912 $this->tpl->setVariable("MAINMENU", $ilMainMenu->getHTML());
913 // LTI
914 $this->tpl->setVariable("MAINMENU_SPACER", $ilMainMenu->getSpacerClass());
915 }
916
920 public function ilTOC($a_get_explorer = false)
921 {
922 $fac = new ilLMTOCExplorerGUIFactory();
923 $exp = $fac->getExplorer($this->service, "ilTOC");
924 $exp->handleCommand();
925 return $exp;
926 }
927
934 public function getLMPresentationTitle()
935 {
936 return $this->service->getPresentationStatus()->getLMPresentationTitle();
937 }
938
939
943 public function ilLMMenu()
944 {
945 $this->renderTabs("content", $this->getCurrentPageId());
946 /*$this->tpl->setVariable("MENU", $this->lm_gui->setilLMMenu($this->offlineMode()
947 ,$this->getExportFormat(), "content", false, true, $this->getCurrentPageId(),
948 $this->lang, $this->export_all_languages));*/
949 }
950
954 public function setHeader()
955 {
956 $this->tpl->setTitle($this->getLMPresentationTitle());
957 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
958 }
959
963 public function ilLMSubMenu()
964 {
966 if ($this->abstract) {
967 return;
968 }
969
970 $showViewInFrameset = true;
971
972 if ($showViewInFrameset) {
973 $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
974 } else {
975 $buttonTarget = "_top";
976 }
977
978
979 $tpl_menu = new ilTemplate("tpl.lm_sub_menu.html", true, true, "Modules/LearningModule");
980
981 $pg_id = $this->getCurrentPageId();
982 if ($pg_id == 0) {
983 return;
984 }
985
986 // edit learning module
987 if (!$this->offlineMode()) {
988 if ($rbacsystem->checkAccess("write", $this->requested_ref_id)) {
989 $tpl_menu->setCurrentBlock("edit_page");
990 $page_id = $this->getCurrentPageId();
991 $tpl_menu->setVariable("EDIT_LINK", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $this->requested_ref_id .
992 "&obj_id=" . $page_id . "&to_page=1");
993 $tpl_menu->setVariable("EDIT_TXT", $this->lng->txt("edit_page"));
994 $tpl_menu->setVariable("EDIT_TARGET", $buttonTarget);
995 $tpl_menu->parseCurrentBlock();
996 }
997
998 $page_id = $this->getCurrentPageId();
999
1000 // permanent link
1001 $this->tpl->setPermanentLink("pg", "", $page_id . "_" . $this->lm->getRefId());
1002 }
1003
1004 $this->tpl->setVariable("SUBMENU", $tpl_menu->get());
1005 }
1006
1007
1011 public function redrawHeaderAction()
1012 {
1013 echo $this->getHeaderAction(true);
1014 exit;
1015 }
1016
1020 public function addHeaderAction()
1021 {
1022 $this->tpl->setVariable("HEAD_ACTION", $this->getHeaderAction());
1023 }
1024
1028 public function getHeaderAction($a_redraw = false)
1029 {
1030 if ($this->offline) {
1031 return;
1032 }
1033 $ilAccess = $this->access;
1035 $tpl = $this->tpl;
1036
1037 $lm_id = $this->lm->getId();
1038 $pg_id = $this->getCurrentPageId();
1039
1040 $this->lng->loadLanguageModule("content");
1041
1042 $dispatcher = new ilCommonActionDispatcherGUI(
1044 $ilAccess,
1045 $this->lm->getType(),
1046 $this->lm->getRefId(),
1047 $this->lm->getId()
1048 );
1049 $dispatcher->setSubObject("pg", $this->getCurrentPageId());
1050
1051 $this->ctrl->setParameter($this, "embed_mode", $this->embed_mode);
1052 $this->ctrl->setParameterByClass("ilnotegui", "embed_mode", $this->embed_mode);
1053 $this->ctrl->setParameterByClass("iltagginggui", "embed_mode", $this->embed_mode);
1054 ilObjectListGUI::prepareJSLinks(
1055 $this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true),
1056 $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
1057 $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false),
1058 $this->tpl
1059 );
1060
1061 $lg = $dispatcher->initHeaderAction();
1062 if (!$ilSetting->get("disable_notes")) {
1063 $lg->enableNotes(true);
1064 if (!$this->embed_mode) {
1065 $lg->enableComments($this->lm->publicNotes(), false);
1066 }
1067 }
1068
1069 if ($this->lm->hasRating() && !$this->offlineMode()) {
1070 $lg->enableRating(
1071 true,
1072 $this->lng->txt("lm_rating"),
1073 false,
1074 array("ilcommonactiondispatchergui", "ilratinggui")
1075 );
1076 }
1077
1078 // notification
1079 if ($this->user->getId() != ANONYMOUS_USER_ID && !$this->embed_mode) {
1080 if (ilNotification::hasNotification(ilNotification::TYPE_LM, $this->user->getId(), $lm_id)) {
1081 $this->ctrl->setParameter($this, "ntf", 1);
1082 if (ilNotification::hasOptOut($lm_id)) {
1083 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_deactivate_lm");
1084 }
1085
1086 $lg->addHeaderIcon(
1087 "not_icon",
1088 ilUtil::getImagePath("notification_on.svg"),
1089 $this->lng->txt("cont_notification_activated")
1090 );
1091 } else {
1092 $this->ctrl->setParameter($this, "ntf", 2);
1093 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_activate_lm");
1094
1096 $this->ctrl->setParameter($this, "ntf", 3);
1097 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_deactivate_page");
1098
1099 $lg->addHeaderIcon(
1100 "not_icon",
1101 ilUtil::getImagePath("notification_on.svg"),
1102 $this->lng->txt("cont_page_notification_activated")
1103 );
1104 } else {
1105 $this->ctrl->setParameter($this, "ntf", 4);
1106 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_activate_page");
1107
1108 $lg->addHeaderIcon(
1109 "not_icon",
1110 ilUtil::getImagePath("notification_off.svg"),
1111 $this->lng->txt("cont_notification_deactivated")
1112 );
1113 }
1114 }
1115 $this->ctrl->setParameter($this, "ntf", "");
1116 }
1117
1118 if (!$this->offline) {
1119 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1120 if ($this->getCurrentPageId() <= 0) {
1121 $link = $this->ctrl->getLinkTargetByClass(["ilLMEditorGUI", "ilobjlearningmodulegui"], "chapters");
1122 } else {
1123 $link = ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $this->requested_ref_id .
1124 "&obj_id=" . $this->getCurrentPageId() . "&to_page=1";
1125 }
1126 $lg->addCustomCommand($link, "edit_page");
1127 }
1128 }
1129
1130
1131 if (!$a_redraw) {
1132 return $lg->getHeaderAction($this->tpl);
1133 } else {
1134 // we need to add onload code manually (rating, comments, etc.)
1135 return $lg->getHeaderAction() .
1136 $tpl->getOnLoadCodeForAsynch();
1137 }
1138 }
1139
1143 public function ilLMNotes() : string
1144 {
1145 $ilAccess = $this->access;
1147
1148 // no notes in offline (export) mode
1149 if ($this->offlineMode()) {
1150 return "";
1151 }
1152
1153 // now output comments
1154
1155 if ($ilSetting->get("disable_comments")) {
1156 return "";
1157 }
1158 if (!$this->lm->publicNotes()) {
1159 return "";
1160 }
1161
1162 $next_class = $this->ctrl->getNextClass($this);
1163
1164 $pg_id = $this->getCurrentPageId();
1165
1166 if ($pg_id == 0) {
1167 return "";
1168 }
1169 $notes_gui = new ilNoteGUI($this->lm->getId(), $this->getCurrentPageId(), "pg");
1170
1171 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id) &&
1172 $ilSetting->get("comments_del_tutor", 1)) {
1173 $notes_gui->enablePublicNotesDeletion(true);
1174 }
1175
1176 $this->ctrl->setParameter($this, "frame", $this->requested_frame);
1177 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1178
1179 $notes_gui->enablePrivateNotes();
1180 if ($this->lm->publicNotes()) {
1181 $notes_gui->enablePublicNotes();
1182 }
1183
1184 $callback = array($this, "observeNoteAction");
1185 $notes_gui->addObserver($callback);
1186
1187 if ($next_class == "ilnotegui") {
1188 $html = $this->ctrl->forwardCommand($notes_gui);
1189 } else {
1190 $html = $notes_gui->getNotesHTML();
1191 }
1192 return $html;
1193 }
1194
1195
1199 public function ilLocator($a_std_templ_loaded = false)
1200 {
1201 global $DIC;
1202 $ltiview = $DIC["lti"];
1203 $ilLocator = $this->locator;
1205 $ilCtrl = $this->ctrl;
1206
1207 if (empty($this->requested_obj_id)) {
1208 $a_id = $this->lm_tree->getRootId();
1209 } else {
1211 }
1212
1213
1214 if (!$this->lm->cleanFrames()) {
1215 $frame_param = $this->requested_frame;
1216 $frame_target = "";
1217 } elseif (!$this->offlineMode()) {
1218 $frame_param = "";
1219 $frame_target = ilFrameTargetInfo::_getFrame("MainContent");
1220 } else {
1221 $frame_param = "";
1222 $frame_target = "_top";
1223 }
1224
1225 if (!$this->offlineMode()) {
1226 // LTI
1227 if ($ltiview->isActive()) {
1228 $ilLocator->addRepositoryItems();
1229 } else {
1230 $ilLocator->addRepositoryItems();
1231 //$ilLocator->addItem("...", "");
1232
1233 /*
1234 $par_id = $tree->getParentId($this->requested_ref_id);
1235 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $par_id);
1236 $ilLocator->addItem(
1237 ilObject::_lookupTitle(ilObject::_lookupObjId($par_id)),
1238 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
1239 ilFrameTargetInfo::_getFrame("MainContent"), $par_id);
1240 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->requested_ref_id);*/
1241 }
1242 } else {
1243 $ilLocator->setOffline(true);
1244 }
1245
1246 if ($this->lm_tree->isInTree($a_id)) {
1247 $path = $this->lm_tree->getPathFull($a_id);
1248
1249 foreach ($path as $key => $row) {
1250 if ($row["type"] != "pg") {
1251 if ($row["child"] != $this->lm_tree->getRootId()) {
1252 $ilLocator->addItem(
1255 $row["child"],
1256 ilLMOBject::CHAPTER_TITLE,
1257 $this->lm->isActiveNumbering(),
1258 $this->lm_set->get("time_scheduled_page_activation"),
1259 false,
1260 0,
1261 $this->lang
1262 ),
1263 50,
1264 true
1265 ),
1266 $this->linker->getLink("layout", $row["child"], $frame_param, "StructureObject"),
1267 $frame_target
1268 );
1269 } else {
1270 $ilLocator->addItem(
1271 ilUtil::shortenText($this->getLMPresentationTitle(), 50, true),
1272 $this->linker->getLink("layout", "", $frame_param),
1273 $frame_target,
1274 $this->requested_ref_id
1275 );
1276 }
1277 }
1278 }
1279 } else { // lonely page
1280 $ilLocator->addItem(
1281 $this->getLMPresentationTitle(),
1282 $this->linker->getLink("layout", "", $this->requested_frame)
1283 );
1284
1285 $lm_obj = ilLMObjectFactory::getInstance($this->lm, $a_id);
1286
1287 $ilLocator->addItem(
1288 $lm_obj->getTitle(),
1289 $this->linker->getLink("layout", $a_id, $frame_param),
1290 $frame_target
1291 );
1292 }
1293
1294 if (DEBUG) {
1295 $debug = "DEBUG: <font color=\"red\">" . $this->type . "::" . $this->id . "::" . $_GET["cmd"] . "</font><br/>";
1296 }
1297
1298 //$prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
1299
1300
1301 $this->tpl->setLocator();
1302 }
1303
1309 public function getCurrentPageId()
1310 {
1311 return $this->service->getNavigationStatus()->getCurrentPage();
1312
1314
1315 if (!$this->offlineMode() && $this->current_page_id !== false) {
1317 }
1318
1319 $this->chapter_has_no_active_page = false;
1320 $this->deactivated_page = false;
1321
1322 // determine object id
1323 if (empty($this->requested_obj_id)) {
1324 $obj_id = $this->lm_tree->getRootId();
1325 } else {
1326 $obj_id = $this->requested_obj_id;
1327 $active = ilLMPage::_lookupActive(
1328 $obj_id,
1329 $this->lm->getType(),
1330 $this->lm_set->get("time_scheduled_page_activation")
1331 );
1332
1333 if (!$active &&
1334 ilLMPageObject::_lookupType($obj_id) == "pg") {
1335 $this->deactivated_page = true;
1336 }
1337 }
1338
1339 // obj_id not in tree -> it is a unassigned page -> return page id
1340 if (!$this->lm_tree->isInTree($obj_id)) {
1341 return $obj_id;
1342 }
1343
1344 $curr_node = $this->lm_tree->getNodeData($obj_id);
1345
1346 $active = ilLMPage::_lookupActive(
1347 $obj_id,
1348 $this->lm->getType(),
1349 $this->lm_set->get("time_scheduled_page_activation")
1350 );
1351
1352 if ($curr_node["type"] == "pg" &&
1353 $active) { // page in tree -> return page id
1354 $page_id = $curr_node["obj_id"];
1355 } else { // no page -> search for next page and return its id
1356 $succ_node = true;
1357 $active = false;
1358 $page_id = $obj_id;
1359 while ($succ_node && !$active) {
1360 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
1361 $page_id = $succ_node["obj_id"];
1362 $active = ilLMPage::_lookupActive(
1363 $page_id,
1364 $this->lm->getType(),
1365 $this->lm_set->get("time_scheduled_page_activation")
1366 );
1367 }
1368
1369 if ($succ_node["type"] != "pg") {
1370 $this->chapter_has_no_active_page = true;
1371 return 0;
1372 }
1373
1374 // if public access get first public page in chapter
1375 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
1376 $this->lm_gui->object->getPublicAccessMode() == 'selected') {
1377 $public = ilLMObject::_isPagePublic($page_id);
1378
1379 while ($public === false && $page_id > 0) {
1380 $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, 'pg');
1381 $page_id = $succ_node['obj_id'];
1382 $public = ilLMObject::_isPagePublic($page_id);
1383 }
1384 }
1385
1386 // check whether page found is within "clicked" chapter
1387 if ($this->lm_tree->isInTree($page_id)) {
1388 $path = $this->lm_tree->getPathId($page_id);
1389 if (!in_array($this->requested_obj_id, $path)) {
1390 $this->chapter_has_no_active_page = true;
1391 }
1392 }
1393 }
1394
1395 $this->current_page_id = $page_id;
1396 return $page_id;
1397 }
1398
1399
1400 public function getLayoutLinkTargets()
1401 {
1402 if (!is_object($this->layout_doc)) {
1403 return array();
1404 }
1405
1406 $xpc = xpath_new_context($this->layout_doc);
1407
1408 $path = "/ilLayout/ilLinkTargets/LinkTarget";
1409 $res = xpath_eval($xpc, $path);
1410 $targets = array();
1411 for ($i = 0; $i < count($res->nodeset); $i++) {
1412 $type = $res->nodeset[$i]->get_attribute("Type");
1413 $frame = $res->nodeset[$i]->get_attribute("Frame");
1414 $onclick = $res->nodeset[$i]->get_attribute("OnClick");
1415 $targets[$type] = array("Type" => $type, "Frame" => $frame, "OnClick" => $onclick);
1416 }
1417 var_dump($targets);
1418 exit;
1419 return $targets;
1420 }
1421
1425 protected function setContentStyles()
1426 {
1427 // content style
1428
1429 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
1430 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
1431
1432 /*
1433 $this->tpl->setCurrentBlock("ContentStyle");
1434 if (!$this->offlineMode())
1435 {
1436 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1437 ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
1438 }
1439 else
1440 {
1441 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
1442 }
1443 $this->tpl->parseCurrentBlock();
1444
1445 // syntax style
1446 $this->tpl->setCurrentBlock("SyntaxStyle");
1447 if (!$this->offlineMode())
1448 {
1449 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1450 ilObjStyleSheet::getSyntaxStylePath());
1451 }
1452 else
1453 {
1454 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1455 "syntaxhighlight.css");
1456 }
1457 $this->tpl->parseCurrentBlock();*/
1458 }
1459
1463 protected function setSystemStyle()
1464 {
1465 $this->tpl->addCss(ilUtil::getStyleSheetLocation());
1466 }
1467
1468
1469
1470
1478 public function getContent($skip_nav = false)
1479 {
1480 $this->fill_on_load_code = true;
1481 $this->setContentStyles();
1482
1483 $tpl = new ilTemplate("tpl.lm_content.html", true, true, "Modules/LearningModule/Presentation");
1484
1485 // call ilLMContentRendererGUI
1486
1487 $navigation_renderer = new ilLMNavigationRendererGUI(
1488 $this->service,
1489 $this,
1490 $this->lng,
1491 $this->user,
1492 $this->tpl,
1493 $this->requested_obj_id,
1494 $this->requested_back_pg,
1495 $this->requested_frame
1496 );
1497
1498
1499 if (!$skip_nav) {
1500 $tpl->setVariable("TOP_NAVIGATION", $navigation_renderer->renderTop());
1501 $tpl->setVariable("BOTTOM_NAVIGATION", $navigation_renderer->renderBottom());
1502 }
1503 $tpl->setVariable("PAGE_CONTENT", $this->getPageContent());
1504 $tpl->setVariable("RATING", $this->renderRating());
1505
1506
1507 return $tpl->get();
1508 }
1509
1513 protected function getPageContent()
1514 {
1515 $content_renderer = new ilLMContentRendererGUI(
1516 $this->service,
1517 $this,
1518 $this->lng,
1519 $this->ctrl,
1520 $this->access,
1521 $this->user,
1522 $this->help,
1523 $this->requested_obj_id
1524 );
1525
1526 return $content_renderer->render();
1527 }
1528
1534 protected function renderRating()
1535 {
1536 // rating
1537 $rating = "";
1538 if ($this->lm->hasRatingPages() && !$this->offlineMode()) {
1539 $rating_gui = new ilRatingGUI();
1540 $rating_gui->setObject($this->lm->getId(), "lm", $this->getCurrentPageId(), "lm");
1541 $rating_gui->setYourRatingText($this->lng->txt("lm_rate_page"));
1542
1543 /*
1544 $this->tpl->setVariable("VAL_RATING", $rating->getHTML(false, true,
1545 "il.ExcPeerReview.saveComments(".$a_set["peer_id"].", %rating%)"));
1546 */
1547
1548 $this->ctrl->setParameter($this, "pgid", $this->getCurrentPageId());
1549 $this->tpl->addOnLoadCode("il.LearningModule.setRatingUrl('" .
1550 $this->ctrl->getLinkTarget($this, "updatePageRating", "", true, false) .
1551 "')");
1552 $this->ctrl->setParameter($this, "pgid", "");
1553
1554 $rating = '<div id="ilrtrpg" style="text-align:right">' .
1555 $rating_gui->getHtml(true, true, "il.LearningModule.saveRating(%rating%);") .
1556 "</div>";
1557 }
1558 return $rating;
1559 }
1560
1561
1562
1563 public function updatePageRating()
1564 {
1566
1567 $pg_id = $_GET["pgid"];
1568 if (!$this->ctrl->isAsynch() || !$pg_id) {
1569 exit();
1570 }
1571
1572 $rating = (int) $_POST["rating"];
1573 if ($rating) {
1575 $this->lm->getId(),
1576 "lm",
1577 $pg_id,
1578 "lm",
1579 $ilUser->getId(),
1580 $_POST["rating"]
1581 );
1582 } else {
1584 $this->lm->getId(),
1585 "lm",
1586 $pg_id,
1587 "lm",
1588 $ilUser->getId()
1589 );
1590 }
1591
1592 $rating = new ilRatingGUI();
1593 $rating->setObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
1594 $rating->setYourRatingText($this->lng->txt("lm_rate_page"));
1595
1596 echo $rating->getHtml(true, true, "il.LearningModule.saveRating(%rating%);");
1597
1598 echo $this->tpl->getOnLoadCodeForAsynch();
1599 exit();
1600 }
1601
1608 public function basicPageGuiInit(\ilLMPageGUI $a_page_gui)
1609 {
1611 $this->lm->getStyleSheetId(),
1612 "lm"
1613 ));
1614 if (!$this->offlineMode()) {
1615 $a_page_gui->setOutputMode("presentation");
1616 $this->fill_on_load_code = true;
1617 } else {
1618 $a_page_gui->setOutputMode("offline");
1619 $a_page_gui->setOfflineDirectory($this->getOfflineDirectory());
1620 $this->fill_on_load_code = false;
1621 }
1622 if (!$this->offlineMode()) {
1623 $this->ctrl->setParameter($this, "obj_id", $this->getCurrentPageId()); // see #22403
1624 }
1625 $a_page_gui->setFileDownloadLink($this->linker->getLink("downloadFile"));
1626 $a_page_gui->setSourcecodeDownloadScript($this->linker->getLink(
1627 "sourcecodeDownload",
1628 $this->getCurrentPageId()
1629 ));
1630 if (!$this->offlineMode()) {
1631 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1632 }
1633 $a_page_gui->setFullscreenLink($this->linker->getLink("fullscreen"));
1634 $a_page_gui->setSourcecodeDownloadScript($this->linker->getLink("download_paragraph"));
1635 }
1636
1637
1641 public function ilGlossary()
1642 {
1643 $ilCtrl = $this->ctrl;
1644
1645 $term_gui = new ilGlossaryTermGUI($this->requested_obj_id);
1646
1647 // content style
1648 $this->setContentStyles();
1649
1650 $term_gui->setPageLinker($this->linker);
1651
1652 $term_gui->setOfflineDirectory($this->getOfflineDirectory());
1653 if (!$this->offlineMode()) {
1654 $ilCtrl->setParameter($this, "pg_type", "glo");
1655 }
1656 $term_gui->output($this->offlineMode(), $this->tpl);
1657
1658
1659 if (!$this->offlineMode()) {
1660 $ilCtrl->setParameter($this, "pg_type", "");
1661 }
1662 }
1663
1667 public function ilMedia()
1668 {
1669 $this->setContentStyles();
1670
1671 $this->renderPageTitle();
1672
1673 $this->tpl->setCurrentBlock("ilMedia");
1674 $med_links = ilMediaItem::_getMapAreasIntLinks($this->requested_mob_id);
1675 $link_xml = $this->linker->getLinkXML($med_links);
1676
1677 $media_obj = new ilObjMediaObject($this->requested_mob_id);
1678 if (!empty($_GET["pg_id"])) {
1679 $pg_obj = $this->getLMPage($_GET["pg_id"], $_GET["pg_type"]);
1680 $pg_obj->buildDom();
1681
1682 $xml = "<dummy>";
1683 // todo: we get always the first alias now (problem if mob is used multiple
1684 // times in page)
1685 $xml .= $pg_obj->getMediaAliasElement($this->requested_mob_id);
1686 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
1687 $xml .= $link_xml;
1688 $xml .= "</dummy>";
1689 } else {
1690 $xml = "<dummy>";
1691 // todo: we get always the first alias now (problem if mob is used multiple
1692 // times in page)
1693 $xml .= $media_obj->getXML(IL_MODE_ALIAS);
1694 $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
1695 $xml .= $link_xml;
1696 $xml .= "</dummy>";
1697 }
1698
1699
1700 $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1701 $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
1702 $xh = xslt_create();
1703
1704 if (!$this->offlineMode()) {
1705 $wb_path = ilUtil::getWebspaceDir("output") . "/";
1706 } else {
1707 $wb_path = "";
1708 }
1709
1710 $mode = ($_GET["cmd"] == "fullscreen")
1711 ? "fullscreen"
1712 : "media";
1713 $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output", $this->offlineMode());
1714 $fullscreen_link =
1715 $this->linker->getLink("fullscreen");
1716 $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
1717 'link_params' => "ref_id=" . $this->lm->getRefId(),'fullscreen_link' => $fullscreen_link,
1718 'enable_html_mob' => ilObjMediaObject::isTypeAllowed("html") ? "y" : "n",
1719 'ref_id' => $this->lm->getRefId(), 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
1720 $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1721
1722 echo xslt_error($xh);
1723 xslt_free($xh);
1724
1725 // unmask user html
1726 $this->tpl->setVariable("MEDIA_CONTENT", $output);
1727
1728 // add js
1730 }
1731
1735 public function ilJavaScript($a_inline = "", $a_file = "", $a_location = "")
1736 {
1737 if ($a_inline != "") {
1738 $js_tpl = new ilTemplate($a_inline, true, false, $a_location);
1739 $js = $js_tpl->get();
1740 $this->tpl->setVariable("INLINE_JS", $js);
1741 }
1742 }
1743
1750 public function getSuccessorPage()
1751 {
1753
1754 $page_id = $this->getCurrentPageId();
1755
1756 if (empty($page_id)) {
1757 return 0;
1758 }
1759
1760 // determine successor page_id
1761 $found = false;
1762
1763 // empty chapter
1764 if ($this->chapter_has_no_active_page &&
1765 ilLMObject::_lookupType($this->requested_obj_id) == "st") {
1767 } else {
1768 if ($this->deactivated_page) {
1770 } else {
1771 $c_id = $page_id;
1772 }
1773 }
1774 while (!$found) {
1775 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
1776 $c_id = $succ_node["obj_id"];
1777
1778 $active = ilLMPage::_lookupActive(
1779 $c_id,
1780 $this->lm->getType(),
1781 $this->lm_set->get("time_scheduled_page_activation")
1782 );
1783
1784 if ($succ_node["obj_id"] > 0 &&
1785 $ilUser->getId() == ANONYMOUS_USER_ID &&
1786 ($this->lm->getPublicAccessMode() == "selected" &&
1787 !ilLMObject::_isPagePublic($succ_node["obj_id"]))) {
1788 $found = false;
1789 } elseif ($succ_node["obj_id"] > 0 && !$active) {
1790 // look, whether activation data should be shown
1791 $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType());
1792 if ($act_data["show_activation_info"] &&
1793 (ilUtil::now() < $act_data["activation_start"])) {
1794 $found = true;
1795 } else {
1796 $found = false;
1797 }
1798 } else {
1799 $found = true;
1800 }
1801 }
1802
1803 if ($found) {
1804 return $succ_node["obj_id"];
1805 }
1806 return 0;
1807 }
1808
1809
1810 public function processNodes(&$a_content, &$a_node)
1811 {
1812 $child_nodes = $a_node->child_nodes();
1813 foreach ($child_nodes as $child) {
1814 if ($child->node_name() == "ilFrame") {
1815 $attributes = $this->attrib2arr($child->attributes());
1816 // node is frameset, if it has cols or rows attribute
1817 if ((!empty($attributes["rows"])) || (!empty($attrubtes["cols"]))) {
1818 // if framset has name, another http request is necessary
1819 // (html framesets don't have names, so we need a wrapper frame)
1820 if (!empty($attributes["name"])) {
1821 unset($attributes["template"]);
1822 unset($attributes["template_location"]);
1823 $attributes["src"] =
1824 $this->linker->getLink(
1825 "layout",
1826 $this->requested_obj_id,
1827 $attributes["name"],
1828 "",
1829 "keep",
1830 "",
1831 $_GET["srcstring"]
1832 );
1833 $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
1834 $a_content .= $this->buildTag("", "frame", $attributes);
1835 $this->frames[$attributes["name"]] = $attributes["name"];
1836 //echo "<br>processNodes:add1 ".$attributes["name"];
1837 } else { // ok, no name means that we can easily output the frameset tag
1838 $a_content .= $this->buildTag("start", "frameset", $attributes);
1839 $this->processNodes($a_content, $child);
1840 $a_content .= $this->buildTag("end", "frameset");
1841 }
1842 } else { // frame with
1843 unset($attributes["template"]);
1844 unset($attributes["template_location"]);
1845 $attributes["src"] =
1846 $this->linker->getLink(
1847 "layout",
1848 $this->requested_obj_id,
1849 $attributes["name"],
1850 "",
1851 "keep",
1852 "",
1853 $_GET["srcstring"]
1854 );
1855 $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
1856 if ($attributes["name"] == "toc") {
1857 $attributes["src"] .= "#" . $this->requested_obj_id;
1858 } else {
1859 // Handle Anchors
1860 if ($_GET["anchor"] != "") {
1861 $attributes["src"] .= "#" . rawurlencode($_GET["anchor"]);
1862 }
1863 }
1864 $a_content .= $this->buildTag("", "frame", $attributes);
1865 $this->frames[$attributes["name"]] = $attributes["name"];
1866 }
1867 }
1868 }
1869 }
1870
1878 public function buildTag($type, $name, $attr = "")
1879 {
1880 $tag = "<";
1881
1882 if ($type == "end") {
1883 $tag .= "/";
1884 }
1885
1886 $tag .= $name;
1887
1888 if (is_array($attr)) {
1889 foreach ($attr as $k => $v) {
1890 $tag .= " " . $k . "=\"$v\"";
1891 }
1892 }
1893
1894 if ($type == "") {
1895 $tag .= "/";
1896 }
1897
1898 $tag .= ">\n";
1899
1900 return $tag;
1901 }
1902
1903
1904
1910 public function infoScreen()
1911 {
1912 $this->ctrl->setCmd("showSummary");
1913 $this->ctrl->setCmdClass("ilinfoscreengui");
1914 $this->outputInfoScreen();
1915 }
1916
1920 public function showInfoScreen()
1921 {
1922 $this->outputInfoScreen(true);
1923 }
1924
1925 protected function initScreenHead($a_active_tab = "info")
1926 {
1927 $ilAccess = $this->access;
1928 $ilLocator = $this->locator;
1930
1931 $this->renderPageTitle();
1932
1933 // set style sheets
1934 /*
1935 if (!$this->offlineMode())
1936 {
1937 $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
1938 }
1939 else
1940 {
1941 $style_name = $ilUser->getPref("style").".css";;
1942 $this->tpl->setStyleSheetLocation("./".$style_name);
1943 }*/
1944
1945 $this->tpl->loadStandardTemplate();
1946 $this->tpl->setTitle($this->getLMPresentationTitle());
1947 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
1948
1949 $this->renderTabs($a_active_tab, 0);
1950 /*$this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
1951 ,$this->getExportFormat(), $a_active_tab, true, false, 0,
1952 $this->lang, $this->export_all_languages));*/
1953
1954 // Full locator, if read permission is given
1955 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
1956 $this->ilLocator(true);
1957 } else {
1958 $ilLocator->addRepositoryItems();
1959 $this->tpl->setLocator();
1960 }
1961 }
1962
1966 public function outputInfoScreen($a_standard_locator = false)
1967 {
1968 $ilAccess = $this->access;
1969
1970 $this->initScreenHead();
1971
1972 $this->lng->loadLanguageModule("meta");
1973
1974 $info = new ilInfoScreenGUI($this->lm_gui);
1975 $info->enablePrivateNotes();
1976 $info->enableLearningProgress();
1977
1978 $info->enableNews();
1979 if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1980 $news_set = new ilSetting("news");
1981 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1982
1983 $info->enableNewsEditing();
1984
1985 if ($enable_internal_rss) {
1986 $info->setBlockProperty("news", "settings", true);
1987 }
1988 }
1989
1990 // add read / back button
1991 /*
1992 if ($ilAccess->checkAccess("read", "", $this->requested_ref_id))
1993 {
1994 if ($this->requested_obj_id > 0)
1995 {
1996 $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1997 $info->addButton($this->lng->txt("back"),
1998 $this->ctrl->getLinkTarget($this, "layout"));
1999 }
2000 else
2001 {
2002 $info->addButton($this->lng->txt("view"),
2003 $this->ctrl->getLinkTarget($this, "layout"));
2004 }
2005 }*/
2006
2007 // show standard meta data section
2008 $info->addMetaDataSections($this->lm->getId(), 0, $this->lm->getType());
2009
2010 if ($this->offlineMode()) {
2011 $this->tpl->setContent($info->getHTML());
2012 return $this->tpl->get();
2013 } else {
2014 // forward the command
2015 $this->ctrl->forwardCommand($info);
2016 //$this->tpl->setContent("aa");
2017 $this->tpl->printToStdout();
2018 }
2019 }
2020
2024 public function showPrintViewSelection()
2025 {
2027 $lng = $this->lng;
2028
2029 if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
2030 return;
2031 }
2032
2033
2034
2035// $this->setContentStyles();
2036// $this->renderPageTitle();
2037
2038// $this->tpl->loadStandardTemplate();
2039
2040// $this->renderTabs("print", 0);
2041 /*$this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
2042 ,$this->getExportFormat(), "print", true,false, 0,
2043 $this->lang, $this->export_all_languages));*/
2044
2045
2046 $tpl = new ilTemplate("tpl.lm_print_selection.html", true, true, "Modules/LearningModule");
2047
2048// $this->ilLocator(true);
2049 /* $this->tpl->addBlockFile(
2050 "ADM_CONTENT",
2051 "adm_content",
2052 "tpl.lm_print_selection.html",
2053 "Modules/LearningModule"
2054 );*/
2055
2056 // set title header
2057// $this->tpl->setTitle($this->getLMPresentationTitle());
2058// $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2059
2060 /*$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
2061 $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $this->requested_obj_id);
2062 $this->tpl->setVariable("LINK_BACK",
2063 $this->ctrl->getLinkTargetByClass("illmpresentationgui", ""));*/
2064
2065 $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $this->requested_obj_id);
2066 $tpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this));
2067
2068 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
2069 $nodes = $this->filterNonAccessibleNode($nodes);
2070
2071 if (!is_array($_POST["item"])) {
2072 if ($this->requested_obj_id != "") {
2073 $_POST["item"][$this->requested_obj_id] = "y";
2074 } else {
2075 $_POST["item"][1] = "y";
2076 }
2077 }
2078
2080
2081 foreach ($nodes as $node) {
2082
2083 // check page activation
2084 $active = ilLMPage::_lookupActive(
2085 $node["obj_id"],
2086 $this->lm->getType(),
2087 $this->lm_set->get("time_scheduled_page_activation")
2088 );
2089
2090 if ($node["type"] == "pg" &&
2091 !$active) {
2092 continue;
2093 }
2094
2095 $text = $img_scr = $img_alt = "";
2096 $disabled = false;
2097 $checked = false;
2098
2099 switch ($node["type"]) {
2100 // page
2101 case "pg":
2102 $text =
2104 $node["obj_id"],
2105 $this->lm->getPageHeader(),
2106 $this->lm->isActiveNumbering(),
2107 $this->lm_set->get("time_scheduled_page_activation"),
2108 false,
2109 0,
2110 $this->lang
2111 );
2112
2113 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2114 $this->lm_gui->object->getPublicAccessMode() == "selected") {
2115 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2116 $disabled = true;
2117 $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2118 }
2119 }
2120 $img_src = ilUtil::getImagePath("icon_pg.svg");
2121 $img_alt = $lng->txt("icon") . " " . $lng->txt("pg");
2122 break;
2123
2124 // learning module
2125 case "du":
2126 $text = $this->getLMPresentationTitle();
2127 $img_src = ilUtil::getImagePath("icon_lm.svg");
2128 $img_alt = $lng->txt("icon") . " " . $lng->txt("obj_lm");
2129 break;
2130
2131 // chapter
2132 case "st":
2133 $text =
2135 $node["obj_id"],
2136 ilLMOBject::CHAPTER_TITLE,
2137 $this->lm->isActiveNumbering(),
2138 $this->lm_set->get("time_scheduled_page_activation"),
2139 false,
2140 0,
2141 $this->lang
2142 );
2143 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2144 $this->lm_gui->object->getPublicAccessMode() == "selected") {
2145 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2146 $disabled = true;
2147 $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2148 }
2149 }
2150 $img_src = ilUtil::getImagePath("icon_st.svg");
2151 $img_alt = $lng->txt("icon") . " " . $lng->txt("st");
2152 break;
2153 }
2154
2155 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
2156 $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2157 }
2158
2159 $this->nl->addListNode(
2160 $node["obj_id"],
2161 $text,
2162 $node["parent"],
2163 $checked,
2164 $disabled,
2165 $img_src,
2166 $img_alt
2167 );
2168 }
2169
2170
2171 // check for free page
2172 if ($this->requested_obj_id > 0 && !$this->lm_tree->isInTree($this->requested_obj_id)) {
2173 $text =
2175 $this->requested_obj_id,
2176 $this->lm->getPageHeader(),
2177 $this->lm->isActiveNumbering(),
2178 $this->lm_set->get("time_scheduled_page_activation"),
2179 false,
2180 0,
2181 $this->lang
2182 );
2183
2184 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2185 $this->lm_gui->object->getPublicAccessMode() == "selected") {
2186 if (!ilLMObject::_isPagePublic($this->requested_obj_id)) {
2187 $disabled = true;
2188 $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2189 }
2190 }
2191 $img_src = ilUtil::getImagePath("icon_pg.svg");
2193
2194 $checked = true;
2195
2196 $this->nl->addListNode(
2197 $id,
2198 $text,
2199 0,
2200 $checked,
2201 $disabled,
2202 $img_src,
2203 $img_alt
2204 );
2205 }
2206
2207 $f = $this->form->getHTML();
2208
2209 // submit toolbar
2210// $tb = new ilToolbarGUI();
2211// $tb->addFormButton($lng->txt("cont_show_print_view"), "showPrintView");
2212// $tpl->setVariable("TOOLBAR", $tb->getHTML());
2213
2214 $tpl->setVariable("ITEM_SELECTION", $f);
2215// $this->tpl->printToStdout();
2216
2217 $modal = $this->ui->factory()->modal()->roundtrip(
2218 $this->lng->txt("cont_print_view"),
2219 $this->ui->factory()->legacy($tpl->get())
2220 );
2221 echo $this->ui->renderer()->render($modal);
2222 exit();
2223 }
2224
2229 protected function filterNonAccessibleNode($nodes)
2230 {
2231 $tracker = $this->getTracker();
2232 // if navigation is restricted based on correct answered questions
2233 // check if we have preceeding pages including unsanswered/incorrect answered questions
2234 if (!$this->offlineMode()) {
2235 if ($this->lm->getRestrictForwardNavigation()) {
2236 $nodes = array_filter($nodes, function ($node) use ($tracker) {
2237 return !$tracker->hasPredIncorrectAnswers($node["child"]);
2238 });
2239 }
2240 }
2241 return $nodes;
2242 }
2243
2244
2249 {
2250 $lng = $this->lng;
2251 $ilCtrl = $this->ctrl;
2252
2253 $this->form = new ilPropertyFormGUI();
2254 $this->form->setForceTopButtons(true);
2255
2256 // selection type
2257 $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
2258 $radg->setValue("page");
2259 $op1 = new ilRadioOption($lng->txt("cont_current_page"), "page");
2260 $radg->addOption($op1);
2261 $op2 = new ilRadioOption($lng->txt("cont_current_chapter"), "chapter");
2262 $radg->addOption($op2);
2263 $op3 = new ilRadioOption($lng->txt("cont_selected_pg_chap"), "selection");
2264 $radg->addOption($op3);
2265
2266 $nl = new ilNestedListInputGUI("", "obj_id");
2267 $this->nl = $nl;
2268 $op3->addSubItem($nl);
2269
2270
2271 $this->form->addItem($radg);
2272
2273 $this->form->addCommandButton("showPrintView", $lng->txt("cont_show_print_view"));
2274 $this->form->setOpenTag(false);
2275 $this->form->setCloseTag(false);
2276
2277 $this->form->setTitle(" ");
2278 $this->form->setFormAction($ilCtrl->getFormAction($this));
2279 }
2280
2284 public function showPrintView()
2285 {
2287 $lng = $this->lng;
2288 $ilCtrl = $this->ctrl;
2289 $tabs = $this->tabs;
2290
2291 if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
2292 return;
2293 }
2294
2295 $this->renderPageTitle();
2296
2297 $tabs->setBackTarget(
2298 $lng->txt("back"),
2299 $ilCtrl->getLinkTarget($this, "layout")
2300 );
2301
2302 $c_obj_id = $this->getCurrentPageId();
2303 // set values according to selection
2304 if ($_POST["sel_type"] == "page") {
2305 if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) {
2306 $_POST["obj_id"][] = $c_obj_id;
2307 }
2308 }
2309 if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) {
2310 $path = $this->lm_tree->getPathFull($c_obj_id);
2311 $chap_id = $path[1]["child"];
2312 if ($chap_id > 0) {
2313 $_POST["obj_id"][] = $chap_id;
2314 }
2315 }
2316
2317 $this->setContentStyles();
2318
2319 $tpl = new ilTemplate("tpl.lm_print_view.html", true, true, "Modules/LearningModule");
2320
2321 // set title header
2322 $this->tpl->setTitle($this->getLMPresentationTitle());
2323
2324 $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
2325
2326 $act_level = 99999;
2327 $activated = false;
2328
2329 $glossary_links = array();
2330 $output_header = false;
2331 $media_links = array();
2332
2333 // get header and footer
2334 if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
2335 if (ilLMObject::_exists($this->lm->getFooterPage())) {
2336 $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage());
2337 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2338 $this->lm->getStyleSheetId(),
2339 "lm"
2340 ));
2341
2342
2343 // determine target frames for internal links
2344 $page_object_gui->setLinkFrame($this->requested_frame);
2345 $page_object_gui->setOutputMode("print");
2346 $page_object_gui->setPresentationTitle("");
2347 $page_object_gui->setFileDownloadLink("#");
2348 $page_object_gui->setFullscreenLink("#");
2349 $page_object_gui->setSourceCodeDownloadScript("#");
2350 $footer_page_content = $page_object_gui->showPage();
2351 }
2352 }
2353 if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
2354 if (ilLMObject::_exists($this->lm->getHeaderPage())) {
2355 $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage());
2356 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2357 $this->lm->getStyleSheetId(),
2358 "lm"
2359 ));
2360
2361
2362 // determine target frames for internal links
2363 $page_object_gui->setLinkFrame($this->requested_frame);
2364 $page_object_gui->setOutputMode("print");
2365 $page_object_gui->setPresentationTitle("");
2366 $page_object_gui->setFileDownloadLink("#");
2367 $page_object_gui->setFullscreenLink("#");
2368 $page_object_gui->setSourceCodeDownloadScript("#");
2369 $header_page_content = $page_object_gui->showPage();
2370 }
2371 }
2372
2373 // add free selected pages
2374 if (is_array($_POST["obj_id"])) {
2375 foreach ($_POST["obj_id"] as $k) {
2376 if ($k > 0 && !$this->lm_tree->isInTree($k)) {
2377 if (ilLMObject::_lookupType($k) == "pg") {
2378 $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true);
2379 }
2380 }
2381 }
2382 } else {
2383 ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true);
2384 $ilCtrl->redirect($this, "showPrintViewSelection");
2385 }
2386
2387 foreach ($nodes as $node_key => $node) {
2388 // check page activation
2389 $active = ilLMPage::_lookupActive(
2390 $node["obj_id"],
2391 $this->lm->getType(),
2392 $this->lm_set->get("time_scheduled_page_activation")
2393 );
2394 if ($node["type"] == "pg" && !$active) {
2395 continue;
2396 }
2397
2398 // print all subchapters/subpages if higher chapter
2399 // has been selected
2400 if ($node["depth"] <= $act_level) {
2401 if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) {
2402 $act_level = $node["depth"];
2403 $activated = true;
2404 } else {
2405 $act_level = 99999;
2406 $activated = false;
2407 }
2408 }
2409 if ($this->lm->getRestrictForwardNavigation()) {
2410 if ($this->getTracker()->hasPredIncorrectAnswers($node["obj_id"])) {
2411 continue;
2412 }
2413 }
2414 if ($activated &&
2415 ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
2416 // output learning module header
2417 if ($node["type"] == "du") {
2418 $output_header = true;
2419 }
2420
2421 // output chapter title
2422 if ($node["type"] == "st") {
2423 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2424 $this->lm_gui->object->getPublicAccessMode() == "selected") {
2425 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2426 continue;
2427 }
2428 }
2429
2430 $chap = new ilStructureObject($this->lm, $node["obj_id"]);
2431 $tpl->setCurrentBlock("print_chapter");
2432
2433 $chapter_title = $chap->_getPresentationTitle(
2434 $node["obj_id"],
2435 $this->lm->isActiveNumbering(),
2436 $this->lm_set->get("time_scheduled_page_activation"),
2437 0,
2438 $this->lang
2439 );
2440 $tpl->setVariable(
2441 "CHAP_TITLE",
2442 $chapter_title
2443 );
2444
2445 if ($this->lm->getPageHeader() == ilLMOBject::CHAPTER_TITLE) {
2446 if ($nodes[$node_key + 1]["type"] == "pg") {
2447 $tpl->setVariable(
2448 "CHAP_HEADER",
2449 $header_page_content
2450 );
2451 $did_chap_page_header = true;
2452 }
2453 }
2454
2455 $tpl->parseCurrentBlock();
2456 $tpl->setCurrentBlock("print_block");
2457 $tpl->parseCurrentBlock();
2458 }
2459
2460 // output page
2461 if ($node["type"] == "pg") {
2462 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2463 $this->lm_gui->object->getPublicAccessMode() == "selected") {
2464 if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2465 continue;
2466 }
2467 }
2468
2469 $tpl->setCurrentBlock("print_item");
2470
2471 // get page
2472 $page_id = $node["obj_id"];
2473 $page_object_gui = $this->getLMPageGUI($page_id);
2474 $page_object = $page_object_gui->getPageObject();
2475 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2476 $this->lm->getStyleSheetId(),
2477 "lm"
2478 ));
2479
2480
2481 // get lm page
2482 $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
2483 $lm_pg_obj->setLMId($this->lm->getId());
2484
2485 // determine target frames for internal links
2486 $page_object_gui->setLinkFrame($this->requested_frame);
2487 $page_object_gui->setOutputMode("print");
2488 $page_object_gui->setPresentationTitle("");
2489
2490 if ($this->lm->getPageHeader() == ilLMObject::PAGE_TITLE || $node["free"] === true) {
2492 $lm_pg_obj->getId(),
2493 $this->lm->getPageHeader(),
2494 $this->lm->isActiveNumbering(),
2495 $this->lm_set->get("time_scheduled_page_activation"),
2496 false,
2497 0,
2498 $this->lang
2499 );
2500
2501 // prevent page title after chapter title
2502 // that have the same content
2503 if ($this->lm->isActiveNumbering()) {
2504 $chapter_title = trim(substr(
2505 $chapter_title,
2506 strpos($chapter_title, " ")
2507 ));
2508 }
2509
2510 if ($page_title != $chapter_title) {
2511 $page_object_gui->setPresentationTitle($page_title);
2512 }
2513 }
2514
2515 // handle header / footer
2516 $hcont = $header_page_content;
2517 $fcont = $footer_page_content;
2518
2519 if ($this->lm->getPageHeader() == ilLMOBject::CHAPTER_TITLE) {
2520 if ($did_chap_page_header) {
2521 $hcont = "";
2522 }
2523 if ($nodes[$node_key + 1]["type"] == "pg" &&
2524 !($nodes[$node_key + 1]["depth"] <= $act_level
2525 && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) {
2526 $fcont = "";
2527 }
2528 }
2529
2530 $page_object_gui->setFileDownloadLink("#");
2531 $page_object_gui->setFullscreenLink("#");
2532 $page_object_gui->setSourceCodeDownloadScript("#");
2533 $page_content = $page_object_gui->showPage();
2534 if ($this->lm->getPageHeader() != ilLMObject::PAGE_TITLE) {
2535 $tpl->setVariable(
2536 "CONTENT",
2537 $hcont . $page_content . $fcont
2538 );
2539 } else {
2540 $tpl->setVariable(
2541 "CONTENT",
2542 $hcont . $page_content . $fcont . "<br />"
2543 );
2544 }
2545 $chapter_title = "";
2546 $tpl->parseCurrentBlock();
2547 $tpl->setCurrentBlock("print_block");
2548 $tpl->parseCurrentBlock();
2549
2550 // get internal links
2551 $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]);
2552
2553 $got_mobs = false;
2554
2555 foreach ($int_links as $key => $link) {
2556 if ($link["type"] == "git" &&
2557 ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
2558 $glossary_links[$key] = $link;
2559 }
2560 if ($link["type"] == "mob" &&
2561 ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
2562 $got_mobs = true;
2563 $mob_links[$key] = $link;
2564 }
2565 }
2566
2567 // this is not cool because of performance reasons
2568 // unfortunately the int link table does not
2569 // store the target frame (we want to append all linked
2570 // images but not inline images (i.e. mobs with no target
2571 // frame))
2572 if ($got_mobs) {
2573 $page_object->buildDom();
2574 $links = $page_object->getInternalLinks();
2575 foreach ($links as $link) {
2576 if ($link["Type"] == "MediaObject"
2577 && $link["TargetFrame"] != ""
2578 && $link["TargetFrame"] != "None") {
2579 $media_links[] = $link;
2580 }
2581 }
2582 }
2583 }
2584 }
2585 }
2586
2587 $annex_cnt = 0;
2588 $annexes = array();
2589
2590 // glossary
2591 if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) {
2592 // sort terms
2593 $terms = array();
2594
2595 foreach ($glossary_links as $key => $link) {
2596 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]);
2597 $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term);
2598 }
2599 $terms = ilUtil::sortArray($terms, "term", "asc");
2600 //ksort($terms);
2601
2602 foreach ($terms as $t) {
2603 $link = $t["link"];
2604 $key = $t["key"];
2605 $defs = ilGlossaryDefinition::getDefinitionList($link["id"]);
2606 $def_cnt = 1;
2607
2608 // output all definitions of term
2609 foreach ($defs as $def) {
2610 // definition + number, if more than 1 definition
2611 if (count($defs) > 1) {
2612 $tpl->setCurrentBlock("def_title");
2613 $tpl->setVariable(
2614 "TXT_DEFINITION",
2615 $this->lng->txt("cont_definition") . " " . ($def_cnt++)
2616 );
2617 $tpl->parseCurrentBlock();
2618 }
2619 $page_gui = new ilGlossaryDefPageGUI($def["id"]);
2620 $page_gui->setTemplateOutput(false);
2621 $page_gui->setOutputMode("print");
2622
2623 $tpl->setCurrentBlock("definition");
2624 $page_gui->setFileDownloadLink("#");
2625 $page_gui->setFullscreenLink("#");
2626 $page_gui->setSourceCodeDownloadScript("#");
2627 $output = $page_gui->showPage();
2628 $tpl->setVariable("VAL_DEFINITION", $output);
2629 $tpl->parseCurrentBlock();
2630 }
2631
2632 // output term
2633 $tpl->setCurrentBlock("term");
2634 $tpl->setVariable(
2635 "VAL_TERM",
2636 $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])
2637 );
2638 $tpl->parseCurrentBlock();
2639 }
2640
2641 // output glossary header
2642 $annex_cnt++;
2643 $tpl->setCurrentBlock("glossary");
2644 $annex_title = $this->lng->txt("cont_annex") . " " .
2645 chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo");
2646 $tpl->setVariable("TXT_GLOSSARY", $annex_title);
2647 $tpl->parseCurrentBlock();
2648
2649 $annexes[] = $annex_title;
2650 }
2651
2652 // referenced images
2653 if (count($media_links) > 0) {
2654 foreach ($media_links as $media) {
2655 if (substr($media["Target"], 0, 4) == "il__") {
2656 $arr = explode("_", $media["Target"]);
2657 $id = $arr[count($arr) - 1];
2658
2659 $med_obj = new ilObjMediaObject($id);
2660 $med_item = $med_obj->getMediaItem("Standard");
2661 if (is_object($med_item)) {
2662 if (is_int(strpos($med_item->getFormat(), "image"))) {
2663 $tpl->setCurrentBlock("ref_image");
2664
2665 // image source
2666 if ($med_item->getLocationType() == "LocalFile") {
2667 $tpl->setVariable(
2668 "IMG_SOURCE",
2669 ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id .
2670 "/" . $med_item->getLocation()
2671 );
2672 } else {
2673 $tpl->setVariable(
2674 "IMG_SOURCE",
2675 $med_item->getLocation()
2676 );
2677 }
2678
2679 if ($med_item->getCaption() != "") {
2680 $tpl->setVariable("IMG_TITLE", $med_item->getCaption());
2681 } else {
2682 $tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
2683 }
2684 $tpl->parseCurrentBlock();
2685 }
2686 }
2687 }
2688 }
2689
2690 // output glossary header
2691 $annex_cnt++;
2692 $tpl->setCurrentBlock("ref_images");
2693 $annex_title = $this->lng->txt("cont_annex") . " " .
2694 chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images");
2695 $tpl->setVariable("TXT_REF_IMAGES", $annex_title);
2696 $tpl->parseCurrentBlock();
2697
2698 $annexes[] = $annex_title;
2699 }
2700
2701 // output learning module title and toc
2702 if ($output_header) {
2703 $tpl->setCurrentBlock("print_header");
2704 $tpl->setVariable("LM_TITLE", $this->getLMPresentationTitle());
2705 if ($this->lm->getDescription() != "none") {
2706 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2707 $md_gen = $md->getGeneral();
2708 foreach ($md_gen->getDescriptionIds() as $id) {
2709 $md_des = $md_gen->getDescription($id);
2710 $description = $md_des->getDescription();
2711 }
2712
2713 $tpl->setVariable(
2714 "LM_DESCRIPTION",
2715 $description
2716 );
2717 }
2718 $tpl->parseCurrentBlock();
2719
2720 // output toc
2721 $nodes2 = $nodes;
2722 foreach ($nodes2 as $node2) {
2723 if ($node2["type"] == "st"
2724 && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) {
2725 for ($j = 1; $j < $node2["depth"]; $j++) {
2726 $tpl->setCurrentBlock("indent");
2727 $tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
2728 $tpl->parseCurrentBlock();
2729 }
2730 $tpl->setCurrentBlock("toc_entry");
2731 $tpl->setVariable(
2732 "TXT_TOC_TITLE",
2734 $node2["obj_id"],
2735 ilLMOBject::CHAPTER_TITLE,
2736 $this->lm->isActiveNumbering(),
2737 $this->lm_set->get("time_scheduled_page_activation"),
2738 false,
2739 0,
2740 $this->lang
2741 )
2742 );
2743 $tpl->parseCurrentBlock();
2744 }
2745 }
2746
2747 // annexes
2748 foreach ($annexes as $annex) {
2749 $tpl->setCurrentBlock("indent");
2750 $tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
2751 $tpl->parseCurrentBlock();
2752 $tpl->setCurrentBlock("toc_entry");
2753 $tpl->setVariable("TXT_TOC_TITLE", $annex);
2754 $tpl->parseCurrentBlock();
2755 }
2756
2757 $tpl->setCurrentBlock("toc");
2758 $tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
2759 $tpl->parseCurrentBlock();
2760
2761 $tpl->setCurrentBlock("print_start_block");
2762 $tpl->parseCurrentBlock();
2763 }
2764
2765 // output author information
2766 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2767 if (is_object($lifecycle = $md->getLifecycle())) {
2768 $sep = $author = "";
2769 foreach (($ids = $lifecycle->getContributeIds()) as $con_id) {
2770 $md_con = $lifecycle->getContribute($con_id);
2771 if ($md_con->getRole() == "Author") {
2772 foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
2773 $md_ent = $md_con->getEntity($ent_id);
2774 $author = $author . $sep . $md_ent->getEntity();
2775 $sep = ", ";
2776 }
2777 }
2778 }
2779 if ($author != "") {
2780 $this->lng->loadLanguageModule("meta");
2781 $tpl->setCurrentBlock("author");
2782 $tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
2783 $tpl->setVariable("LM_AUTHOR", $author);
2784 $tpl->parseCurrentBlock();
2785 }
2786 }
2787
2788
2789 // output copyright information
2790 if (is_object($md_rights = $md->getRights())) {
2791 $copyright = $md_rights->getDescription();
2792 $copyright = ilMDUtils::_parseCopyright($copyright);
2793
2794 if ($copyright != "") {
2795 $this->lng->loadLanguageModule("meta");
2796 $tpl->setCurrentBlock("copyright");
2797 $tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
2798 $tpl->setVariable("LM_COPYRIGHT", $copyright);
2799 $tpl->parseCurrentBlock();
2800 }
2801 }
2802
2803 $this->tpl->setContent($tpl->get());
2804 $this->tpl->printToStdout();
2805 }
2806
2810 public function downloadFile()
2811 {
2812 $page_gui = $this->getLMPageGUI($this->getCurrentPageId());
2813 $page_gui->downloadFile();
2814 }
2815
2819 public function showDownloadList()
2820 {
2821 if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
2822 return;
2823 }
2824
2825 //$this->setContentStyles();
2826 //$this->renderPageTitle();
2827
2828 //$this->tpl->loadStandardTemplate();
2829
2830 //$this->renderTabs("download", 0);
2831
2832 //$this->ilLocator(true);
2833 //$this->tpl->stopTitleFloating();
2834 $tpl = new ilTemplate("tpl.lm_download_list.html", true, true, "Modules/LearningModule");
2835
2836 // set title header
2837 //$this->tpl->setTitle($this->getLMPresentationTitle());
2838 //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2839
2840 // output copyright information
2841 $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2842 if (is_object($md_rights = $md->getRights())) {
2843 $copyright = $md_rights->getDescription();
2844
2845 $copyright = ilMDUtils::_parseCopyright($copyright);
2846
2847 if ($copyright != "") {
2848 $this->lng->loadLanguageModule("meta");
2849 $tpl->setCurrentBlock("copyright");
2850 $tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
2851 $tpl->setVariable("LM_COPYRIGHT", $copyright);
2852 $tpl->parseCurrentBlock();
2853 }
2854 }
2855
2856 $download_table = new ilLMDownloadTableGUI($this, "showDownloadList", $this->lm);
2857 $tpl->setVariable("DOWNLOAD_TABLE", $download_table->getHTML());
2858 //$this->tpl->printToStdout();
2859
2860 $modal = $this->ui->factory()->modal()->roundtrip(
2861 $this->lng->txt("download"),
2862 $this->ui->factory()->legacy($tpl->get())
2863 );
2864 echo $this->ui->renderer()->render($modal);
2865 exit();
2866 }
2867
2868
2872 public function downloadExportFile()
2873 {
2874 if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
2875 return;
2876 }
2877
2878 $base_type = explode("_", $_GET["type"]);
2879 $base_type = $base_type[0];
2880 $file = $this->lm->getPublicExportFile($base_type);
2881 if ($this->lm->getPublicExportFile($base_type) != "") {
2882 $dir = $this->lm->getExportDirectory($_GET["type"]);
2883 if (is_file($dir . "/" . $file)) {
2884 ilUtil::deliverFile($dir . "/" . $file, $file);
2885 exit;
2886 }
2887 }
2888 }
2889
2899 public function getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
2900 {
2901 return "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=" . $a_ref_id . "&amp;obj_id=" . $a_obj_id . "&amp;focus_id=" .
2902 $a_obj_id . "&amp;focus_return=" . $a_return_ref_id;
2903 }
2904
2911 public function showMessageScreen($a_content)
2912 {
2913 // content style
2914 $this->setContentStyles();
2915
2916 $tpl = new ilTemplate("tpl.page_message_screen.html", true, true, "Modules/LearningModule");
2917 $tpl->setVariable("TXT_PAGE_NO_PUBLIC_ACCESS", $a_content);
2918
2919 $this->tpl->setVariable("PAGE_CONTENT", $tpl->get());
2920 }
2921
2922
2926 public function showNoPublicAccess()
2927 {
2928 $this->showMessageScreen($this->lng->txt("msg_page_no_public_access"));
2929 }
2930
2934 public function showNoPageAccess()
2935 {
2936 $this->showMessageScreen($this->lng->txt("msg_no_page_access"));
2937 }
2938
2944 {
2945 $this->showMessageScreen($this->lng->txt("cont_no_page_access_unansw_q"));
2946 }
2947
2948
2950 {
2951 if (!$this->offlineMode()) {
2952 //$this->ctrl->setParameter($this, session_name(), session_id());
2953 $target = $this->ctrl->getLinkTarget($this, "");
2954 $target = ilUtil::appendUrlParameterString($target, session_name() . "=" . session_id());
2955 return $this->ctrl->getLinkTarget($this, "");
2956 } else {
2957 return "";
2958 }
2959 }
2960
2961
2962
2969 public function getOfflineDirectory()
2970 {
2972 }
2973
2978 public function handleCodeParagraph($page_id, $paragraph_id, $title, $text)
2979 {
2980 $directory = $this->getOfflineDirectory() . "/codefiles/" . $page_id . "/" . $paragraph_id;
2981 ilUtil::makeDirParents($directory);
2982 $file = $directory . "/" . $title;
2983 if (!($fp = @fopen($file, "w+"))) {
2984 die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2985 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2986 }
2987 chmod($file, 0770);
2988 fwrite($fp, $text);
2989 fclose($fp);
2990 }
2991
2992 // #8613
2993 protected function renderPageTitle()
2994 {
2995 $this->tpl->setHeaderPageTitle($this->getLMPresentationTitle());
2996 // @todo 6.0
2997// $this->tpl->fillWindowTitle();
2998// $this->tpl->fillContentLanguage();
2999 }
3000
3001
3008 public function getLMPageGUI($a_id)
3009 {
3010 $concrete_lang = $this->service->getPresentationStatus()->getConcreteLang();
3011 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
3012 return new ilLMPageGUI($a_id, 0, false, $this->lang, $concrete_lang);
3013 }
3014 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->ot->getFallbackLanguage())) {
3015 return new ilLMPageGUI($a_id, 0, false, $this->ot->getFallbackLanguage(), $concrete_lang);
3016 }
3017 return new ilLMPageGUI($a_id, 0, false, "", $concrete_lang);
3018 }
3019
3026 public function getLMPage($a_id, $a_type = "")
3027 {
3028 $type = ($a_type == "mep")
3029 ? "mep"
3030 : "lm";
3031
3033 if (!ilPageObject::_exists($type, $a_id, $lang)) {
3034 $lang = "-";
3035 if ($this->lang != "-" && ilPageObject::_exists($type, $a_id, $this->ot->getFallbackLanguage())) {
3036 $lang = $this->ot->getFallbackLanguage();
3037 }
3038 }
3039
3040 switch ($type) {
3041 case "mep":
3042 return new ilMediaPoolPage($a_id, 0, $lang);
3043 default:
3044 return new ilLMPage($a_id, 0, $lang);
3045 }
3046 }
3047
3051 public function refreshToc()
3052 {
3053 $exp = $this->ilTOC(true);
3054
3055 echo $exp->getHTML() .
3056 "<script>" . $exp->getOnLoadCode() . "</script>";
3057 exit;
3058 }
3059
3068 public function observeNoteAction($a_lm_id, $a_page_id, $a_type, $a_action, $a_note_id)
3069 {
3070 $note = new ilNote($a_note_id);
3071 $note = $note->getText();
3072
3073 $notification = new ilLearningModuleNotification(
3076 $this->lm,
3077 $a_page_id,
3078 $note
3079 );
3080
3081 $notification->send();
3082 }
3083
3090 protected function renderTabs($active_tab, $current_page_id)
3091 {
3092 $menu_editor = new ilLMMenuEditor();
3093 $menu_editor->setObjId($this->lm->getId());
3094
3095 $navigation_renderer = new ilLMMenuRendererGUI(
3096 $this->getService(),
3097 $this->tabs,
3098 $this->toolbar,
3100 $active_tab,
3101 (string) $this->getExportFormat(),
3102 $this->export_all_languages,
3103 $this->lm,
3104 $this->offlineMode(),
3105 $menu_editor,
3106 $this->lang,
3107 $this->ctrl,
3108 $this->access,
3109 $this->user,
3110 $this->lng,
3111 $this->tpl,
3112 function ($additional_content) {
3113 $this->additional_content[] = $additional_content;
3114 }
3115 );
3116 $navigation_renderer->render();
3117 }
3118
3125 public function getHTML($pars)
3126 {
3127 $this->addResourceFiles();
3128 switch ($pars["cmd"]) {
3129 case "layout":
3130 $tpl = new ilTemplate("tpl.embedded_view.html", true, true, "Modules/LearningModule");
3131 $tpl->setVariable("HEAD_ACTION", $this->getHeaderAction());
3132 $tpl->setVariable("PAGE_RATING", $this->renderRating());
3133 $tpl->setVariable("PAGE", $this->getContent(true));
3134 $tpl->setVariable("COMMENTS", $this->ilLMNotes());
3135 return $tpl->get();
3136 }
3137 return "";
3138 }
3139}
$result
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
const IL_MODE_ALIAS
const IL_MODE_OUTPUT
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
static addCss()
Add required css.
Generic feedback page GUI class.
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _getFrame($a_class, $a_type='')
Get content frame name.
special template class to simplify handling of ITX/PEAR
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.
class for editing lm menu
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _isPagePublic($a_node_id, $a_check_public_mode=false)
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=self::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
basicPageGuiInit(\ilLMPageGUI $a_page_gui)
Basic page gui initialisation.
ilLMNotes()
output notes of page
outputInfoScreen($a_standard_locator=false)
info screen
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
injectTemplate($tpl)
Inject template.
processNodes(&$a_content, &$a_node)
getExportFormat()
get export format
initScreenHead($a_active_tab="info")
observeNoteAction($a_lm_id, $a_page_id, $a_type, $a_action, $a_note_id)
Generate new ilNote and send Notifications to the users informing that there are new comments in the ...
nop()
this dummy function is needed for offline package creation
downloadFile()
download file of file lists
showMessageScreen($a_content)
Show message screen.
getContent($skip_nav=false)
process <ilPage> content tag
getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
Get focused link (used in learning objectives courses)
addHeaderAction()
Add header action.
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.
addResourceFiles()
Add resource files.
showInfoScreen()
info screen call from inside learning module
initByRequest($query_params, bool $embed_mode=false)
Init services and this class by request params.
getOfflineDirectory()
get offline directory
getCurrentFrameSet()
get frames of current frame set
getHeaderAction($a_redraw=false)
Add header action.
ilTOC($a_get_explorer=false)
table of contents
getSuccessorPage()
Get successor page.
showPrintViewSelection()
show selection screen for print view
ilLMSubMenu()
output learning module submenu
setContentStyles()
Set content style.
redrawHeaderAction()
Redraw header action.
downloadExportFile()
send download file (xml/html)
determineLayout()
Determine layout.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
getHTML($pars)
Get HTML (called by kios mode through ilCtrl)
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
renderTabs($active_tab, $current_page_id)
Render tabs.
ilLocator($a_std_templ_loaded=false)
locator
ilJavaScript($a_inline="", $a_file="", $a_location="")
Puts JS into template.
getLMPage($a_id, $a_type="")
Get lm page object.
showNoPublicAccess()
Show info message, if page is not accessible in public area.
getLMPresentationTitle()
Get lm presentationtitle.
Main service init and factory.
Class ilLearningModuleNotification class.
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
Class ilMediaPoolPage.
This class represents a (nested) list of checkboxes (could be extended for radio items,...
Notes GUI class.
Note class.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
static hasOptOut($obj_id)
Is opt out (disable notification) allowed?
static _checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
Class ilObjMediaObject.
static isTypeAllowed($a_type)
Is type allowed.
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, $add_token=true)
get content style path
static getInstance($a_obj_id)
Get instance.
setOutputMode($a_mode=self::PRESENTATION)
Set Output Mode.
setFileDownloadLink($a_download_link)
Set file download link.
setFullscreenLink($a_fullscreen_link)
Set fullscreen link.
setStyleId($a_styleid)
Set Style Id.
setSourcecodeDownloadScript($script_name)
Set sourcecode download script.
setOfflineDirectory($offdir)
set offline directory to offdir
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
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.
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=self::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 init(ilGlobalTemplateInterface $a_tpl=null)
Init.
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 initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
const IL_INST_ID
Definition: constants.php:38
const ANONYMOUS_USER_ID
Definition: constants.php:25
global $DIC
Definition: goto.php:24
$additional
Definition: goto.php:52
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
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)
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
$store
Definition: metadata.php:90
$i
Definition: metadata.php:24
$attributes
Definition: metadata.php:231
$xml
Definition: metadata.php:332
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$type
$ilErr
Definition: raiseError.php:18
foreach($_POST as $key=> $value) $res
settings()
Definition: settings.php:2
ui()
Definition: ui.php:5
$lang
Definition: xapiexit.php:8