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