ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLMPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
22 {
26  protected $user;
27 
31  protected $rbacsystem;
32 
36  protected $ctrl;
37 
41  protected $error;
42 
46  protected $nav_history;
47 
51  protected $access;
52 
56  protected $settings;
57 
61  protected $main_menu;
62 
66  protected $locator;
67 
71  protected $tree;
72 
76  protected $help;
77 
81  protected $lm;
82 
83  public $tpl;
84  public $lng;
85  public $layout_doc;
86  public $offline;
88 
92  protected $current_page_id = 0;
93 
97  protected $focus_id = 0; // focus id is set e.g. from learning objectives course, we focus on a chapter/page
98 
102  protected $export_all_languages = false;
103 
108 
112  public $deactivated_page = false;
113 
118 
123 
128 
132  protected $requested_ref_id;
133 
137  protected $requested_obj_id;
138 
143 
147  protected $requested_transl;
148 
152  protected $requested_frame;
153 
157  protected $linker;
158 
162  protected $service;
163 
164  public function __construct(
165  $a_export_format = "",
166  $a_all_languages = false,
167  $a_export_dir = "",
168  bool $claim_repo_context = true
169  ) {
170  global $DIC;
171 
172  $this->offline = ($a_export_format != "");
173  $this->export_all_languages = $a_all_languages;
174  $this->export_format = $a_export_format; // html/scorm
175  $this->offline_directory = $a_export_dir;
176 
177  $this->tabs = $DIC->tabs();
178  $this->user = $DIC->user();
179  $this->rbacsystem = $DIC->rbac()->system();
180  $this->error = $DIC["ilErr"];
181  $this->nav_history = $DIC["ilNavigationHistory"];
182  $this->access = $DIC->access();
183  $this->settings = $DIC->settings();
184  $this->locator = $DIC["ilLocator"];
185  $this->tree = $DIC->repositoryTree();
186  $this->help = $DIC["ilHelp"];
187 
188  $lng = $DIC->language();
189  $rbacsystem = $DIC->rbac()->system();
190  $ilCtrl = $DIC->ctrl();
191  $ilErr = $DIC["ilErr"];
192 
193  // load language vars
194  $lng->loadLanguageModule("content");
195 
196  $this->lng = $lng;
197  $this->tpl = $DIC->ui()->mainTemplate();
198  $this->frames = array();
199  $this->ctrl = $ilCtrl;
200  $this->ctrl->saveParameter($this, array("ref_id", "transl", "focus_id", "focus_return"));
201 
202  // note: using $DIC->http()->request()->getQueryParams() here will
203  // fail, since the goto magic currently relies on setting $_GET
204  $this->initByRequest($_GET);
205 
206  // check, if learning module is online
207  if (!$rbacsystem->checkAccess("write", $this->requested_ref_id)) {
208  if ($this->lm->getOfflineStatus()) {
209  $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
210  }
211  }
212 
213  if ($claim_repo_context) {
214  $DIC->globalScreen()->tool()->context()->claim()->repository();
215 
216  // moved this into the if due to #0027200
217  if ($this->service->getPresentationStatus()->isTocNecessary()) {
218  $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
220  true
221  );
222  }
223  }
224  }
225 
234  public function initByRequest($query_params)
235  {
236  $this->service = new ilLMPresentationService(
237  $this->user,
238  $query_params,
239  $this->offline,
240  $this->export_all_languages,
241  $this->export_format
242  );
243 
244  $request = $this->service->getRequest();
245 
246  $this->requested_obj_type = $request->getRequestedObjType();
247  $this->requested_ref_id = $request->getRequestedRefId();
248  $this->requested_transl = $request->getRequestedTranslation(); // handled by presentation status
249  $this->requested_obj_id = $request->getRequestedObjId(); // handled by navigation status
250  $this->requested_back_pg = $request->getRequestedBackPage();
251  $this->requested_frame = $request->getRequestedFrame();
252  $this->requested_search_string = $request->getRequestedSearchString();
253  $this->requested_focus_return = $request->getRequestedFocusReturn();
254  $this->requested_mob_id = $request->getRequestedMobId();
255 
256  $this->lm_set = $this->service->getSettings();
257  $this->lm_gui = $this->service->getLearningModuleGUI();
258  $this->lm = $this->service->getLearningModule();
259  $this->tracker = $this->service->getTracker();
260  $this->linker = $this->service->getLinker();
261 
262  // language translation
263  $this->lang = $this->service->getPresentationStatus()->getLang();
264 
265  $this->lm_tree = $this->service->getLMTree();
266  $this->focus_id = $this->service->getPresentationStatus()->getFocusId();
267  }
268 
275  public function injectTemplate($tpl)
276  {
277  $this->tpl = $tpl;
278  }
279 
284  protected function getTracker()
285  {
286  return $this->service->getTracker();
287  }
288 
293  public function executeCommand()
294  {
295  $ilNavigationHistory = $this->nav_history;
296  $ilAccess = $this->access;
297  $lng = $this->lng;
301 
302  // check read permission and parent conditions
303  // todo: replace all this by ilAccess call
304  if (!$ilAccess->checkAccess("read", "", $this->requested_ref_id) &&
305  (!(($this->ctrl->getCmd() == "infoScreen" || $this->ctrl->getNextClass() == "ilinfoscreengui")
306  && $ilAccess->checkAccess("visible", "", $this->requested_ref_id)))) {
307  $ilErr->raiseError($lng->txt("permission_denied"), $ilErr->WARNING);
308  }
309 
310  $next_class = $this->ctrl->getNextClass($this);
311  $cmd = $this->ctrl->getCmd("layout", array("showPrintView"));
312 
313 
314  $obj_id = $this->requested_obj_id;
315  $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
316  $ilNavigationHistory->addItem($this->requested_ref_id, $this->ctrl->getLinkTarget($this), "lm");
317  $this->ctrl->setParameter($this, "obj_id", $obj_id);
318 
319  switch ($next_class) {
320  case "ilnotegui":
321  $ret = $this->layout();
322  break;
323 
324  case "ilinfoscreengui":
325  $ret = $this->outputInfoScreen();
326  break;
327 
328  case "ilcommonactiondispatchergui":
330  $gui->enableCommentsSettings(false);
331  $this->ctrl->forwardCommand($gui);
332  break;
333 
334  case "illmpagegui":
335  $page_gui = $this->getLMPageGUI($this->requested_obj_id);
336  $this->basicPageGuiInit($page_gui);
337  $ret = $ilCtrl->forwardCommand($page_gui);
338  break;
339 
340  case "ilglossarydefpagegui":
341  $page_gui = new ilGlossaryDefPageGUI($this->requested_obj_id);
342  $this->basicPageGuiInit($page_gui);
343  $ret = $ilCtrl->forwardCommand($page_gui);
344  break;
345 
346  case "illearningprogressgui":
347  $this->initScreenHead("learning_progress");
348  $new_gui = new ilLearningProgressGUI(
350  $this->requested_ref_id,
351  $ilUser->getId()
352  );
353  $this->ctrl->forwardCommand($new_gui);
354  break;
355 
356  case "ilratinggui":
357  $rating_gui = new ilRatingGUI();
358  $rating_gui->setObject($this->lm->getId(), "lm", $this->requested_obj_id, "lm");
359  $this->ctrl->forwardCommand($rating_gui);
360  break;
361 
362  default:
363  if ($_GET["ntf"]) {
364  switch ($_GET["ntf"]) {
365  case 1:
366  ilNotification::setNotification(ilNotification::TYPE_LM, $this->user->getId(), $this->lm->getId(), false);
367  break;
368 
369  case 2:
370  ilNotification::setNotification(ilNotification::TYPE_LM, $this->user->getId(), $this->lm->getId(), true);
371  break;
372 
373  case 3:
375  break;
376 
377  case 4:
379  break;
380  }
381  $ilCtrl->redirect($this, "layout");
382  }
383  $ret = $this->$cmd();
384  break;
385  }
386  }
387 
388 
389 
393  public function offlineMode()
394  {
395  return $this->offline;
396  }
397 
398 
404  public function getExportFormat()
405  {
406  return $this->export_format;
407  }
408 
412  public function nop()
413  {
414  }
415 
416  public function attrib2arr($a_attributes)
417  {
418  $attr = array();
419  if (!is_array($a_attributes)) {
420  return $attr;
421  }
422  foreach ($a_attributes as $attribute) {
423  $attr[$attribute->name()] = $attribute->value();
424  }
425  return $attr;
426  }
427 
431  public function getCurrentFrameSet()
432  {
433  return $this->frames;
434  }
435 
440  public function determineLayout() : string
441  {
442  return "standard";
443  }
444 
445  public function resume()
446  {
447  $this->layout();
448  }
449 
453  public function layout($a_xml = "main.xml", $doShow = true)
454  {
455  global $DIC;
456 
457  $tpl = $this->tpl;
461  $layout = $this->determineLayout();
462 
463  // xmldocfile is deprecated! Use domxml_open_file instead.
464  // But since using relative pathes with domxml under windows don't work,
465  // we need another solution:
466  $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/" . $layout . "/" . $a_xml);
467 
468  if (!$doc = domxml_open_mem($xmlfile)) {
469  throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Error reading " .
470  $layout . "/" . $a_xml . ".");
471  }
472  $this->layout_doc = $doc;
473  //echo ":".htmlentities($xmlfile).":$layout:$a_xml:";
474 
475  // get current frame node
476  $xpc = xpath_new_context($doc);
477  $path = (empty($this->requested_frame) || ($this->requested_frame == "_blank"))
478  ? "/ilLayout/ilFrame[1]"
479  : "//ilFrame[@name='" . $this->requested_frame . "']";
480  $result = xpath_eval($xpc, $path);
481  $found = $result->nodeset;
482  if (count($found) != 1) {
483  throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Found " . count($found) . " nodes for " .
484  " path " . $path . " in " . $layout . "/" . $a_xml . ". LM Layout is " . $this->lm->getLayout());
485  }
486  $node = $found[0];
487 
488  // ProcessFrameset
489  // node is frameset, if it has cols or rows attribute
490  $attributes = $this->attrib2arr($node->attributes());
491 
492  $this->frames = array();
493 
494  // ProcessContentTag
495  if ((empty($attributes["template"]) || !empty($this->requested_obj_type))
496  && ($this->requested_frame != "_blank" || $this->requested_obj_type != "MediaObject")) {
497  // we got a variable content frame (can display different
498  // object types (PageObject, MediaObject, GlossarItem)
499  // and contains elements for them)
500 
501  // determine object type
502  if (empty($this->requested_obj_type)) {
503  $obj_type = "PageObject";
504  } else {
505  $obj_type = $this->requested_obj_type;
506  }
507 
508  // get object specific node
509  $childs = $node->child_nodes();
510  $found = false;
511  foreach ($childs as $child) {
512  if ($child->node_name() == $obj_type) {
513  $found = true;
514  $attributes = $this->attrib2arr($child->attributes());
515  $node = $child;
516  //echo "<br>2node:".$node->node_name();
517  break;
518  }
519  }
520  if (!$found) {
521  throw new ilLMPresentationException("ilLMPresentation: No template specified for frame '" .
522  $this->requested_frame . "' and object type '" . $obj_type . "'.");
523  }
524  }
525 
526  // get template
527  $in_module = ($attributes["template_location"] == "module")
528  ? true
529  : false;
530  /* if ($in_module)
531  {
532  $this->tpl = new ilGlobalTemplate($attributes["template"], true, true, $in_module);
533  $this->tpl->setBodyClass("");
534  }
535  else
536  {
537  $this->tpl = $tpl;
538  }*/
539 
540  // set style sheets
541  if (!$this->offlineMode()) {
542  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
543  } else {
544  $style_name = $ilUser->getPref("style") . ".css";
545  $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
546  }
547 
548  iljQueryUtil::initjQuery($this->tpl);
549  iljQueryUtil::initjQueryUI($this->tpl);
550 
551  ilUIFramework::init($this->tpl);
552 
553  // to make e.g. advanced seletions lists work:
554  // $GLOBALS["tpl"] = $this->tpl;
555 
556  $childs = $node->child_nodes();
557 
558  foreach ($childs as $child) {
559  $child_attr = $this->attrib2arr($child->attributes());
560 
561  switch ($child->node_name()) {
562  case "ilMainMenu":
563  // @todo 6.0
564 // $this->ilMainMenu();
565  break;
566 
567  case "ilTOC":
568  // @todo 6.0
569 // $this->ilTOC($child_attr["target_frame"]);
570  break;
571 
572  case "ilPage":
573  $this->renderPageTitle();
574  $this->setHeader();
575  $this->ilLMMenu();
576  $content = $this->getContent();
577  $content .= $this->ilLMNotes();
578  $this->tpl->setContent($content);
579  break;
580 
581  case "ilGlossary":
582  $content = $this->ilGlossary($child);
583  break;
584 
585  case "ilLMNavigation":
586  // @todo 6.0
587 // $this->ilLMNavigation();
588  break;
589 
590  case "ilMedia":
591  $this->media();
592  break;
593 
594  case "ilLocator":
595  $this->ilLocator();
596  break;
597 
598  case "ilJavaScript":
599  $this->ilJavaScript(
600  $child_attr["inline"],
601  $child_attr["file"],
602  $child_attr["location"]
603  );
604  break;
605 
606  case "ilLMMenu":
607  //$this->ilLMMenu();
608  break;
609 
610  case "ilLMHead":
611  // @todo 6.0
612 // $this->ilLMHead();
613  break;
614 
615  case "ilLMSubMenu":
616  $this->ilLMSubMenu();
617  break;
618 
619  case "ilLMNotes":
620  $this->ilLMNotes();
621  break;
622  }
623  }
624 
625  // 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)
626  // Unfortunately there is no standardized way to do this somewhere else. Calling fillJavaScripts always in ilTemplate causes multiple additions of the the js files.
627  // 19.7.2014: outcommented, since fillJavaScriptFiles is called in the next blocks, and the
628  // following lines would add the js files two times
629  // if (strcmp($this->requested_frame, "topright") == 0) $this->tpl->fillJavaScriptFiles();
630  // if (strcmp($this->requested_frame, "right") == 0) $this->tpl->fillJavaScriptFiles();
631  // if (strcmp($this->requested_frame, "botright") == 0) $this->tpl->fillJavaScriptFiles();
632 
633  if (!$this->offlineMode()) {
636 
637  $this->tpl->addJavascript("./Modules/LearningModule/js/LearningModule.js");
638  $close_call = "il.LearningModule.setCloseHTML('" . ilGlyphGUI::get(ilGlyphGUI::CLOSE) . "');";
639  $this->tpl->addOnLoadCode($close_call);
640 
641  //$store->set("cf_".$this->lm->getId());
642 
643  // handle initial content
644  if ($this->requested_frame == "") {
645  $store = new ilSessionIStorage("lm");
646  $last_frame_url = $store->get("cf_" . $this->lm->getId());
647  if ($last_frame_url != "") {
648  $this->tpl->addOnLoadCode("il.LearningModule.setLastFrameUrl('" . $last_frame_url . "', 'center_bottom');");
649  }
650 
651  if (in_array($layout, array("toc2windyn"))) {
652  $this->tpl->addOnLoadCode("il.LearningModule.setSaveUrl('" .
653  $ilCtrl->getLinkTarget($this, "saveFrameUrl", "", false, false) . "');
654  il.LearningModule.openInitFrames();
655  ");
656  }
657  $this->tpl->addOnLoadCode("il.LearningModule.setTocRefreshUrl('" .
658  $ilCtrl->getLinkTarget($this, "refreshToc", "", false, false) . "');
659  ");
660  }
661 
662  // from main menu
663  // $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
664  $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js");
665  ilYuiUtil::initConnection($this->tpl);
666 
667  // @todo 6.0
668  //$this->tpl->fillJavaScriptFiles();
669  //$this->tpl->fillScreenReaderFocus();
670  //$this->tpl->fillCssFiles();
671  } else {
672  // reset standard css files
673  /*
674  $this->tpl->resetJavascript();
675  $this->tpl->resetCss();
676  $this->tpl->setBodyClass("ilLMNoMenu");*/
677 
678  /*
679  foreach (ilObjContentObject::getSupplyingExportFiles() as $f)
680  {
681  if ($f["type"] == "js")
682  {
683  $this->tpl->addJavascript($f["target"]);
684  }
685  if ($f["type"] == "css")
686  {
687  $this->tpl->addCSS($f["target"]);
688  }
689  }
690  $this->tpl->fillJavaScriptFiles(true);
691  $this->tpl->fillCssFiles(true);*/
692  }
693 
694  // @todo 6.0
695  //$this->tpl->fillBodyClass();
696 
697  if ($doShow) {
698  // (horrible) workaround for preventing template engine
699  // from hiding paragraph text that is enclosed
700  // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage())
701 
702  // @todo 6.0
703  /*$this->tpl->fillTabs();
704  if ($this->fill_on_load_code)
705  {
706  $this->tpl->fillOnLoadCode();
707  }
708  $content = $this->tpl->get();
709  $content = str_replace("&#123;", "{", $content);
710  $content = str_replace("&#125;", "}", $content);
711 
712  header('Content-type: text/html; charset=UTF-8');
713  echo $content;*/
714  $tpl->printToStdout();
715  } else {
716  /*$tpl->printToStdout();
717  $this->tpl->fillLeftNav();
718  $this->tpl->fillOnLoadCode();*/
719 
720  $content = $tpl->printToString();
721  }
722 
723  return($content);
724  }
725 
732  public function saveFrameUrl()
733  {
734  $store = new ilSessionIStorage("lm");
735  if ($_GET["url"] != "") {
736  $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
737  } else {
738  $store->set("cf_" . $this->lm->getId(), $_GET["url"]);
739  }
740  }
741 
742 
743  public function fullscreen()
744  {
745  return $this->media();
746  }
747 
752  public function media()
753  {
754  $this->tpl = new ilGlobalTemplate("tpl.fullscreen.html", true, true, "Modules/LearningModule");
755  //$GLOBALS["tpl"] = $this->tpl;
756 
757  // set style sheets
758  $this->setContentStyles();
759  $this->setSystemStyle();
760 
761  $this->ilMedia();
762  if (!$this->offlineMode()) {
763  $this->tpl->printToStdout();
764  } else {
765  return $this->tpl->printToString();
766  }
767  return "";
768  }
769 
774  public function glossary()
775  {
776  $this->tpl = new ilGlobalTemplate("tpl.glossary_term_output.html", true, true, "Modules/LearningModule");
777  //$GLOBALS["tpl"] = $this->tpl;
778  $this->renderPageTitle();
779 
780  // set style sheets
781  $this->setContentStyles();
782  $this->setSystemStyle();
783 
784  $this->ilGlossary();
785  if (!$this->offlineMode()) {
786  $this->tpl->printToStdout();
787  } else {
788  return $this->tpl->printToString();
789  }
790 
791  return "";
792  }
793 
794  public function page()
795  {
796  global $DIC;
797 
799 
800  //if ($this->requested_frame != "_blank")
801  //{
802  // $this->layout();
803  //}
804  //else
805  //{
806  $this->tpl = new ilGlobalTemplate("tpl.page_fullscreen.html", true, true, "Modules/LearningModule");
807  $GLOBALS["tpl"] = $this->tpl;
808  $this->renderPageTitle();
809 
810  $this->setContentStyles();
811 
812  // set style sheets
813  if (!$this->offlineMode()) {
814  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
815  } else {
816  $style_name = $ilUser->getPref("style") . ".css";
817  ;
818  $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
819  }
820 
821  $this->tpl->setVariable("PAGE_CONTENT", $this->getPageContent());
822  if (!$this->offlineMode()) {
823  $this->tpl->printToStdout();
824  } else {
825  return $this->tpl->get();
826  }
827  //}
828  }
829 
833  public function ilMainMenu()
834  {
835  // LTI
836  global $DIC;
837  $ltiview = $DIC["lti"];
838  if ($ltiview->isActive()) {
839  $ilMainMenu = new LTI\ilMainMenuGUI("_top", false, $this->tpl);
840  } else {
841  $ilMainMenu = new ilMainMenuGUI("_top", false, $this->tpl);
842  }
843 
844  if ($this->offlineMode()) {
845  $this->tpl->touchBlock("pg_intro");
846  $this->tpl->touchBlock("pg_outro");
847  return;
848  }
849 
850  $page_id = $this->getCurrentPageId();
851  if ($page_id > 0) {
852  $ilMainMenu->setLoginTargetPar("pg_" . $page_id . "_" . $this->lm->getRefId());
853  }
854 
855  //$this->tpl->touchBlock("mm_intro");
856  //$this->tpl->touchBlock("mm_outro");
857  $this->tpl->touchBlock("pg_intro");
858  $this->tpl->touchBlock("pg_outro");
859  $this->tpl->setBodyClass("std");
860  $this->tpl->setVariable("MAINMENU", $ilMainMenu->getHTML());
861  // LTI
862  $this->tpl->setVariable("MAINMENU_SPACER", $ilMainMenu->getSpacerClass());
863  }
864 
868  public function ilTOC($a_get_explorer = false)
869  {
870  $fac = new ilLMTOCExplorerGUIFactory();
871  $exp = $fac->getExplorer($this->service, "ilTOC");
872  $exp->handleCommand();
873  return $exp;
874  }
875 
882  public function getLMPresentationTitle()
883  {
884  return $this->service->getPresentationStatus()->getLMPresentationTitle();
885  }
886 
887 
891  public function ilLMMenu()
892  {
893  $this->renderTabs("content", $this->getCurrentPageId());
894  /*$this->tpl->setVariable("MENU", $this->lm_gui->setilLMMenu($this->offlineMode()
895  ,$this->getExportFormat(), "content", false, true, $this->getCurrentPageId(),
896  $this->lang, $this->export_all_languages));*/
897  }
898 
902  public function setHeader()
903  {
904  $this->tpl->setTitle($this->getLMPresentationTitle());
905  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
906  }
907 
911  public function ilLMSubMenu()
912  {
914  if ($this->abstract) {
915  return;
916  }
917 
918  $showViewInFrameset = true;
919 
920  if ($showViewInFrameset) {
921  $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
922  } else {
923  $buttonTarget = "_top";
924  }
925 
926 
927  $tpl_menu = new ilTemplate("tpl.lm_sub_menu.html", true, true, "Modules/LearningModule");
928 
929  $pg_id = $this->getCurrentPageId();
930  if ($pg_id == 0) {
931  return;
932  }
933 
934  // edit learning module
935  if (!$this->offlineMode()) {
936  if ($rbacsystem->checkAccess("write", $this->requested_ref_id)) {
937  $tpl_menu->setCurrentBlock("edit_page");
938  $page_id = $this->getCurrentPageId();
939  $tpl_menu->setVariable("EDIT_LINK", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $this->requested_ref_id .
940  "&obj_id=" . $page_id . "&to_page=1");
941  $tpl_menu->setVariable("EDIT_TXT", $this->lng->txt("edit_page"));
942  $tpl_menu->setVariable("EDIT_TARGET", $buttonTarget);
943  $tpl_menu->parseCurrentBlock();
944  }
945 
946  $page_id = $this->getCurrentPageId();
947 
948  // permanent link
949  $this->tpl->setPermanentLink("pg", "", $page_id . "_" . $this->lm->getRefId());
950  }
951 
952  $this->tpl->setVariable("SUBMENU", $tpl_menu->get());
953  }
954 
955 
959  public function redrawHeaderAction()
960  {
961  echo $this->addHeaderAction(true);
962  exit;
963  }
964 
968  public function addHeaderAction($a_redraw = false)
969  {
970  if ($this->offline) {
971  return;
972  }
973  $ilAccess = $this->access;
974  $tpl = $this->tpl;
975 
976  $lm_id = $this->lm->getId();
977  $pg_id = $this->getCurrentPageId();
978 
979  $this->lng->loadLanguageModule("content");
980 
981  $dispatcher = new ilCommonActionDispatcherGUI(
983  $ilAccess,
984  $this->lm->getType(),
986  $this->lm->getId()
987  );
988  $dispatcher->setSubObject("pg", $this->getCurrentPageId());
989 
990  ilObjectListGUI::prepareJSLinks(
991  $this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true),
992  $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
993  $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false),
994  $this->tpl
995  );
996 
997  $lg = $dispatcher->initHeaderAction();
998  $lg->enableNotes(true);
999  $lg->enableComments($this->lm->publicNotes(), false);
1000 
1001  if ($this->lm->hasRating() && !$this->offlineMode()) {
1002  $lg->enableRating(
1003  true,
1004  $this->lng->txt("lm_rating"),
1005  false,
1006  array("ilcommonactiondispatchergui", "ilratinggui")
1007  );
1008  }
1009 
1010  // notification
1011  if ($this->user->getId() != ANONYMOUS_USER_ID) {
1012  if (ilNotification::hasNotification(ilNotification::TYPE_LM, $this->user->getId(), $lm_id)) {
1013  $this->ctrl->setParameter($this, "ntf", 1);
1014  if (ilNotification::hasOptOut($lm_id)) {
1015  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_deactivate_lm");
1016  }
1017 
1018  $lg->addHeaderIcon(
1019  "not_icon",
1020  ilUtil::getImagePath("notification_on.svg"),
1021  $this->lng->txt("cont_notification_activated")
1022  );
1023  } else {
1024  $this->ctrl->setParameter($this, "ntf", 2);
1025  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_activate_lm");
1026 
1027  if (ilNotification::hasNotification(ilNotification::TYPE_LM_PAGE, $this->user->getId(), $pg_id)) {
1028  $this->ctrl->setParameter($this, "ntf", 3);
1029  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_deactivate_page");
1030 
1031  $lg->addHeaderIcon(
1032  "not_icon",
1033  ilUtil::getImagePath("notification_on.svg"),
1034  $this->lng->txt("cont_page_notification_activated")
1035  );
1036  } else {
1037  $this->ctrl->setParameter($this, "ntf", 4);
1038  $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "cont_notification_activate_page");
1039 
1040  $lg->addHeaderIcon(
1041  "not_icon",
1042  ilUtil::getImagePath("notification_off.svg"),
1043  $this->lng->txt("cont_notification_deactivated")
1044  );
1045  }
1046  }
1047  $this->ctrl->setParameter($this, "ntf", "");
1048  }
1049 
1050  if (!$this->offline) {
1051  if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1052  if ($this->getCurrentPageId() <= 0) {
1053  $link = $this->ctrl->getLinkTargetByClass(["ilLMEditorGUI", "ilobjlearningmodulegui"], "chapters");
1054  } else {
1055  $link = ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $this->requested_ref_id .
1056  "&obj_id=" . $this->getCurrentPageId() . "&to_page=1";
1057  }
1058  $lg->addCustomCommand($link, "edit_page");
1059  }
1060  }
1061 
1062 
1063  if (!$a_redraw) {
1064  $this->tpl->setVariable("HEAD_ACTION", $lg->getHeaderAction($this->tpl));
1065  } else {
1066  // we need to add onload code manually (rating, comments, etc.)
1067  return $lg->getHeaderAction() .
1068  $tpl->getOnLoadCodeForAsynch();
1069  }
1070  }
1071 
1075  public function ilLMNotes() : string
1076  {
1077  $ilAccess = $this->access;
1079 
1080  // no notes in offline (export) mode
1081  if ($this->offlineMode()) {
1082  return "";
1083  }
1084 
1085  // output notes (on top)
1086 
1087  if (!$ilSetting->get("disable_notes")) {
1088  $this->addHeaderAction();
1089  }
1090 
1091  // now output comments
1092 
1093  if ($ilSetting->get("disable_comments")) {
1094  return "";
1095  }
1096  if (!$this->lm->publicNotes()) {
1097  return "";
1098  }
1099 
1100  $next_class = $this->ctrl->getNextClass($this);
1101 
1102  $pg_id = $this->getCurrentPageId();
1103 
1104  if ($pg_id == 0) {
1105  return "";
1106  }
1107  $notes_gui = new ilNoteGUI($this->lm->getId(), $this->getCurrentPageId(), "pg");
1108 
1109  if ($ilAccess->checkAccess("write", "", $this->requested_ref_id) &&
1110  $ilSetting->get("comments_del_tutor", 1)) {
1111  $notes_gui->enablePublicNotesDeletion(true);
1112  }
1113 
1114  $this->ctrl->setParameter($this, "frame", $this->requested_frame);
1115  $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1116 
1117  $notes_gui->enablePrivateNotes();
1118  if ($this->lm->publicNotes()) {
1119  $notes_gui->enablePublicNotes();
1120  }
1121 
1122  $callback = array($this, "observeNoteAction");
1123  $notes_gui->addObserver($callback);
1124 
1125  if ($next_class == "ilnotegui") {
1126  $html = $this->ctrl->forwardCommand($notes_gui);
1127  } else {
1128  $html = $notes_gui->getNotesHTML();
1129  }
1130  return $html;
1131  }
1132 
1133 
1137  public function ilLocator($a_std_templ_loaded = false)
1138  {
1139  global $DIC;
1140  $ltiview = $DIC["lti"];
1141  $ilLocator = $this->locator;
1142  $tree = $this->tree;
1143  $ilCtrl = $this->ctrl;
1144 
1145  if (empty($this->requested_obj_id)) {
1146  $a_id = $this->lm_tree->getRootId();
1147  } else {
1148  $a_id = $this->requested_obj_id;
1149  }
1150 
1151 
1152  if (!$this->lm->cleanFrames()) {
1153  $frame_param = $this->requested_frame;
1154  $frame_target = "";
1155  } elseif (!$this->offlineMode()) {
1156  $frame_param = "";
1157  $frame_target = ilFrameTargetInfo::_getFrame("MainContent");
1158  } else {
1159  $frame_param = "";
1160  $frame_target = "_top";
1161  }
1162 
1163  if (!$this->offlineMode()) {
1164  // LTI
1165  if ($ltiview->isActive()) {
1166  $ilLocator->addRepositoryItems();
1167  } else {
1168  $ilLocator->addRepositoryItems();
1169  //$ilLocator->addItem("...", "");
1170 
1171  /*
1172  $par_id = $tree->getParentId($this->requested_ref_id);
1173  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $par_id);
1174  $ilLocator->addItem(
1175  ilObject::_lookupTitle(ilObject::_lookupObjId($par_id)),
1176  $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
1177  ilFrameTargetInfo::_getFrame("MainContent"), $par_id);
1178  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->requested_ref_id);*/
1179  }
1180  } else {
1181  $ilLocator->setOffline(true);
1182  }
1183 
1184  if ($this->lm_tree->isInTree($a_id)) {
1185  $path = $this->lm_tree->getPathFull($a_id);
1186 
1187  foreach ($path as $key => $row) {
1188  if ($row["type"] != "pg") {
1189  if ($row["child"] != $this->lm_tree->getRootId()) {
1190  $ilLocator->addItem(
1193  $row["child"],
1194  ilLMOBject::CHAPTER_TITLE,
1195  $this->lm->isActiveNumbering(),
1196  $this->lm_set->get("time_scheduled_page_activation"),
1197  false,
1198  0,
1199  $this->lang
1200  ),
1201  50,
1202  true
1203  ),
1204  $this->linker->getLink("layout", $row["child"], $frame_param, "StructureObject"),
1205  $frame_target
1206  );
1207  } else {
1208  $ilLocator->addItem(
1209  ilUtil::shortenText($this->getLMPresentationTitle(), 50, true),
1210  $this->linker->getLink("layout", "", $frame_param),
1211  $frame_target,
1213  );
1214  }
1215  }
1216  }
1217  } else { // lonely page
1218  $ilLocator->addItem(
1219  $this->getLMPresentationTitle(),
1220  $this->linker->getLink("layout", "", $this->requested_frame)
1221  );
1222 
1223  $lm_obj = ilLMObjectFactory::getInstance($this->lm, $a_id);
1224 
1225  $ilLocator->addItem(
1226  $lm_obj->getTitle(),
1227  $this->linker->getLink("layout", $a_id, $frame_param),
1228  $frame_target
1229  );
1230  }
1231 
1232  if (DEBUG) {
1233  $debug = "DEBUG: <font color=\"red\">" . $this->type . "::" . $this->id . "::" . $_GET["cmd"] . "</font><br/>";
1234  }
1235 
1236  //$prop_name = $this->objDefinition->getPropertyName($_GET["cmd"],$this->type);
1237 
1238 
1239  $this->tpl->setLocator();
1240  }
1241 
1247  public function getCurrentPageId()
1248  {
1249  return $this->service->getNavigationStatus()->getCurrentPage();
1250 
1251  $ilUser = $this->user;
1252 
1253  if (!$this->offlineMode() && $this->current_page_id !== false) {
1254  return $this->current_page_id;
1255  }
1256 
1257  $this->chapter_has_no_active_page = false;
1258  $this->deactivated_page = false;
1259 
1260  // determine object id
1261  if (empty($this->requested_obj_id)) {
1262  $obj_id = $this->lm_tree->getRootId();
1263  } else {
1264  $obj_id = $this->requested_obj_id;
1265  $active = ilLMPage::_lookupActive(
1266  $obj_id,
1267  $this->lm->getType(),
1268  $this->lm_set->get("time_scheduled_page_activation")
1269  );
1270 
1271  if (!$active &&
1272  ilLMPageObject::_lookupType($obj_id) == "pg") {
1273  $this->deactivated_page = true;
1274  }
1275  }
1276 
1277  // obj_id not in tree -> it is a unassigned page -> return page id
1278  if (!$this->lm_tree->isInTree($obj_id)) {
1279  return $obj_id;
1280  }
1281 
1282  $curr_node = $this->lm_tree->getNodeData($obj_id);
1283 
1284  $active = ilLMPage::_lookupActive(
1285  $obj_id,
1286  $this->lm->getType(),
1287  $this->lm_set->get("time_scheduled_page_activation")
1288  );
1289 
1290  if ($curr_node["type"] == "pg" &&
1291  $active) { // page in tree -> return page id
1292  $page_id = $curr_node["obj_id"];
1293  } else { // no page -> search for next page and return its id
1294  $succ_node = true;
1295  $active = false;
1296  $page_id = $obj_id;
1297  while ($succ_node && !$active) {
1298  $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, "pg");
1299  $page_id = $succ_node["obj_id"];
1300  $active = ilLMPage::_lookupActive(
1301  $page_id,
1302  $this->lm->getType(),
1303  $this->lm_set->get("time_scheduled_page_activation")
1304  );
1305  }
1306 
1307  if ($succ_node["type"] != "pg") {
1308  $this->chapter_has_no_active_page = true;
1309  return 0;
1310  }
1311 
1312  // if public access get first public page in chapter
1313  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
1314  $this->lm_gui->object->getPublicAccessMode() == 'selected') {
1315  $public = ilLMObject::_isPagePublic($page_id);
1316 
1317  while ($public === false && $page_id > 0) {
1318  $succ_node = $this->lm_tree->fetchSuccessorNode($page_id, 'pg');
1319  $page_id = $succ_node['obj_id'];
1320  $public = ilLMObject::_isPagePublic($page_id);
1321  }
1322  }
1323 
1324  // check whether page found is within "clicked" chapter
1325  if ($this->lm_tree->isInTree($page_id)) {
1326  $path = $this->lm_tree->getPathId($page_id);
1327  if (!in_array($this->requested_obj_id, $path)) {
1328  $this->chapter_has_no_active_page = true;
1329  }
1330  }
1331  }
1332 
1333  $this->current_page_id = $page_id;
1334  return $page_id;
1335  }
1336 
1337 
1338  public function getLayoutLinkTargets()
1339  {
1340  if (!is_object($this->layout_doc)) {
1341  return array();
1342  }
1343 
1344  $xpc = xpath_new_context($this->layout_doc);
1345 
1346  $path = "/ilLayout/ilLinkTargets/LinkTarget";
1347  $res = xpath_eval($xpc, $path);
1348  $targets = array();
1349  for ($i = 0; $i < count($res->nodeset); $i++) {
1350  $type = $res->nodeset[$i]->get_attribute("Type");
1351  $frame = $res->nodeset[$i]->get_attribute("Frame");
1352  $onclick = $res->nodeset[$i]->get_attribute("OnClick");
1353  $targets[$type] = array("Type" => $type, "Frame" => $frame, "OnClick" => $onclick);
1354  }
1355  var_dump($targets);
1356  exit;
1357  return $targets;
1358  }
1359 
1363  protected function setContentStyles()
1364  {
1365  // content style
1366 
1367  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
1368  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
1369 
1370  /*
1371  $this->tpl->setCurrentBlock("ContentStyle");
1372  if (!$this->offlineMode())
1373  {
1374  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
1375  ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
1376  }
1377  else
1378  {
1379  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
1380  }
1381  $this->tpl->parseCurrentBlock();
1382 
1383  // syntax style
1384  $this->tpl->setCurrentBlock("SyntaxStyle");
1385  if (!$this->offlineMode())
1386  {
1387  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1388  ilObjStyleSheet::getSyntaxStylePath());
1389  }
1390  else
1391  {
1392  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET",
1393  "syntaxhighlight.css");
1394  }
1395  $this->tpl->parseCurrentBlock();*/
1396  }
1397 
1401  protected function setSystemStyle()
1402  {
1403  $this->tpl->addCss(ilUtil::getStyleSheetLocation());
1404  }
1405 
1406 
1407 
1408 
1416  public function getContent()
1417  {
1418  $this->fill_on_load_code = true;
1419  $this->setContentStyles();
1420 
1421  $tpl = new ilTemplate("tpl.lm_content.html", true, true, "Modules/LearningModule/Presentation");
1422 
1423  // call ilLMContentRendererGUI
1424 
1425  $navigation_renderer = new ilLMNavigationRendererGUI(
1426  $this->service,
1427  $this,
1428  $this->lng,
1429  $this->user,
1430  $this->tpl,
1431  $this->requested_obj_id,
1432  $this->requested_back_pg,
1433  $this->requested_frame
1434  );
1435 
1436 
1437  $tpl->setVariable("TOP_NAVIGATION", $navigation_renderer->renderTop());
1438  $tpl->setVariable("BOTTOM_NAVIGATION", $navigation_renderer->renderBottom());
1439  $tpl->setVariable("PAGE_CONTENT", $this->getPageContent());
1440  $tpl->setVariable("RATING", $this->renderRating());
1441 
1442 
1443  return $tpl->get();
1444  }
1445 
1449  protected function getPageContent()
1450  {
1451  $content_renderer = new ilLMContentRendererGUI(
1452  $this->service,
1453  $this,
1454  $this->lng,
1455  $this->ctrl,
1456  $this->access,
1457  $this->user,
1458  $this->help,
1459  $this->requested_obj_id
1460  );
1461 
1462  return $content_renderer->render();
1463  }
1464 
1470  protected function renderRating()
1471  {
1472  // rating
1473  $rating = "";
1474  if ($this->lm->hasRatingPages() && !$this->offlineMode()) {
1475  $rating_gui = new ilRatingGUI();
1476  $rating_gui->setObject($this->lm->getId(), "lm", $this->getCurrentPageId(), "lm");
1477  $rating_gui->setYourRatingText($this->lng->txt("lm_rate_page"));
1478 
1479  /*
1480  $this->tpl->setVariable("VAL_RATING", $rating->getHTML(false, true,
1481  "il.ExcPeerReview.saveComments(".$a_set["peer_id"].", %rating%)"));
1482  */
1483 
1484  $this->ctrl->setParameter($this, "pgid", $this->getCurrentPageId());
1485  $this->tpl->addOnLoadCode("il.LearningModule.setRatingUrl('" .
1486  $this->ctrl->getLinkTarget($this, "updatePageRating", "", true, false) .
1487  "')");
1488  $this->ctrl->setParameter($this, "pgid", "");
1489 
1490  $rating = '<div id="ilrtrpg" style="text-align:right">' .
1491  $rating_gui->getHtml(true, true, "il.LearningModule.saveRating(%rating%);") .
1492  "</div>";
1493  }
1494  return $rating;
1495  }
1496 
1497 
1498 
1499  public function updatePageRating()
1500  {
1501  $ilUser = $this->user;
1502 
1503  $pg_id = $_GET["pgid"];
1504  if (!$this->ctrl->isAsynch() || !$pg_id) {
1505  exit();
1506  }
1507 
1508  $rating = (int) $_POST["rating"];
1509  if ($rating) {
1511  $this->lm->getId(),
1512  "lm",
1513  $pg_id,
1514  "lm",
1515  $ilUser->getId(),
1516  $_POST["rating"]
1517  );
1518  } else {
1520  $this->lm->getId(),
1521  "lm",
1522  $pg_id,
1523  "lm",
1524  $ilUser->getId()
1525  );
1526  }
1527 
1528  $rating = new ilRatingGUI();
1529  $rating->setObject($this->lm->getId(), "lm", $pg_id, "lm", $ilUser->getId());
1530  $rating->setYourRatingText($this->lng->txt("lm_rate_page"));
1531 
1532  echo $rating->getHtml(true, true, "il.LearningModule.saveRating(%rating%);");
1533 
1534  echo $this->tpl->getOnLoadCodeForAsynch();
1535  exit();
1536  }
1537 
1544  public function basicPageGuiInit($a_page_gui)
1545  {
1546  $a_page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
1547  $this->lm->getStyleSheetId(),
1548  "lm"
1549  ));
1550  if (!$this->offlineMode()) {
1551  $a_page_gui->setOutputMode("presentation");
1552  $this->fill_on_load_code = true;
1553  } else {
1554  $a_page_gui->setOutputMode("offline");
1555  $a_page_gui->setOfflineDirectory($this->getOfflineDirectory());
1556  $this->fill_on_load_code = false;
1557  }
1558  if (!$this->offlineMode()) {
1559  $this->ctrl->setParameter($this, "obj_id", $this->getCurrentPageId()); // see #22403
1560  }
1561  $a_page_gui->setFileDownloadLink($this->linker->getLink("downloadFile"));
1562  $a_page_gui->setSourcecodeDownloadScript($this->linker->getLink("sourcecodeDownload",
1563  $this->getCurrentPageId()));
1564  if (!$this->offlineMode()) {
1565  $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1566  }
1567  $a_page_gui->setFullscreenLink($this->linker->getLink("fullscreen"));
1568  }
1569 
1570 
1574  public function ilGlossary()
1575  {
1576  $ilCtrl = $this->ctrl;
1577 
1578  $term_gui = new ilGlossaryTermGUI($this->requested_obj_id);
1579 
1580  // content style
1581  $this->setContentStyles();
1582 
1583  $term_gui->setPageLinker($this->linker);
1584 
1585  $term_gui->setOfflineDirectory($this->getOfflineDirectory());
1586  if (!$this->offlineMode()) {
1587  $ilCtrl->setParameter($this, "pg_type", "glo");
1588  }
1589  $term_gui->output($this->offlineMode(), $this->tpl);
1590 
1591 
1592  if (!$this->offlineMode()) {
1593  $ilCtrl->setParameter($this, "pg_type", "");
1594  }
1595  }
1596 
1600  public function ilMedia()
1601  {
1602  $this->setContentStyles();
1603 
1604  $this->renderPageTitle();
1605 
1606  $this->tpl->setCurrentBlock("ilMedia");
1607 
1608  $med_links = ilMediaItem::_getMapAreasIntLinks($this->requested_mob_id);
1609  $link_xml = $this->linker->getLinkXML($med_links);
1610 
1611  $media_obj = new ilObjMediaObject($this->requested_mob_id);
1612  if (!empty($_GET["pg_id"])) {
1613  $pg_obj = $this->getLMPage($_GET["pg_id"], $_GET["pg_type"]);
1614  $pg_obj->buildDom();
1615 
1616  $xml = "<dummy>";
1617  // todo: we get always the first alias now (problem if mob is used multiple
1618  // times in page)
1619  $xml .= $pg_obj->getMediaAliasElement($this->requested_mob_id);
1620  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
1621  $xml .= $link_xml;
1622  $xml .= "</dummy>";
1623  } else {
1624  $xml = "<dummy>";
1625  // todo: we get always the first alias now (problem if mob is used multiple
1626  // times in page)
1627  $xml .= $media_obj->getXML(IL_MODE_ALIAS);
1628  $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
1629  $xml .= $link_xml;
1630  $xml .= "</dummy>";
1631  }
1632 
1633 
1634  $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
1635  $args = array( '/_xml' => $xml, '/_xsl' => $xsl );
1636  $xh = xslt_create();
1637 
1638  if (!$this->offlineMode()) {
1639  $wb_path = ilUtil::getWebspaceDir("output") . "/";
1640  } else {
1641  $wb_path = "";
1642  }
1643 
1644  $mode = ($_GET["cmd"] == "fullscreen")
1645  ? "fullscreen"
1646  : "media";
1647  $enlarge_path = ilUtil::getImagePath("enlarge.svg", false, "output", $this->offlineMode());
1648  $fullscreen_link =
1649  $this->linker->getLink("fullscreen");
1650  $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path,
1651  'link_params' => "ref_id=" . $this->lm->getRefId(),'fullscreen_link' => $fullscreen_link,
1652  'ref_id' => $this->lm->getRefId(), 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
1653  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, $params);
1654 
1655  echo xslt_error($xh);
1656  xslt_free($xh);
1657 
1658  // unmask user html
1659  $this->tpl->setVariable("MEDIA_CONTENT", $output);
1660 
1661  // add js
1663  }
1664 
1668  public function ilJavaScript($a_inline = "", $a_file = "", $a_location = "")
1669  {
1670  if ($a_inline != "") {
1671  $js_tpl = new ilTemplate($a_inline, true, false, $a_location);
1672  $js = $js_tpl->get();
1673  $this->tpl->setVariable("INLINE_JS", $js);
1674  }
1675  }
1676 
1683  public function getSuccessorPage()
1684  {
1685  $ilUser = $this->user;
1686 
1687  $page_id = $this->getCurrentPageId();
1688 
1689  if (empty($page_id)) {
1690  return 0;
1691  }
1692 
1693  // determine successor page_id
1694  $found = false;
1695 
1696  // empty chapter
1697  if ($this->chapter_has_no_active_page &&
1698  ilLMObject::_lookupType($this->requested_obj_id) == "st") {
1699  $c_id = $this->requested_obj_id;
1700  } else {
1701  if ($this->deactivated_page) {
1702  $c_id = $this->requested_obj_id;
1703  } else {
1704  $c_id = $page_id;
1705  }
1706  }
1707  while (!$found) {
1708  $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
1709  $c_id = $succ_node["obj_id"];
1710 
1711  $active = ilLMPage::_lookupActive(
1712  $c_id,
1713  $this->lm->getType(),
1714  $this->lm_set->get("time_scheduled_page_activation")
1715  );
1716 
1717  if ($succ_node["obj_id"] > 0 &&
1718  $ilUser->getId() == ANONYMOUS_USER_ID &&
1719  ($this->lm->getPublicAccessMode() == "selected" &&
1720  !ilLMObject::_isPagePublic($succ_node["obj_id"]))) {
1721  $found = false;
1722  } elseif ($succ_node["obj_id"] > 0 && !$active) {
1723  // look, whether activation data should be shown
1724  $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType());
1725  if ($act_data["show_activation_info"] &&
1726  (ilUtil::now() < $act_data["activation_start"])) {
1727  $found = true;
1728  } else {
1729  $found = false;
1730  }
1731  } else {
1732  $found = true;
1733  }
1734  }
1735 
1736  if ($found) {
1737  return $succ_node["obj_id"];
1738  }
1739  return 0;
1740  }
1741 
1742 
1743  public function processNodes(&$a_content, &$a_node)
1744  {
1745  $child_nodes = $a_node->child_nodes();
1746  foreach ($child_nodes as $child) {
1747  if ($child->node_name() == "ilFrame") {
1748  $attributes = $this->attrib2arr($child->attributes());
1749  // node is frameset, if it has cols or rows attribute
1750  if ((!empty($attributes["rows"])) || (!empty($attrubtes["cols"]))) {
1751  // if framset has name, another http request is necessary
1752  // (html framesets don't have names, so we need a wrapper frame)
1753  if (!empty($attributes["name"])) {
1754  unset($attributes["template"]);
1755  unset($attributes["template_location"]);
1756  $attributes["src"] =
1757  $this->linker->getLink(
1758  "layout",
1759  $this->requested_obj_id,
1760  $attributes["name"],
1761  "",
1762  "keep",
1763  "",
1764  $_GET["srcstring"]
1765  );
1766  $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
1767  $a_content .= $this->buildTag("", "frame", $attributes);
1768  $this->frames[$attributes["name"]] = $attributes["name"];
1769  //echo "<br>processNodes:add1 ".$attributes["name"];
1770  } else { // ok, no name means that we can easily output the frameset tag
1771  $a_content .= $this->buildTag("start", "frameset", $attributes);
1772  $this->processNodes($a_content, $child);
1773  $a_content .= $this->buildTag("end", "frameset");
1774  }
1775  } else { // frame with
1776  unset($attributes["template"]);
1777  unset($attributes["template_location"]);
1778  $attributes["src"] =
1779  $this->linker->getLink(
1780  "layout",
1781  $this->requested_obj_id,
1782  $attributes["name"],
1783  "",
1784  "keep",
1785  "",
1786  $_GET["srcstring"]
1787  );
1788  $attributes["title"] = $this->lng->txt("cont_frame_" . $attributes["name"]);
1789  if ($attributes["name"] == "toc") {
1790  $attributes["src"] .= "#" . $this->requested_obj_id;
1791  } else {
1792  // Handle Anchors
1793  if ($_GET["anchor"] != "") {
1794  $attributes["src"] .= "#" . rawurlencode($_GET["anchor"]);
1795  }
1796  }
1797  $a_content .= $this->buildTag("", "frame", $attributes);
1798  $this->frames[$attributes["name"]] = $attributes["name"];
1799  }
1800  }
1801  }
1802  }
1803 
1811  public function buildTag($type, $name, $attr = "")
1812  {
1813  $tag = "<";
1814 
1815  if ($type == "end") {
1816  $tag .= "/";
1817  }
1818 
1819  $tag .= $name;
1820 
1821  if (is_array($attr)) {
1822  foreach ($attr as $k => $v) {
1823  $tag .= " " . $k . "=\"$v\"";
1824  }
1825  }
1826 
1827  if ($type == "") {
1828  $tag .= "/";
1829  }
1830 
1831  $tag .= ">\n";
1832 
1833  return $tag;
1834  }
1835 
1836 
1837 
1843  public function infoScreen()
1844  {
1845  $this->ctrl->setCmd("showSummary");
1846  $this->ctrl->setCmdClass("ilinfoscreengui");
1847  $this->outputInfoScreen();
1848  }
1849 
1853  public function showInfoScreen()
1854  {
1855  $this->outputInfoScreen(true);
1856  }
1857 
1858  protected function initScreenHead($a_active_tab = "info")
1859  {
1860  $ilAccess = $this->access;
1861  $ilLocator = $this->locator;
1862  $ilUser = $this->user;
1863 
1864  $this->renderPageTitle();
1865 
1866  // set style sheets
1867  /*
1868  if (!$this->offlineMode())
1869  {
1870  $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
1871  }
1872  else
1873  {
1874  $style_name = $ilUser->getPref("style").".css";;
1875  $this->tpl->setStyleSheetLocation("./".$style_name);
1876  }*/
1877 
1878  $this->tpl->loadStandardTemplate();
1879  $this->tpl->setTitle($this->getLMPresentationTitle());
1880  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
1881 
1882  $this->renderTabs($a_active_tab, 0);
1883  /*$this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
1884  ,$this->getExportFormat(), $a_active_tab, true, false, 0,
1885  $this->lang, $this->export_all_languages));*/
1886 
1887  // Full locator, if read permission is given
1888  if ($ilAccess->checkAccess("read", "", $this->requested_ref_id)) {
1889  $this->ilLocator(true);
1890  } else {
1891  $ilLocator->addRepositoryItems();
1892  $this->tpl->setLocator();
1893  }
1894  }
1895 
1899  public function outputInfoScreen($a_standard_locator = false)
1900  {
1901  $ilAccess = $this->access;
1902 
1903  $this->initScreenHead();
1904 
1905  $this->lng->loadLanguageModule("meta");
1906 
1907  $info = new ilInfoScreenGUI($this->lm_gui);
1908  $info->enablePrivateNotes();
1909  $info->enableLearningProgress();
1910 
1911  $info->enableNews();
1912  if ($ilAccess->checkAccess("write", "", $this->requested_ref_id)) {
1913  $news_set = new ilSetting("news");
1914  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1915 
1916  $info->enableNewsEditing();
1917 
1918  if ($enable_internal_rss) {
1919  $info->setBlockProperty("news", "settings", true);
1920  }
1921  }
1922 
1923  // add read / back button
1924  /*
1925  if ($ilAccess->checkAccess("read", "", $this->requested_ref_id))
1926  {
1927  if ($this->requested_obj_id > 0)
1928  {
1929  $this->ctrl->setParameter($this, "obj_id", $this->requested_obj_id);
1930  $info->addButton($this->lng->txt("back"),
1931  $this->ctrl->getLinkTarget($this, "layout"));
1932  }
1933  else
1934  {
1935  $info->addButton($this->lng->txt("view"),
1936  $this->ctrl->getLinkTarget($this, "layout"));
1937  }
1938  }*/
1939 
1940  // show standard meta data section
1941  $info->addMetaDataSections($this->lm->getId(), 0, $this->lm->getType());
1942 
1943  if ($this->offlineMode()) {
1944  $this->tpl->setContent($info->getHTML());
1945  return $this->tpl->get();
1946  } else {
1947  // forward the command
1948  $this->ctrl->forwardCommand($info);
1949  //$this->tpl->setContent("aa");
1950  $this->tpl->printToStdout();
1951  }
1952  }
1953 
1957  public function showPrintViewSelection()
1958  {
1959  $ilUser = $this->user;
1960  $lng = $this->lng;
1961 
1962  if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
1963  return;
1964  }
1965 
1966 
1967  $this->setContentStyles();
1968  $this->renderPageTitle();
1969 
1970  $this->tpl->loadStandardTemplate();
1971 
1972  $this->renderTabs("print", 0);
1973  /*$this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode()
1974  ,$this->getExportFormat(), "print", true,false, 0,
1975  $this->lang, $this->export_all_languages));*/
1976 
1977  $this->ilLocator(true);
1978  $this->tpl->addBlockFile(
1979  "ADM_CONTENT",
1980  "adm_content",
1981  "tpl.lm_print_selection.html",
1982  "Modules/LearningModule"
1983  );
1984 
1985  // set title header
1986  $this->tpl->setTitle($this->getLMPresentationTitle());
1987  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
1988 
1989  /*$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
1990  $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $this->requested_obj_id);
1991  $this->tpl->setVariable("LINK_BACK",
1992  $this->ctrl->getLinkTargetByClass("illmpresentationgui", ""));*/
1993 
1994  $this->ctrl->setParameterByClass("illmpresentationgui", "obj_id", $this->requested_obj_id);
1995  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormaction($this));
1996 
1997  $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
1998  $nodes = $this->filterNonAccessibleNode($nodes);
1999 
2000  if (!is_array($_POST["item"])) {
2001  if ($this->requested_obj_id != "") {
2002  $_POST["item"][$this->requested_obj_id] = "y";
2003  } else {
2004  $_POST["item"][1] = "y";
2005  }
2006  }
2007 
2008  $this->initPrintViewSelectionForm();
2009 
2010  foreach ($nodes as $node) {
2011 
2012  // check page activation
2013  $active = ilLMPage::_lookupActive(
2014  $node["obj_id"],
2015  $this->lm->getType(),
2016  $this->lm_set->get("time_scheduled_page_activation")
2017  );
2018 
2019  if ($node["type"] == "pg" &&
2020  !$active) {
2021  continue;
2022  }
2023 
2024  $text = $img_scr = $img_alt = "";
2025  $disabled = false;
2026  $checked = false;
2027 
2028  switch ($node["type"]) {
2029  // page
2030  case "pg":
2031  $text =
2033  $node["obj_id"],
2034  $this->lm->getPageHeader(),
2035  $this->lm->isActiveNumbering(),
2036  $this->lm_set->get("time_scheduled_page_activation"),
2037  false,
2038  0,
2039  $this->lang
2040  );
2041 
2042  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2043  $this->lm_gui->object->getPublicAccessMode() == "selected") {
2044  if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2045  $disabled = true;
2046  $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2047  }
2048  }
2049  $img_src = ilUtil::getImagePath("icon_pg.svg");
2050  $img_alt = $lng->txt("icon") . " " . $lng->txt("pg");
2051  break;
2052 
2053  // learning module
2054  case "du":
2055  $text = $this->getLMPresentationTitle();
2056  $img_src = ilUtil::getImagePath("icon_lm.svg");
2057  $img_alt = $lng->txt("icon") . " " . $lng->txt("obj_lm");
2058  break;
2059 
2060  // chapter
2061  case "st":
2062  $text =
2064  $node["obj_id"],
2065  ilLMOBject::CHAPTER_TITLE,
2066  $this->lm->isActiveNumbering(),
2067  $this->lm_set->get("time_scheduled_page_activation"),
2068  false,
2069  0,
2070  $this->lang
2071  );
2072  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2073  $this->lm_gui->object->getPublicAccessMode() == "selected") {
2074  if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2075  $disabled = true;
2076  $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2077  }
2078  }
2079  $img_src = ilUtil::getImagePath("icon_st.svg");
2080  $img_alt = $lng->txt("icon") . " " . $lng->txt("st");
2081  break;
2082  }
2083 
2084  if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
2085  $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2086  }
2087 
2088  $this->nl->addListNode(
2089  $node["obj_id"],
2090  $text,
2091  $node["parent"],
2092  $checked,
2093  $disabled,
2094  $img_src,
2095  $img_alt
2096  );
2097  }
2098 
2099 
2100  // check for free page
2101  if ($this->requested_obj_id > 0 && !$this->lm_tree->isInTree($this->requested_obj_id)) {
2102  $text =
2104  $this->requested_obj_id,
2105  $this->lm->getPageHeader(),
2106  $this->lm->isActiveNumbering(),
2107  $this->lm_set->get("time_scheduled_page_activation"),
2108  false,
2109  0,
2110  $this->lang
2111  );
2112 
2113  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2114  $this->lm_gui->object->getPublicAccessMode() == "selected") {
2115  if (!ilLMObject::_isPagePublic($this->requested_obj_id)) {
2116  $disabled = true;
2117  $text .= " (" . $this->lng->txt("cont_no_access") . ")";
2118  }
2119  }
2120  $img_src = ilUtil::getImagePath("icon_pg.svg");
2122 
2123  $checked = true;
2124 
2125  $this->nl->addListNode(
2126  $id,
2127  $text,
2128  0,
2129  $checked,
2130  $disabled,
2131  $img_src,
2132  $img_alt
2133  );
2134  }
2135 
2136  $f = $this->form->getHTML();
2137 
2138  // submit toolbar
2139  $tb = new ilToolbarGUI();
2140  $tb->addFormButton($lng->txt("cont_show_print_view"), "showPrintView");
2141  $this->tpl->setVariable("TOOLBAR", $tb->getHTML());
2142 
2143  $this->tpl->setVariable("ITEM_SELECTION", $f);
2144  $this->tpl->printToStdout();
2145  }
2146 
2151  protected function filterNonAccessibleNode($nodes)
2152  {
2153  $tracker = $this->getTracker();
2154  // if navigation is restricted based on correct answered questions
2155  // check if we have preceeding pages including unsanswered/incorrect answered questions
2156  if (!$this->offlineMode()) {
2157  if ($this->lm->getRestrictForwardNavigation()) {
2158  $nodes = array_filter($nodes, function ($node) use ($tracker) {
2159  return !$tracker->hasPredIncorrectAnswers($node["child"]);
2160  });
2161  }
2162  }
2163  return $nodes;
2164  }
2165 
2166 
2170  public function initPrintViewSelectionForm()
2171  {
2172  $lng = $this->lng;
2173  $ilCtrl = $this->ctrl;
2174 
2175  $this->form = new ilPropertyFormGUI();
2176 
2177  // selection type
2178  $radg = new ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
2179  $radg->setValue("page");
2180  $op1 = new ilRadioOption($lng->txt("cont_current_page"), "page");
2181  $radg->addOption($op1);
2182  $op2 = new ilRadioOption($lng->txt("cont_current_chapter"), "chapter");
2183  $radg->addOption($op2);
2184  $op3 = new ilRadioOption($lng->txt("cont_selected_pg_chap"), "selection");
2185  $radg->addOption($op3);
2186 
2187  $nl = new ilNestedListInputGUI("", "obj_id");
2188  $this->nl = $nl;
2189  $op3->addSubItem($nl);
2190 
2191 
2192  $this->form->addItem($radg);
2193 
2194  $this->form->addCommandButton("showPrintView", $lng->txt("cont_show_print_view"));
2195  $this->form->setOpenTag(false);
2196  $this->form->setCloseTag(false);
2197 
2198  $this->form->setTitle($lng->txt("cont_print_selection"));
2199  $this->form->setFormAction($ilCtrl->getFormAction($this));
2200  }
2201 
2205  public function showPrintView()
2206  {
2207  $ilUser = $this->user;
2208  $lng = $this->lng;
2209  $ilCtrl = $this->ctrl;
2210  $tabs = $this->tabs;
2211 
2212  if (!$this->lm->isActivePrintView() || !$this->lm->isActiveLMMenu()) {
2213  return;
2214  }
2215 
2216  $this->renderPageTitle();
2217 
2218  $tabs->setBackTarget(
2219  $lng->txt("back"),
2220  $ilCtrl->getLinkTarget($this, "showPrintViewSelection")
2221  );
2222 
2223  $c_obj_id = $this->getCurrentPageId();
2224  // set values according to selection
2225  if ($_POST["sel_type"] == "page") {
2226  if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) {
2227  $_POST["obj_id"][] = $c_obj_id;
2228  }
2229  }
2230  if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) {
2231  $path = $this->lm_tree->getPathFull($c_obj_id);
2232  $chap_id = $path[1]["child"];
2233  if ($chap_id > 0) {
2234  $_POST["obj_id"][] = $chap_id;
2235  }
2236  }
2237 
2238  $this->setContentStyles();
2239 
2240  $tpl = new ilTemplate("tpl.lm_print_view.html", true, true, "Modules/LearningModule");
2241 
2242  // set title header
2243  $this->tpl->setTitle($this->getLMPresentationTitle());
2244 
2245  $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
2246 
2247  $act_level = 99999;
2248  $activated = false;
2249 
2250  $glossary_links = array();
2251  $output_header = false;
2252  $media_links = array();
2253 
2254  // get header and footer
2255  if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
2256  if (ilLMObject::_exists($this->lm->getFooterPage())) {
2257  $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage());
2258  $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2259  $this->lm->getStyleSheetId(),
2260  "lm"
2261  ));
2262 
2263 
2264  // determine target frames for internal links
2265  $page_object_gui->setLinkFrame($this->requested_frame);
2266  $page_object_gui->setOutputMode("print");
2267  $page_object_gui->setPresentationTitle("");
2268  $page_object_gui->setFileDownloadLink("#");
2269  $page_object_gui->setFullscreenLink("#");
2270  $page_object_gui->setSourceCodeDownloadScript("#");
2271  $footer_page_content = $page_object_gui->showPage();
2272  }
2273  }
2274  if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
2275  if (ilLMObject::_exists($this->lm->getHeaderPage())) {
2276  $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage());
2277  $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2278  $this->lm->getStyleSheetId(),
2279  "lm"
2280  ));
2281 
2282 
2283  // determine target frames for internal links
2284  $page_object_gui->setLinkFrame($this->requested_frame);
2285  $page_object_gui->setOutputMode("print");
2286  $page_object_gui->setPresentationTitle("");
2287  $page_object_gui->setFileDownloadLink("#");
2288  $page_object_gui->setFullscreenLink("#");
2289  $page_object_gui->setSourceCodeDownloadScript("#");
2290  $header_page_content = $page_object_gui->showPage();
2291  }
2292  }
2293 
2294  // add free selected pages
2295  if (is_array($_POST["obj_id"])) {
2296  foreach ($_POST["obj_id"] as $k) {
2297  if ($k > 0 && !$this->lm_tree->isInTree($k)) {
2298  if (ilLMObject::_lookupType($k) == "pg") {
2299  $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true);
2300  }
2301  }
2302  }
2303  } else {
2304  ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true);
2305  $ilCtrl->redirect($this, "showPrintViewSelection");
2306  }
2307 
2308  foreach ($nodes as $node_key => $node) {
2309  // check page activation
2310  $active = ilLMPage::_lookupActive(
2311  $node["obj_id"],
2312  $this->lm->getType(),
2313  $this->lm_set->get("time_scheduled_page_activation")
2314  );
2315  if ($node["type"] == "pg" && !$active) {
2316  continue;
2317  }
2318 
2319  // print all subchapters/subpages if higher chapter
2320  // has been selected
2321  if ($node["depth"] <= $act_level) {
2322  if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) {
2323  $act_level = $node["depth"];
2324  $activated = true;
2325  } else {
2326  $act_level = 99999;
2327  $activated = false;
2328  }
2329  }
2330  if ($this->lm->getRestrictForwardNavigation()) {
2331  if ($this->getTracker()->hasPredIncorrectAnswers($node["obj_id"])) {
2332  continue;
2333  }
2334  }
2335  if ($activated &&
2336  ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
2337  // output learning module header
2338  if ($node["type"] == "du") {
2339  $output_header = true;
2340  }
2341 
2342  // output chapter title
2343  if ($node["type"] == "st") {
2344  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2345  $this->lm_gui->object->getPublicAccessMode() == "selected") {
2346  if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2347  continue;
2348  }
2349  }
2350 
2351  $chap = new ilStructureObject($this->lm, $node["obj_id"]);
2352  $tpl->setCurrentBlock("print_chapter");
2353 
2354  $chapter_title = $chap->_getPresentationTitle(
2355  $node["obj_id"],
2356  $this->lm->isActiveNumbering(),
2357  $this->lm_set->get("time_scheduled_page_activation"),
2358  0,
2359  $this->lang
2360  );
2361  $tpl->setVariable(
2362  "CHAP_TITLE",
2363  $chapter_title
2364  );
2365 
2366  if ($this->lm->getPageHeader() == ilLMOBject::CHAPTER_TITLE) {
2367  if ($nodes[$node_key + 1]["type"] == "pg") {
2368  $tpl->setVariable(
2369  "CHAP_HEADER",
2370  $header_page_content
2371  );
2372  $did_chap_page_header = true;
2373  }
2374  }
2375 
2376  $tpl->parseCurrentBlock();
2377  $tpl->setCurrentBlock("print_block");
2378  $tpl->parseCurrentBlock();
2379  }
2380 
2381  // output page
2382  if ($node["type"] == "pg") {
2383  if ($ilUser->getId() == ANONYMOUS_USER_ID &&
2384  $this->lm_gui->object->getPublicAccessMode() == "selected") {
2385  if (!ilLMObject::_isPagePublic($node["obj_id"])) {
2386  continue;
2387  }
2388  }
2389 
2390  $tpl->setCurrentBlock("print_item");
2391 
2392  // get page
2393  $page_id = $node["obj_id"];
2394  $page_object_gui = $this->getLMPageGUI($page_id);
2395  $page_object = $page_object_gui->getPageObject();
2396  $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(
2397  $this->lm->getStyleSheetId(),
2398  "lm"
2399  ));
2400 
2401 
2402  // get lm page
2403  $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
2404  $lm_pg_obj->setLMId($this->lm->getId());
2405 
2406  // determine target frames for internal links
2407  $page_object_gui->setLinkFrame($this->requested_frame);
2408  $page_object_gui->setOutputMode("print");
2409  $page_object_gui->setPresentationTitle("");
2410 
2411  if ($this->lm->getPageHeader() == ilLMObject::PAGE_TITLE || $node["free"] === true) {
2413  $lm_pg_obj->getId(),
2414  $this->lm->getPageHeader(),
2415  $this->lm->isActiveNumbering(),
2416  $this->lm_set->get("time_scheduled_page_activation"),
2417  false,
2418  0,
2419  $this->lang
2420  );
2421 
2422  // prevent page title after chapter title
2423  // that have the same content
2424  if ($this->lm->isActiveNumbering()) {
2425  $chapter_title = trim(substr(
2426  $chapter_title,
2427  strpos($chapter_title, " ")
2428  ));
2429  }
2430 
2431  if ($page_title != $chapter_title) {
2432  $page_object_gui->setPresentationTitle($page_title);
2433  }
2434  }
2435 
2436  // handle header / footer
2437  $hcont = $header_page_content;
2438  $fcont = $footer_page_content;
2439 
2440  if ($this->lm->getPageHeader() == ilLMOBject::CHAPTER_TITLE) {
2441  if ($did_chap_page_header) {
2442  $hcont = "";
2443  }
2444  if ($nodes[$node_key + 1]["type"] == "pg" &&
2445  !($nodes[$node_key + 1]["depth"] <= $act_level
2446  && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) {
2447  $fcont = "";
2448  }
2449  }
2450 
2451  $page_object_gui->setFileDownloadLink("#");
2452  $page_object_gui->setFullscreenLink("#");
2453  $page_object_gui->setSourceCodeDownloadScript("#");
2454  $page_content = $page_object_gui->showPage();
2455  if ($this->lm->getPageHeader() != ilLMObject::PAGE_TITLE) {
2456  $tpl->setVariable(
2457  "CONTENT",
2458  $hcont . $page_content . $fcont
2459  );
2460  } else {
2461  $tpl->setVariable(
2462  "CONTENT",
2463  $hcont . $page_content . $fcont . "<br />"
2464  );
2465  }
2466  $chapter_title = "";
2467  $tpl->parseCurrentBlock();
2468  $tpl->setCurrentBlock("print_block");
2469  $tpl->parseCurrentBlock();
2470 
2471  // get internal links
2472  $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]);
2473 
2474  $got_mobs = false;
2475 
2476  foreach ($int_links as $key => $link) {
2477  if ($link["type"] == "git" &&
2478  ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
2479  $glossary_links[$key] = $link;
2480  }
2481  if ($link["type"] == "mob" &&
2482  ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
2483  $got_mobs = true;
2484  $mob_links[$key] = $link;
2485  }
2486  }
2487 
2488  // this is not cool because of performance reasons
2489  // unfortunately the int link table does not
2490  // store the target frame (we want to append all linked
2491  // images but not inline images (i.e. mobs with no target
2492  // frame))
2493  if ($got_mobs) {
2494  $page_object->buildDom();
2495  $links = $page_object->getInternalLinks();
2496  foreach ($links as $link) {
2497  if ($link["Type"] == "MediaObject"
2498  && $link["TargetFrame"] != ""
2499  && $link["TargetFrame"] != "None") {
2500  $media_links[] = $link;
2501  }
2502  }
2503  }
2504  }
2505  }
2506  }
2507 
2508  $annex_cnt = 0;
2509  $annexes = array();
2510 
2511  // glossary
2512  if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) {
2513  // sort terms
2514  $terms = array();
2515 
2516  foreach ($glossary_links as $key => $link) {
2517  $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]);
2518  $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term);
2519  }
2520  $terms = ilUtil::sortArray($terms, "term", "asc");
2521  //ksort($terms);
2522 
2523  foreach ($terms as $t) {
2524  $link = $t["link"];
2525  $key = $t["key"];
2526  $defs = ilGlossaryDefinition::getDefinitionList($link["id"]);
2527  $def_cnt = 1;
2528 
2529  // output all definitions of term
2530  foreach ($defs as $def) {
2531  // definition + number, if more than 1 definition
2532  if (count($defs) > 1) {
2533  $tpl->setCurrentBlock("def_title");
2534  $tpl->setVariable(
2535  "TXT_DEFINITION",
2536  $this->lng->txt("cont_definition") . " " . ($def_cnt++)
2537  );
2538  $tpl->parseCurrentBlock();
2539  }
2540  $page_gui = new ilGlossaryDefPageGUI($def["id"]);
2541  $page_gui->setTemplateOutput(false);
2542  $page_gui->setOutputMode("print");
2543 
2544  $tpl->setCurrentBlock("definition");
2545  $page_gui->setFileDownloadLink("#");
2546  $page_gui->setFullscreenLink("#");
2547  $page_gui->setSourceCodeDownloadScript("#");
2548  $output = $page_gui->showPage();
2549  $tpl->setVariable("VAL_DEFINITION", $output);
2550  $tpl->parseCurrentBlock();
2551  }
2552 
2553  // output term
2554  $tpl->setCurrentBlock("term");
2555  $tpl->setVariable(
2556  "VAL_TERM",
2557  $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])
2558  );
2559  $tpl->parseCurrentBlock();
2560  }
2561 
2562  // output glossary header
2563  $annex_cnt++;
2564  $tpl->setCurrentBlock("glossary");
2565  $annex_title = $this->lng->txt("cont_annex") . " " .
2566  chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo");
2567  $tpl->setVariable("TXT_GLOSSARY", $annex_title);
2568  $tpl->parseCurrentBlock();
2569 
2570  $annexes[] = $annex_title;
2571  }
2572 
2573  // referenced images
2574  if (count($media_links) > 0) {
2575  foreach ($media_links as $media) {
2576  if (substr($media["Target"], 0, 4) == "il__") {
2577  $arr = explode("_", $media["Target"]);
2578  $id = $arr[count($arr) - 1];
2579 
2580  $med_obj = new ilObjMediaObject($id);
2581  $med_item = $med_obj->getMediaItem("Standard");
2582  if (is_object($med_item)) {
2583  if (is_int(strpos($med_item->getFormat(), "image"))) {
2584  $tpl->setCurrentBlock("ref_image");
2585 
2586  // image source
2587  if ($med_item->getLocationType() == "LocalFile") {
2588  $tpl->setVariable(
2589  "IMG_SOURCE",
2590  ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id .
2591  "/" . $med_item->getLocation()
2592  );
2593  } else {
2594  $tpl->setVariable(
2595  "IMG_SOURCE",
2596  $med_item->getLocation()
2597  );
2598  }
2599 
2600  if ($med_item->getCaption() != "") {
2601  $tpl->setVariable("IMG_TITLE", $med_item->getCaption());
2602  } else {
2603  $tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
2604  }
2605  $tpl->parseCurrentBlock();
2606  }
2607  }
2608  }
2609  }
2610 
2611  // output glossary header
2612  $annex_cnt++;
2613  $tpl->setCurrentBlock("ref_images");
2614  $annex_title = $this->lng->txt("cont_annex") . " " .
2615  chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images");
2616  $tpl->setVariable("TXT_REF_IMAGES", $annex_title);
2617  $tpl->parseCurrentBlock();
2618 
2619  $annexes[] = $annex_title;
2620  }
2621 
2622  // output learning module title and toc
2623  if ($output_header) {
2624  $tpl->setCurrentBlock("print_header");
2625  $tpl->setVariable("LM_TITLE", $this->getLMPresentationTitle());
2626  if ($this->lm->getDescription() != "none") {
2627  $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2628  $md_gen = $md->getGeneral();
2629  foreach ($md_gen->getDescriptionIds() as $id) {
2630  $md_des = $md_gen->getDescription($id);
2631  $description = $md_des->getDescription();
2632  }
2633 
2634  $tpl->setVariable(
2635  "LM_DESCRIPTION",
2636  $description
2637  );
2638  }
2639  $tpl->parseCurrentBlock();
2640 
2641  // output toc
2642  $nodes2 = $nodes;
2643  foreach ($nodes2 as $node2) {
2644  if ($node2["type"] == "st"
2645  && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) {
2646  for ($j = 1; $j < $node2["depth"]; $j++) {
2647  $tpl->setCurrentBlock("indent");
2648  $tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
2649  $tpl->parseCurrentBlock();
2650  }
2651  $tpl->setCurrentBlock("toc_entry");
2652  $tpl->setVariable(
2653  "TXT_TOC_TITLE",
2655  $node2["obj_id"],
2656  ilLMOBject::CHAPTER_TITLE,
2657  $this->lm->isActiveNumbering(),
2658  $this->lm_set->get("time_scheduled_page_activation"),
2659  false,
2660  0,
2661  $this->lang
2662  )
2663  );
2664  $tpl->parseCurrentBlock();
2665  }
2666  }
2667 
2668  // annexes
2669  foreach ($annexes as $annex) {
2670  $tpl->setCurrentBlock("indent");
2671  $tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
2672  $tpl->parseCurrentBlock();
2673  $tpl->setCurrentBlock("toc_entry");
2674  $tpl->setVariable("TXT_TOC_TITLE", $annex);
2675  $tpl->parseCurrentBlock();
2676  }
2677 
2678  $tpl->setCurrentBlock("toc");
2679  $tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
2680  $tpl->parseCurrentBlock();
2681 
2682  $tpl->setCurrentBlock("print_start_block");
2683  $tpl->parseCurrentBlock();
2684  }
2685 
2686  // output author information
2687  $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2688  if (is_object($lifecycle = $md->getLifecycle())) {
2689  $sep = $author = "";
2690  foreach (($ids = $lifecycle->getContributeIds()) as $con_id) {
2691  $md_con = $lifecycle->getContribute($con_id);
2692  if ($md_con->getRole() == "Author") {
2693  foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
2694  $md_ent = $md_con->getEntity($ent_id);
2695  $author = $author . $sep . $md_ent->getEntity();
2696  $sep = ", ";
2697  }
2698  }
2699  }
2700  if ($author != "") {
2701  $this->lng->loadLanguageModule("meta");
2702  $tpl->setCurrentBlock("author");
2703  $tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
2704  $tpl->setVariable("LM_AUTHOR", $author);
2705  $tpl->parseCurrentBlock();
2706  }
2707  }
2708 
2709 
2710  // output copyright information
2711  if (is_object($md_rights = $md->getRights())) {
2712  $copyright = $md_rights->getDescription();
2713  $copyright = ilMDUtils::_parseCopyright($copyright);
2714 
2715  if ($copyright != "") {
2716  $this->lng->loadLanguageModule("meta");
2717  $tpl->setCurrentBlock("copyright");
2718  $tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
2719  $tpl->setVariable("LM_COPYRIGHT", $copyright);
2720  $tpl->parseCurrentBlock();
2721  }
2722  }
2723 
2724  $this->tpl->setContent($tpl->get());
2725  $this->tpl->printToStdout();
2726  }
2727 
2731  public function downloadFile()
2732  {
2733  $page_gui = $this->getLMPageGUI($this->getCurrentPageId());
2734  $page_gui->downloadFile();
2735  }
2736 
2740  public function showDownloadList()
2741  {
2742  if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
2743  return;
2744  }
2745 
2746  $this->setContentStyles();
2747  $this->renderPageTitle();
2748 
2749  $this->tpl->loadStandardTemplate();
2750 
2751  $this->renderTabs("download", 0);
2752 
2753  $this->ilLocator(true);
2754  //$this->tpl->stopTitleFloating();
2755  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
2756 
2757  // set title header
2758  $this->tpl->setTitle($this->getLMPresentationTitle());
2759  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
2760 
2761  // output copyright information
2762  $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
2763  if (is_object($md_rights = $md->getRights())) {
2764  $copyright = $md_rights->getDescription();
2765 
2766  $copyright = ilMDUtils::_parseCopyright($copyright);
2767 
2768  if ($copyright != "") {
2769  $this->lng->loadLanguageModule("meta");
2770  $this->tpl->setCurrentBlock("copyright");
2771  $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
2772  $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
2773  $this->tpl->parseCurrentBlock();
2774  }
2775  }
2776 
2777 
2778  $download_table = new ilLMDownloadTableGUI($this, "showDownloadList", $this->lm);
2779  $this->tpl->setVariable("DOWNLOAD_TABLE", $download_table->getHTML());
2780  $this->tpl->printToStdout();
2781  }
2782 
2783 
2787  public function downloadExportFile()
2788  {
2789  if (!$this->lm->isActiveDownloads() || !$this->lm->isActiveLMMenu()) {
2790  return;
2791  }
2792 
2793  $base_type = explode("_", $_GET["type"]);
2794  $base_type = $base_type[0];
2795  $file = $this->lm->getPublicExportFile($base_type);
2796  if ($this->lm->getPublicExportFile($base_type) != "") {
2797  $dir = $this->lm->getExportDirectory($_GET["type"]);
2798  if (is_file($dir . "/" . $file)) {
2799  ilUtil::deliverFile($dir . "/" . $file, $file);
2800  exit;
2801  }
2802  }
2803  }
2804 
2814  public function getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
2815  {
2816  return "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=" . $a_ref_id . "&amp;obj_id=" . $a_obj_id . "&amp;focus_id=" .
2817  $a_obj_id . "&amp;focus_return=" . $a_return_ref_id;
2818  }
2819 
2827  {
2828  // content style
2829  $this->setContentStyles();
2830 
2831  $tpl = new ilTemplate("tpl.page_message_screen.html", true, true, "Modules/LearningModule");
2832  $tpl->setVariable("TXT_PAGE_NO_PUBLIC_ACCESS", $a_content);
2833 
2834  $this->tpl->setVariable("PAGE_CONTENT", $tpl->get());
2835  }
2836 
2837 
2841  public function showNoPublicAccess()
2842  {
2843  $this->showMessageScreen($this->lng->txt("msg_page_no_public_access"));
2844  }
2845 
2849  public function showNoPageAccess()
2850  {
2851  $this->showMessageScreen($this->lng->txt("msg_no_page_access"));
2852  }
2853 
2859  {
2860  $this->showMessageScreen($this->lng->txt("cont_no_page_access_unansw_q"));
2861  }
2862 
2863 
2864  public function getSourcecodeDownloadLink()
2865  {
2866  if (!$this->offlineMode()) {
2867  //$this->ctrl->setParameter($this, session_name(), session_id());
2868  $target = $this->ctrl->getLinkTarget($this, "");
2869  $target = ilUtil::appendUrlParameterString($target, session_name() . "=" . session_id());
2870  return $this->ctrl->getLinkTarget($this, "");
2871  } else {
2872  return "";
2873  }
2874  }
2875 
2876 
2877 
2884  public function getOfflineDirectory()
2885  {
2886  return $this->offline_directory;
2887  }
2888 
2893  public function handleCodeParagraph($page_id, $paragraph_id, $title, $text)
2894  {
2895  $directory = $this->getOfflineDirectory() . "/codefiles/" . $page_id . "/" . $paragraph_id;
2896  ilUtil::makeDirParents($directory);
2897  $file = $directory . "/" . $title;
2898  if (!($fp = @fopen($file, "w+"))) {
2899  die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2900  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2901  }
2902  chmod($file, 0770);
2903  fwrite($fp, $text);
2904  fclose($fp);
2905  }
2906 
2907  // #8613
2908  protected function renderPageTitle()
2909  {
2910  $this->tpl->setHeaderPageTitle($this->getLMPresentationTitle());
2911  // @todo 6.0
2912 // $this->tpl->fillWindowTitle();
2913 // $this->tpl->fillContentLanguage();
2914  }
2915 
2916 
2923  public function getLMPageGUI($a_id)
2924  {
2925  if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
2926  return new ilLMPageGUI($a_id, 0, false, $this->lang);
2927  }
2928  return new ilLMPageGUI($a_id);
2929  }
2930 
2937  public function getLMPage($a_id, $a_type = "")
2938  {
2939  $type = ($a_type == "mep")
2940  ? "mep"
2941  : "lm";
2942 
2943  $lang = $this->lang;
2944  if (!ilPageObject::_exists($type, $a_id, $lang)) {
2945  $lang = "-";
2946  }
2947 
2948  switch ($type) {
2949  case "mep":
2950  return new ilMediaPoolPage($a_id, 0, $lang);
2951  default:
2952  return new ilLMPage($a_id, 0, $lang);
2953  }
2954  }
2955 
2959  public function refreshToc()
2960  {
2961  $exp = $this->ilTOC(true);
2962 
2963  echo $exp->getHTML() .
2964  "<script>" . $exp->getOnLoadCode() . "</script>";
2965  exit;
2966  }
2967 
2976  public function observeNoteAction($a_lm_id, $a_page_id, $a_type, $a_action, $a_note_id)
2977  {
2978  $note = new ilNote($a_note_id);
2979  $note = $note->getText();
2980 
2981  $notification = new ilLearningModuleNotification(
2984  $this->lm,
2985  $a_page_id,
2986  $note
2987  );
2988 
2989  $notification->send();
2990  }
2991 
2998  protected function renderTabs($active_tab, $current_page_id)
2999  {
3000  $menu_editor = new ilLMMenuEditor();
3001  $menu_editor->setObjId($this->lm->getId());
3002 
3003  $navigation_renderer = new ilLMMenuRendererGUI(
3004  $this->tabs,
3006  $active_tab,
3007  (string) $this->getExportFormat(),
3008  $this->export_all_languages,
3009  $this->lm,
3010  $this->offlineMode(),
3011  $menu_editor,
3012  $this->lang,
3013  $this->ctrl,
3014  $this->access,
3015  $this->user,
3016  $this->lng
3017  );
3018  $navigation_renderer->render();
3019  }
3020 }
outputInfoScreen($a_standard_locator=false)
info screen
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
xslt_create()
$store
Definition: metadata.php:90
static makeDirParents($a_dir)
Create a new directory and all parent directories.
determineLayout()
Determine layout.
$attributes
Definition: metadata.php:231
static _parseCopyright($a_copyright)
Parse copyright.
This class represents an option in a radio group.
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn&#39;t have to be page title, it may be chapter title + page title or chapter tit...
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.
Handles display of the main menu.
static getDefinitionList($a_term_id)
static
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
exit
Definition: login.php:29
downloadFile()
download file of file lists
settings()
Definition: settings.php:2
Class ilInfoScreenGUI.
redrawHeaderAction()
Redraw header action.
static _getMapAreasIntLinks($a_mob_id)
get all internal links of map areas of a mob
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
$result
This class represents a property form user interface.
xpath_new_context($dom_document)
observeNoteAction($a_lm_id, $a_page_id, $a_type, $a_action, $a_note_id)
Generate new ilNote and send Notifications to the users informing that there are new comments in the ...
special template class to simplify handling of ITX/PEAR
$type
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"]
static _exists($a_id)
checks wether a lm content object with specified id exists or not
getLMPage($a_id, $a_type="")
Get lm page object.
xslt_free(&$proc)
showDownloadList()
show download list
domxml_open_mem($str, $mode=0, &$error=null)
static _checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
Menu / Tabs renderer.
ilLMMenu()
output learning module menu
setSystemStyle()
Set system style.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
getLMPageGUI($a_id)
Get lm page gui object.
static hasOptOut($obj_id)
Is opt out (disable notification) allowed?
static get($a_glyph, $a_text="")
Get glyph html.
showNavRestrictionDueToQuestions()
Show message if navigation to page is not allowed due to unanswered questions.
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static includePresentationJS($a_tpl=null)
Include media object presentation JS.
injectTemplate($tpl)
Inject template.
ilGlossary()
show glossary term
Class ilMediaPoolPage.
getContent()
process <ilPage> content tag
showInfoScreen()
info screen call from inside learning module
static now()
Return current timestamp in Y-m-d H:i:s format.
user()
Definition: user.php:4
refreshToc()
Refresh toc (called if questions have been answered correctly)
getPageContent()
Get page content.
$ilErr
Definition: raiseError.php:18
ilLMSubMenu()
output learning module submenu
Note class.
Base exception class for learning module presentation.
addHeaderAction($a_redraw=false)
Add header action.
getLMPresentationTitle()
Get lm presentationtitle.
ilJavaScript($a_inline="", $a_file="", $a_location="")
Puts JS into template.
Notes GUI class.
global $ilCtrl
Definition: ilias.php:18
help()
Definition: help.php:2
const DEBUG
Class ilLMPresentationGUI.
getFocusLink($a_ref_id, $a_obj_id, $a_return_ref_id)
Get focused link (used in learning objectives courses)
$a_type
Definition: workflow.php:92
xslt_error(&$proc)
if($format !==null) $name
Definition: metadata.php:230
static addJavaScript(ilGlobalTemplate $main_tpl=null)
Add javascript files that are necessary to run accordion.
getCurrentFrameSet()
get frames of current frame set
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
This class represents a property in a property form.
Class ilRatingGUI.
static addCss()
Add required css.
Class ilLMPageObject.
foreach($_POST as $key=> $value) $res
getExportFormat()
get export format
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
$a_content
Definition: workflow.php:93
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.
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.
Extension of ilPageObjectGUI for learning modules.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
ilTOC($a_get_explorer=false)
table of contents
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
TableGUI class for lm download files.
static _getPresentationTitle( $a_st_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
processNodes(&$a_content, &$a_node)
offlineMode()
checks wether offline content generation is activated
GUI class for glossary terms.
downloadExportFile()
send download file (xml/html)
& getGeneral()
Definition: class.ilMD.php:40
$ilUser
Definition: imgupload.php:18
ilLocator($a_std_templ_loaded=false)
locator
getCurrentPageId()
Get the current page id.
initByRequest($query_params)
Init services and this class by request params.
$xml
Definition: metadata.php:332
class for editing lm menu
Class ilObjMediaObject.
static getSyntaxStylePath()
get syntax style path
showPrintViewSelection()
show selection screen for print view
basicPageGuiInit($a_page_gui)
Basic page gui initialisation.
const IL_MODE_ALIAS
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
nop()
this dummy function is needed for offline package creation
static initjQueryUI($a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
$lang
Definition: xapiexit.php:8
showNoPageAccess()
Show info message, if page is not accessible in public area.
getSuccessorPage()
Get successor page.
__construct( $a_export_format="", $a_all_languages=false, $a_export_dir="", bool $claim_repo_context=true)
initScreenHead($a_active_tab="info")
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
showNoPublicAccess()
Show info message, if page is not accessible in public area.
Class ilStructreObject.
enablePublicNotesDeletion($a_enable=true)
enable public notes
static _getFrame($a_class, $a_type='')
Get content frame name.
handleCodeParagraph($page_id, $paragraph_id, $title, $text)
store paragraph into file directory files/codefile_$pg_id_$paragraph_id/downloadtitle ...
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
This class represents a (nested) list of checkboxes (could be extended for radio items, too)
global $ilSetting
Definition: privfeed.php:17
static init(ilGlobalTemplateInterface $a_tpl=null)
Init.
Glossary definition page GUI class.
Class ilLearningModuleNotification class.
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
$ret
Definition: parser.php:6
$DIC
Definition: xapitoken.php:46
Session based immediate storage.
const IL_MODE_OUTPUT
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
renderTabs($active_tab, $current_page_id)
Render tabs.
static getWebspaceDir($mode="filesystem")
get webspace directory
Class ilObjUserTrackingGUI.
static _lookGlossaryTerm($term_id)
get glossary term
$_POST["username"]
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
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
$i
Definition: metadata.php:24
setContentStyles()
Set content style.
initPrintViewSelectionForm()
Init print view selection form.
Main service init and factory.