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