ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilPageConfig.php
Go to the documentation of this file.
1 <?php
2 
24 abstract class ilPageConfig
25 {
26  // section protection
27  public const SEC_PROTECT_NONE = 0; // page does not support section protection
28  public const SEC_PROTECT_EDITABLE = 1; // current use can edit protected sections
29  public const SEC_PROTECT_PROTECTED = 2; // current use cannot edit protected sections
30  protected \ILIAS\COPage\PC\PCDefinition $pc_definition;
31  protected int $layout_template_type = 0;
32 
33  protected bool $int_link_def_id_is_ref = false;
34  protected ilLanguage $lng;
35  protected array $int_link_filter = array("File", "PortfolioPage", "PortfolioTemplatePage");
36  protected bool $prevent_rte_usage = false;
37  protected bool $use_attached_content = false;
38  protected array $pc_defs = array();
39  protected array $pc_enabled = array();
40  protected bool $enabledinternallinks = false;
41  protected bool $enable_keywords = false;
42  protected bool $enable_anchors = false;
43  protected bool $enablewikilinks = false;
44  protected bool $page_toc = false;
45  protected bool $activation = false;
46  protected bool $scheduled_activation = false;
47  protected bool $preventhtmlunmasking = false;
48  protected bool $enabledselfassessment = false;
49  protected bool $enabledselfassessment_scorm = false;
50  protected string $int_link_def_type = "";
51  protected int $int_link_def_id = 0;
52  protected bool $multi_lang_support = false;
53  protected bool $single_page_mode = false; // currently only used by multi-lang support
54  // single page means: only one page per parent_id
55  protected bool $disable_default_qfeedback = false;
56  protected array $question_html = array();
57  protected bool $use_stored_tries = false;
58  protected bool $enable_user_links = false;
59  protected bool $edit_lock_support = true;
60  protected bool $use_page_container = true;
61  protected bool $enable_permission_checks = false;
62  protected \ilSetting $adve_set;
67  protected string $page_obj_key = "";
68  protected bool $link_filter_white_list = false;
69  protected string $localization_lang = "";
70  protected int $section_protection = self::SEC_PROTECT_NONE;
71  protected string $section_protection_info = "";
72 
73  final public function __construct()
74  {
75  global $DIC;
76 
77  $this->pc_definition = $DIC
78  ->copage()
79  ->internal()
80  ->domain()
81  ->pc()
82  ->definition();
83  $this->lng = $DIC->language();
84  $this->loadPCDefs();
85  $this->adve_set = new ilSetting("adve");
86  $this->loadParentKey();
87  $this->init();
88  }
89 
90  protected function loadPCDefs(): void
91  {
92  // load pc_defs
93  $this->pc_defs = $this->pc_definition->getPCDefinitions();
94  foreach ($this->pc_defs as $def) {
95  $this->setEnablePCType($def["name"], (bool) $def["def_enabled"]);
96  }
97  }
98 
99  protected function loadParentKey(): void
100  {
101  $def = new ilCOPageObjDef();
102  foreach ($def->getDefinitions() as $key => $def) {
103  if (strtolower(get_class($this)) == strtolower($def["class_name"] . "Config")) {
104  $this->page_obj_key = $key;
105  }
106  }
107  $this->init();
108  if ($this->getLayoutTemplateType() > 0) {
109  $templates = ilPageLayout::activeLayouts($this->getLayoutTemplateType());
110  if (count($templates) > 0) {
111  $this->setEnablePCType("LayoutTemplate", true);
112  }
113  }
114  }
115 
116  public function init(): void
117  {
118  }
119 
120  public function setLayoutTemplateType(int $type): void
121  {
122  $this->layout_template_type = $type;
123  }
124 
125  public function getLayoutTemplateType(): int
126  {
128  }
129 
130  public function setEnablePCType(string $a_pc_type, bool $a_val): void
131  {
132  $this->pc_enabled[$a_pc_type] = $a_val;
133  }
134 
135  public function getEnablePCType(string $a_pc_type): bool
136  {
137  return $this->pc_enabled[$a_pc_type];
138  }
139 
140  public function getEnabledTopPCTypes(): array
141  {
142  $types = [];
143  foreach ($this->pc_defs as $def) {
144  if ($def["top_item"] && $this->getEnablePCType($def["name"])) {
145  $types[] = $def;
146  }
147  }
148  return $types;
149  }
150 
151  public function setEnableKeywords(bool $a_val): void
152  {
153  $this->enable_keywords = $a_val;
154  }
155 
156  public function getEnableKeywords(): bool
157  {
158  return $this->enable_keywords;
159  }
160 
161  public function setEnableAnchors(bool $a_val): void
162  {
163  $this->enable_anchors = $a_val;
164  }
165 
166  public function getEnableAnchors(): bool
167  {
168  return $this->enable_anchors;
169  }
170 
171  public function setEnableInternalLinks(bool $a_enabledinternallinks): void
172  {
173  $this->enabledinternallinks = $a_enabledinternallinks;
174  }
175 
176  public function getEnableInternalLinks(): bool
177  {
179  }
180 
181  public function getEnableUserLinks(): bool
182  {
183  if (!$this->getEnableInternalLinks()) {
184  return false;
185  }
186  if ($this->getIntLinkFilterWhiteList() && in_array("User", $this->int_link_filter)) {
187  return true;
188  }
189  if (!$this->getIntLinkFilterWhiteList() && !in_array("User", $this->int_link_filter)) {
190  return true;
191  }
192 
193  return false;
194  }
195 
196  public function setEnableWikiLinks(bool $a_enablewikilinks): void
197  {
198  $this->enablewikilinks = $a_enablewikilinks;
199  }
200 
201  public function getEnableWikiLinks(): bool
202  {
203  return $this->enablewikilinks;
204  }
205 
210  public function addIntLinkFilter(string $a_val): void
211  {
212  $lng = $this->lng;
213 
214  $this->setLocalizationLanguage($lng->getLangKey());
215  $this->int_link_filter[] = $a_val;
216  }
217 
218  public function removeIntLinkFilter(string $a_val): void
219  {
220  foreach ($this->int_link_filter as $k => $v) {
221  if ($v == $a_val) {
222  unset($this->int_link_filter[$k]);
223  }
224  }
225  }
226 
227  public function getIntLinkFilters(): array
228  {
229  return $this->int_link_filter;
230  }
231 
235  public function setIntLinkFilterWhiteList(bool $a_white_list): void
236  {
237  $this->link_filter_white_list = $a_white_list;
238  if ($a_white_list) {
239  $this->int_link_filter = array();
240  }
241  }
242 
243  public function getIntLinkFilterWhiteList(): bool
244  {
246  }
247 
248  public function setPreventRteUsage(bool $a_val): void
249  {
250  $this->prevent_rte_usage = $a_val;
251  }
252 
253  public function getPreventRteUsage(): bool
254  {
256  }
257 
261  public function setLocalizationLanguage(string $a_val): void
262  {
263  $this->localization_lang = $a_val;
264  }
265 
266  public function getLocalizationLanguage(): string
267  {
269  }
270 
271  public function setUseAttachedContent(bool $a_val): void
272  {
273  $this->use_attached_content = $a_val;
274  }
275 
276  public function getUseAttachedContent(): bool
277  {
279  }
280 
281  public function setIntLinkHelpDefaultType(string $a_val): void
282  {
283  $this->int_link_def_type = $a_val;
284  }
285 
286  public function getIntLinkHelpDefaultType(): string
287  {
289  }
290 
295  public function setIntLinkHelpDefaultId(
296  int $a_val,
297  bool $a_is_ref = true
298  ): void {
299  $this->int_link_def_id = $a_val;
300  $this->int_link_def_id_is_ref = $a_is_ref;
301  }
302 
303  public function getIntLinkHelpDefaultId(): int
304  {
305  return $this->int_link_def_id;
306  }
307 
308  public function getIntLinkHelpDefaultIdIsRef(): bool
309  {
311  }
312 
316  public function setEnableActivation(bool $a_val): void
317  {
318  $this->activation = $a_val;
319  }
320 
321  public function getEnableActivation(): bool
322  {
323  return $this->activation;
324  }
325 
326  public function setEnableScheduledActivation(bool $a_val): void
327  {
328  $this->scheduled_activation = $a_val;
329  }
330 
331  public function getEnableScheduledActivation(): bool
332  {
334  }
335 
336  public function setEnablePageToc(bool $a_val): void
337  {
338  $this->page_toc = $a_val;
339  }
340 
341  public function getEnablePageToc(): bool
342  {
343  return $this->page_toc;
344  }
345 
346  public function setPreventHTMLUnmasking(
347  bool $a_preventhtmlunmasking
348  ): void {
349  $this->preventhtmlunmasking = $a_preventhtmlunmasking;
350  }
351 
352  public function getPreventHTMLUnmasking(): bool
353  {
354  return true;
355  }
356 
357  public function setEnableSelfAssessment(
358  bool $a_enabledselfassessment,
359  bool $a_scorm = true
360  ): void {
361  $this->setEnablePCType("Question", $a_enabledselfassessment);
362  $this->enabledselfassessment = $a_enabledselfassessment;
363  $this->enabledselfassessment_scorm = $a_scorm;
364  }
365 
366  public function getEnableSelfAssessment(): bool
367  {
369  }
370 
374  public function getEnableSelfAssessmentScorm(): bool
375  {
377  }
378 
382  public function setDisableDefaultQuestionFeedback(bool $a_val): void
383  {
384  $this->disable_default_qfeedback = $a_val;
385  }
386 
387  public function getDisableDefaultQuestionFeedback(): bool
388  {
390  }
391 
392  public function setMultiLangSupport(bool $a_val): void
393  {
394  $this->multi_lang_support = $a_val;
395  }
396 
397  public function getMultiLangSupport(): bool
398  {
400  }
401 
406  public function setSinglePageMode(bool $a_val): void
407  {
408  $this->single_page_mode = $a_val;
409  }
410 
411  public function getSinglePageMode(): bool
412  {
414  }
415 
416  public function setQuestionHTML(array $question_html): void
417  {
418  $this->question_html = $question_html;
419  }
420 
421  public function getQuestionHTML(): array
422  {
423  return $this->question_html;
424  }
425 
430  public function setUseStoredQuestionTries(bool $a_val): void
431  {
432  $this->use_stored_tries = $a_val;
433  }
434 
435  public function getUseStoredQuestionTries(): bool
436  {
438  }
439 
440  public function setEnablePermissionChecks(bool $a_val): void
441  {
442  $this->enable_permission_checks = $a_val;
443  }
444 
445  public function getEnablePermissionChecks(): bool
446  {
448  }
449 
453  public function setEditLockSupport(bool $a_val): void
454  {
455  $this->edit_lock_support = $a_val;
456  }
457 
458  public function getEditLockSupport(): bool
459  {
461  }
462 
466  public function setUsePageContainer(bool $a_val): void
467  {
468  $this->use_page_container = $a_val;
469  }
470 
471  public function getUsePageContainer(): bool
472  {
474  }
475 
476  public function setSectionProtection(int $a_val): void
477  {
478  $this->section_protection = $a_val;
479  }
480 
481  public function getSectionProtection(): int
482  {
484  }
485 
486  public function setSectionProtectionInfo(string $a_val): void
487  {
488  $this->section_protection_info = $a_val;
489  }
490 
491  public function getSectionProtectionInfo(): string
492  {
494  }
495 }
setPreventHTMLUnmasking(bool $a_preventhtmlunmasking)
setIntLinkHelpDefaultId(int $a_val, bool $a_is_ref=true)
Set internal link default id.
setDisableDefaultQuestionFeedback(bool $a_val)
Set disable default question feedback.
setEnableInternalLinks(bool $a_enabledinternallinks)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setEnablePageToc(bool $a_val)
bool $enable_permission_checks
setPreventRteUsage(bool $a_val)
getLangKey()
Return lang key.
setEnablePermissionChecks(bool $a_val)
ILIAS COPage PC PCDefinition $pc_definition
setIntLinkHelpDefaultType(string $a_val)
setEnableSelfAssessment(bool $a_enabledselfassessment, bool $a_scorm=true)
addIntLinkFilter(string $a_val)
Add internal links filter.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static activeLayouts(int $a_module=0)
Get active layouts.
bool $enabledselfassessment_scorm
setUsePageContainer(bool $a_val)
Set if page container css class should be used.
setLayoutTemplateType(int $type)
bool $disable_default_qfeedback
setEnableScheduledActivation(bool $a_val)
setSinglePageMode(bool $a_val)
Set single page mode.
getEnableSelfAssessmentScorm()
Is self assessment used in SCORM mode?
setLocalizationLanguage(string $a_val)
global $DIC
Definition: shib_login.php:22
getEnablePCType(string $a_pc_type)
setMultiLangSupport(bool $a_val)
setEnableWikiLinks(bool $a_enablewikilinks)
setSectionProtectionInfo(string $a_val)
setUseStoredQuestionTries(bool $a_val)
Set use stored answers/tries.
setUseAttachedContent(bool $a_val)
setIntLinkFilterWhiteList(bool $a_white_list)
Set internal links filter type list to white list.
setEnableAnchors(bool $a_val)
setEnableActivation(bool $a_val)
Set enabled page activation.
setEditLockSupport(bool $a_val)
setEnableKeywords(bool $a_val)
removeIntLinkFilter(string $a_val)
setEnablePCType(string $a_pc_type, bool $a_val)
string $section_protection_info
setSectionProtection(int $a_val)
setQuestionHTML(array $question_html)