ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLMPresentationStatus.php
Go to the documentation of this file.
1<?php
2
20
27{
28 protected string $export_format;
29 protected bool $export_all_languages;
30 public bool $offline;
31 protected ilObjUser $user;
32 protected string $requested_search_string;
33 protected ilLMTree $lm_tree;
34 protected string $requested_focus_return;
35 protected string $requested_focus_id;
36 protected string $requested_transl;
37 protected Translations $ot;
39 protected string $lang;
40 protected int $focus_id = 0;
41 protected $concrete_lang = "";
42 protected $embed_mode = false;
43
44 public function __construct(
49 string $requested_transl = "",
50 string $requested_focus_id = "",
51 string $requested_focus_return = "",
52 string $requested_search_string = "",
53 bool $offline = false,
54 bool $export_all_languages = false,
55 string $export_format = "",
56 bool $embed_mode = false
57 ) {
58 $this->lm = $lm;
59 $this->ot = $ot;
60 $this->requested_transl = $requested_transl;
61 $this->requested_focus_id = $requested_focus_id;
62 $this->requested_focus_return = $requested_focus_return;
63 $this->requested_search_string = $requested_search_string;
64 $this->user = $user;
65 $this->lm_tree = $lm_tree;
66 $this->offline = $offline;
67 $this->export_all_languages = $export_all_languages;
68 $this->export_format = $export_format;
69 $this->embed_mode = $embed_mode;
70 $this->init();
71 }
72
73 protected function init(): void
74 {
75 // determine language
76 $this->lang = "-";
77 $this->concrete_lang = "-";
78 if ($this->ot->getContentTranslationActivated()) {
79 $langs = $this->ot->getLanguages();
80 if (isset($langs[$this->requested_transl]) || $this->requested_transl == $this->ot->getBaseLanguage()) {
81 $this->lang = $this->requested_transl;
82 } else {
83 $this->lang = $this->user->getCurrentLanguage();
84 }
85 $this->concrete_lang = $this->lang;
86 if ($this->lang == $this->ot->getBaseLanguage()) {
87 $this->lang = "-";
88 }
89 }
90
91 // determin focus id
92 if ($this->requested_focus_id > 0 && $this->lm_tree->isInTree($this->requested_focus_id)) {
93 $this->focus_id = $this->requested_focus_id;
94 }
95 }
96
97 public function getLang(): string
98 {
99 return $this->lang;
100 }
101
106 public function getConcreteLang(): string
107 {
109 }
110
111 public function getFocusId(): int
112 {
113 return $this->focus_id;
114 }
115
116 public function getFocusReturn(): string
117 {
119 }
120
121 public function getSearchString(): string
122 {
124 }
125
126 public function offline(): bool
127 {
128 return $this->offline;
129 }
130
131 public function getEmbedMode(): bool
132 {
133 return $this->embed_mode;
134 }
135
136 public function exportAllLanguages(): bool
137 {
139 }
140
141 public function getExportFormat(): string
142 {
144 }
145
146 public function getLMPresentationTitle(): string
147 {
148 if ($this->lang != "" && $this->lang != "-") {
149 $ltitle = "";
150 $ot = $this->ot;
152 if (isset($data[$this->lang])) {
153 $ltitle = $data[$this->lang]->getTitle();
154 }
155 if ($ltitle !== "") {
156 return $ltitle;
157 }
158 $fb = $ot->getDefaultLanguage();
159 if (isset($data[$fb])) {
160 $ltitle = $data[$fb]->getTitle();
161 }
162 if ($ltitle !== "") {
163 return $ltitle;
164 }
165 }
166 return $this->lm->getTitle();
167 }
168
173 public function isTocNecessary(): bool
174 {
175 $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
176 if (count($childs) == 0) { // no chapter -> false
177 return false;
178 }
179 if (count($childs) > 1) { // more than one chapter -> true
180 return true;
181 }
182 if ($this->lm->getTOCMode() != "pages") { // one chapter TOC does not show pages -> false
183 return false;
184 }
185 $current_chapter = current($childs);
186 $childs = $this->lm_tree->getChilds($current_chapter["child"]);
187 if (count($childs) > 1) {
188 return true; // more than one page -> true
189 }
190 return false; // zero or one page -> false
191 }
192}
Class handles translation mode for an object.
Contains info on offline mode, focus, translation, etc.
isTocNecessary()
Is TOC necessary, see #30027 Check if at least two entries will be shown.
__construct(ilObjUser $user, ilObjLearningModule $lm, ilLMTree $lm_tree, Translations $ot, 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)
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.