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