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