ILIAS  release_8 Revision v8.24
class.ilLMPresentationStatus.php
Go to the documentation of this file.
1<?php
2
25{
26 protected string $export_format;
27 protected bool $export_all_languages;
28 public bool $offline;
29 protected ilObjUser $user;
30 protected string $requested_search_string;
31 protected ilLMTree $lm_tree;
32 protected string $requested_focus_return;
33 protected string $requested_focus_id;
34 protected string $requested_transl;
37 protected string $lang;
38 protected int $focus_id = 0;
39 protected $concrete_lang = "";
40 protected $embed_mode = false;
41
42 public function __construct(
46 string $requested_transl = "",
47 string $requested_focus_id = "",
48 string $requested_focus_return = "",
49 string $requested_search_string = "",
50 bool $offline = false,
51 bool $export_all_languages = false,
52 string $export_format = "",
53 bool $embed_mode = false
54 ) {
55 $this->lm = $lm;
57 $this->requested_transl = $requested_transl;
58 $this->requested_focus_id = $requested_focus_id;
59 $this->requested_focus_return = $requested_focus_return;
60 $this->requested_search_string = $requested_search_string;
61 $this->user = $user;
62 $this->lm_tree = $lm_tree;
63 $this->offline = $offline;
64 $this->export_all_languages = $export_all_languages;
65 $this->export_format = $export_format;
66 $this->embed_mode = $embed_mode;
67 $this->init();
68 }
69
70 protected function init(): void
71 {
72 // determine language
73 $this->lang = "-";
74 $this->concrete_lang = "-";
75 if ($this->ot->getContentActivated()) {
76 $langs = $this->ot->getLanguages();
77 if (isset($langs[$this->requested_transl]) || $this->requested_transl == $this->ot->getMasterLanguage()) {
78 $this->lang = $this->requested_transl;
79 } else {
80 $this->lang = $this->user->getCurrentLanguage();
81 }
82 $this->concrete_lang = $this->lang;
83 if ($this->lang == $this->ot->getMasterLanguage()) {
84 $this->lang = "-";
85 }
86 }
87
88 // determin focus id
89 if ($this->requested_focus_id > 0 && $this->lm_tree->isInTree($this->requested_focus_id)) {
90 $this->focus_id = $this->requested_focus_id;
91 }
92 }
93
94 public function getLang(): string
95 {
96 return $this->lang;
97 }
98
103 public function getConcreteLang(): string
104 {
106 }
107
108 public function getFocusId(): int
109 {
110 return $this->focus_id;
111 }
112
113 public function getFocusReturn(): string
114 {
116 }
117
118 public function getSearchString(): string
119 {
121 }
122
123 public function offline(): bool
124 {
125 return $this->offline;
126 }
127
128 public function getEmbedMode(): bool
129 {
130 return $this->embed_mode;
131 }
132
133 public function exportAllLanguages(): bool
134 {
136 }
137
138 public function getExportFormat(): string
139 {
141 }
142
143 public function getLMPresentationTitle(): string
144 {
145 if ($this->offline() && $this->lang != "" && $this->lang != "-") {
146 $ltitle = "";
147 $ot = $this->ot;
149 $ltitle = $data[$this->lang]->getTitle();
150 if ($ltitle !== "") {
151 return $ltitle;
152 }
153 $fb = $ot->getFallbackLanguage();
154 if (isset($data[$fb])) {
155 $ltitle = $data[$fb]->getTitle();
156 }
157 if ($ltitle !== "") {
158 return $ltitle;
159 }
160 }
161 return $this->lm->getTitle();
162 }
163
168 public function isTocNecessary(): bool
169 {
170 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
171 if (count($childs) == 0) { // no chapter -> false
172 return false;
173 }
174 if (count($childs) > 1) { // more than one chapter -> true
175 return true;
176 }
177 if ($this->lm->getTOCMode() != "pages") { // one chapter TOC does not show pages -> false
178 return false;
179 }
180 $current_chapter = current($childs);
181 $childs = $this->lm_tree->getChilds($current_chapter["child"]);
182 if (count($childs) > 1) {
183 return true; // more than one page -> true
184 }
185 return false; // zero or one page -> false
186 }
187}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjUser $user, ilObjLearningModule $lm, ilLMTree $lm_tree, string $requested_transl="", string $requested_focus_id="", string $requested_focus_return="", string $requested_search_string="", bool $offline=false, bool $export_all_languages=false, string $export_format="", bool $embed_mode=false)
isTocNecessary()
Is TOC necessary, see #30027 Check if at least two entries will be shown.
getConcreteLang()
Only difference to getLang(): if current language is the master lang the language key will be returne...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)