ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLMTOCExplorerGUIFactory.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 
11 {
15  public function __construct()
16  {
17  global $DIC;
18 
19  $this->tpl = $DIC->ui()->mainTemplate();
20  }
21 
27  public function getExplorer(
29  string $parent_cmd = ""
30  ) {
31  // this needs a proper interface
32  $tracker = $service->getTracker();
33  $chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
34  $lang = $service->getPresentationStatus()->getLang();
35  $focus_id = $service->getPresentationStatus()->getFocusId();
36  $export_all_languages = $service->getPresentationStatus()->exportAllLanguages();
37  $current_page = $service->getNavigationStatus()->getCurrentPage();
38  $deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
39  $requested_obj_id = $service->getRequest()->getRequestedObjId();
40  $lm = $service->getLearningModule();
41  $lm_tree = $service->getLMTree();
42  $offline = $service->getPresentationStatus()->offline();
43 
44  $exp = new ilLMTOCExplorerGUI(
45  "illmpresentationgui",
46  $parent_cmd,
47  $service,
48  $lang,
49  $focus_id,
50  $export_all_languages
51  );
52  $exp->setMainTemplate($this->tpl);
53  $exp->setTracker($tracker);
54 
55  // determine highlighted and force open nodes
56  $page_id = $current_page;
57  if ($deactivated_page) {
58  $page_id = $requested_obj_id;
59  }
60  if ($page_id > 0) {
61  $exp->setPathOpen((int) $page_id);
62  }
63  // empty chapter
64  if ($chapter_has_no_active_page &&
65  ilLMObject::_lookupType($requested_obj_id) == "st") {
66  $exp->setHighlightNode($requested_obj_id);
67  } else {
68  if ($lm->getTOCMode() == "pages") {
69  if ($deactivated_page) {
70  $exp->setHighlightNode($requested_obj_id);
71  } else {
72  $exp->setHighlightNode($page_id);
73  }
74  } else {
75  $exp->setHighlightNode($lm_tree->getParentId($page_id));
76  }
77  }
78  if ($offline) {
79  $exp->setOfflineMode(true);
80  }
81 
82  return $exp;
83  }
84 }
getExplorer(ilLMPresentationService $service, string $parent_cmd="")
Get explorer.
LM presentation (left frame) explorer GUI class.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
$service
Definition: result.php:17
$lang
Definition: xapiexit.php:8
$DIC
Definition: xapitoken.php:46
Main service init and factory.