ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilLMTOCExplorerGUIFactory.php
Go to the documentation of this file.
1 <?php
2 
23 {
25 
26  public function __construct()
27  {
28  global $DIC;
29 
30  $this->tpl = $DIC->ui()->mainTemplate();
31  }
32 
33  public function getExplorer(
35  string $parent_cmd = ""
37  // this needs a proper interface
38  $tracker = $service->getTracker();
39  $chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
40  $lang = $service->getPresentationStatus()->getLang();
41  $focus_id = $service->getPresentationStatus()->getFocusId();
42  $export_all_languages = $service->getPresentationStatus()->exportAllLanguages();
43  $current_page = $service->getNavigationStatus()->getCurrentPage();
44  $deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
45  $requested_obj_id = $service->getRequest()->getObjId();
46  $lm = $service->getLearningModule();
47  $lm_tree = $service->getLMTree();
48  $offline = $service->getPresentationStatus()->offline();
49  $exp = new ilLMTOCExplorerGUI(
50  "illmpresentationgui",
51  $parent_cmd,
52  $service,
53  $lang,
54  $focus_id,
55  $export_all_languages
56  );
57  $exp->setMainTemplate($this->tpl);
58  $exp->setTracker($tracker);
59 
60  // determine highlighted and force open nodes
61  $page_id = $current_page;
62  if ($deactivated_page) {
63  $page_id = $requested_obj_id;
64  }
65  if ($page_id > 0) {
66  $exp->setPathOpen((int) $page_id);
67  }
68  // empty chapter
69  if ($chapter_has_no_active_page &&
70  ilLMObject::_lookupType($requested_obj_id) == "st") {
71  $exp->setHighlightNode($requested_obj_id);
72  } else {
73  if ($lm->getTOCMode() == "pages") {
74  if ($deactivated_page) {
75  $exp->setHighlightNode($requested_obj_id);
76  } else {
77  $exp->setHighlightNode($page_id);
78  }
79  } else {
80  $exp->setHighlightNode((int) $lm_tree->getParentId($page_id));
81  }
82  }
83  if ($offline) {
84  $exp->setOfflineMode(true);
85  }
86  return $exp;
87  }
88 }
getExplorer(ilLMPresentationService $service, string $parent_cmd="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26
$lang
Definition: xapiexit.php:25
static _lookupType(int $a_obj_id, int $a_lm_id=0)
$service
Definition: ltiservices.php:40
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Main service init and factory.