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