ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPageConfig.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 abstract class ilPageConfig
13 {
17  protected $lng;
18 
19  protected $int_link_filter = array("File", "PortfolioPage", "PortfolioTemplatePage");
20  protected $prevent_rte_usage = false;
21  protected $use_attached_content = false;
22  protected $pc_defs = array();
23  protected $pc_enabled = array();
24  protected $enabledinternallinks = false;
25  protected $enable_keywords = false;
26  protected $enable_anchors = false;
27  protected $enablewikilinks = false;
28  protected $page_toc = false;
29  protected $activation = false;
30  protected $scheduled_activation = false;
31  protected $preventhtmlunmasking = false;
32  protected $enabledselfassessment = false;
33  protected $enabledselfassessment_scorm = false;
34  protected $int_link_def_type = "";
35  protected $int_link_def_id = 0;
36  protected $multi_lang_support = false;
37  protected $single_page_mode = false; // currently only used by multi-lang support
38  // single page means: only one page per parent_id
39  protected $disable_default_qfeedback = false;
40  protected $question_html = array();
41  protected $use_stored_tries = false;
42  protected $enable_user_links = false;
43 
44  protected $edit_lock_support = true;
45 
49  protected $use_page_container = true;
50 
54  protected $enable_permission_checks = false;
55 
59  protected $adve_set;
60 
65  protected $page_obj_key = "";
66 
72  final public function __construct()
73  {
74  global $DIC;
75 
76  $this->lng = $DIC->language();
77  // load pc_defs
78  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
79  $this->pc_defs = ilCOPagePCDef::getPCDefinitions();
80  foreach ($this->pc_defs as $def) {
81  $this->setEnablePCType($def["name"], (bool) $def["def_enabled"]);
82  }
83 
84  $this->adve_set = new ilSetting("adve");
85 
86  $def = new ilCOPageObjDef();
87  foreach ($def->getDefinitions() as $key => $def) {
88  if (strtolower(get_class($this)) == strtolower($def["class_name"] . "Config")) {
89  $this->page_obj_key = $key;
90  }
91  }
92 
93 
94  $this->init();
95  }
96 
103  public function init()
104  {
105  }
106 
107 
113  public function setEnablePCType($a_pc_type, $a_val)
114  {
115  $this->pc_enabled[$a_pc_type] = $a_val;
116  }
117 
123  public function getEnablePCType($a_pc_type)
124  {
125  return $this->pc_enabled[$a_pc_type];
126  }
127 
133  public function getEnabledTopPCTypes() : array
134  {
135  $types = [];
136  foreach ($this->pc_defs as $def) {
137  if ($def["top_item"] && $this->getEnablePCType($def["name"])) {
138  $types[] = $def;
139  }
140  }
141  return $types;
142  }
143 
149  public function setEnableKeywords($a_val)
150  {
151  $this->enable_keywords = $a_val;
152  }
153 
159  public function getEnableKeywords()
160  {
161  return $this->enable_keywords;
162  }
163 
169  public function setEnableAnchors($a_val)
170  {
171  $this->enable_anchors = $a_val;
172  }
173 
179  public function getEnableAnchors()
180  {
181  return $this->enable_anchors;
182  }
183 
189  public function setEnableInternalLinks($a_enabledinternallinks)
190  {
191  $this->enabledinternallinks = $a_enabledinternallinks;
192  }
193 
199  public function getEnableInternalLinks()
200  {
202  }
203 
209  public function getEnableUserLinks()
210  {
211  if (!$this->getEnableInternalLinks()) {
212  return false;
213  }
214  if ($this->getIntLinkFilterWhiteList() && in_array("User", $this->int_link_filter)) {
215  return true;
216  }
217  if (!$this->getIntLinkFilterWhiteList() && !in_array("User", $this->int_link_filter)) {
218  return true;
219  }
220 
221  return false;
222  }
223 
229  public function setEnableWikiLinks($a_enablewikilinks)
230  {
231  $this->enablewikilinks = $a_enablewikilinks;
232  }
233 
239  public function getEnableWikiLinks()
240  {
241  return $this->enablewikilinks;
242  }
243 
249  public function addIntLinkFilter($a_val)
250  {
251  $lng = $this->lng;
252 
253  $this->setLocalizationLanguage($lng->getLangKey());
254  if (is_array($a_val)) {
255  $this->int_link_filter =
256  array_merge($a_val, $this->int_link_filter);
257  } else {
258  $this->int_link_filter[] = $a_val;
259  }
260  }
261 
267  public function removeIntLinkFilter($a_val)
268  {
269  foreach ($this->int_link_filter as $k => $v) {
270  if ($v == $a_val) {
271  unset($this->int_link_filter[$k]);
272  }
273  }
274  }
275 
276 
282  public function getIntLinkFilters()
283  {
284  return $this->int_link_filter;
285  }
286 
292  public function setIntLinkFilterWhiteList($a_white_list)
293  {
294  $this->link_filter_white_list = $a_white_list;
295  if ($a_white_list) {
296  $this->int_link_filter = array();
297  }
298  }
299 
305  public function getIntLinkFilterWhiteList()
306  {
307  return $this->link_filter_white_list;
308  }
309 
315  public function setPreventRteUsage($a_val)
316  {
317  $this->prevent_rte_usage = $a_val;
318  }
319 
325  public function getPreventRteUsage()
326  {
328  }
329 
335  public function setLocalizationLanguage($a_val)
336  {
337  $this->localization_lang = $a_val;
338  }
339 
345  public function getLocalizationLanguage()
346  {
347  return $this->localization_lang;
348  }
349 
355  public function setUseAttachedContent($a_val)
356  {
357  $this->use_attached_content = $a_val;
358  }
359 
365  public function getUseAttachedContent()
366  {
368  }
369 
375  public function setIntLinkHelpDefaultType($a_val)
376  {
377  $this->int_link_def_type = $a_val;
378  }
379 
385  public function getIntLinkHelpDefaultType()
386  {
388  }
389 
395  public function setIntLinkHelpDefaultId($a_val, $a_is_ref = true)
396  {
397  $this->int_link_def_id = $a_val;
398  $this->int_link_def_id_is_ref = $a_is_ref;
399  }
400 
406  public function getIntLinkHelpDefaultId()
407  {
408  return $this->int_link_def_id;
409  }
410 
417  {
418  return $this->int_link_def_id_is_ref;
419  }
420 
426  public function setEnableActivation($a_val)
427  {
428  $this->activation = $a_val;
429  }
430 
436  public function getEnableActivation()
437  {
438  return $this->activation;
439  }
440 
446  public function setEnableScheduledActivation($a_val)
447  {
448  $this->scheduled_activation = $a_val;
449  }
450 
457  {
459  }
460 
466  public function setEnablePageToc($a_val)
467  {
468  $this->page_toc = $a_val;
469  }
470 
476  public function getEnablePageToc()
477  {
478  return $this->page_toc;
479  }
480 
486  public function setPreventHTMLUnmasking($a_preventhtmlunmasking)
487  {
488  $this->preventhtmlunmasking = $a_preventhtmlunmasking;
489  }
490 
496  public function getPreventHTMLUnmasking()
497  {
498  $safe = true;
499  if ($this->adve_set->get("act_html_" . $this->page_obj_key)) {
500  $safe = false;
501  }
502  return $safe;
503  //return $this->preventhtmlunmasking;
504  }
505 
511  public function setEnableSelfAssessment($a_enabledselfassessment, $a_scorm = true)
512  {
513  $this->setEnablePCType("Question", (bool) $a_enabledselfassessment);
514  $this->enabledselfassessment = $a_enabledselfassessment;
515  $this->enabledselfassessment_scorm = $a_scorm;
516  }
517 
518 
524  public function getEnableSelfAssessment()
525  {
527  }
528 
535  {
537  }
538 
544  public function setDisableDefaultQuestionFeedback($a_val)
545  {
546  $this->disable_default_qfeedback = $a_val;
547  }
548 
555  {
557  }
558 
564  public function setMultiLangSupport($a_val)
565  {
566  $this->multi_lang_support = $a_val;
567  }
568 
574  public function getMultiLangSupport()
575  {
577  }
578 
584  public function setSinglePageMode($a_val)
585  {
586  $this->single_page_mode = $a_val;
587  }
588 
594  public function getSinglePageMode()
595  {
597  }
598 
600  {
601  $this->question_html = $question_html;
602  }
603 
604  public function getQuestionHTML()
605  {
606  return $this->question_html;
607  }
608 
614  public function setUseStoredQuestionTries($a_val)
615  {
616  $this->use_stored_tries = $a_val;
617  }
618 
624  public function getUseStoredQuestionTries()
625  {
627  }
628 
634  public function setEnablePermissionChecks($a_val)
635  {
636  $this->enable_permission_checks = $a_val;
637  }
638 
644  public function getEnablePermissionChecks()
645  {
647  }
648 
652  public function setEditLockSupport($a_val)
653  {
654  $this->edit_lock_support = $a_val;
655  }
656 
660  public function getEditLockSupport()
661  {
663  }
664 
669  public function setUsePageContainer($a_val)
670  {
671  $this->use_page_container = $a_val;
672  }
673 
678  public function getUsePageContainer()
679  {
681  }
682 }
getEnableSelfAssessment()
Get Enable Self Assessment Questions.
setUseAttachedContent($a_val)
Set use attached content.
getEnablePageToc()
Get enable page toc.
setEnablePCType($a_pc_type, $a_val)
Set enable pc type.
setEnableSelfAssessment($a_enabledselfassessment, $a_scorm=true)
Set Enable Self Assessment Questions.
getLocalizationLanguage()
Get localizazion language.
setEnableWikiLinks($a_enablewikilinks)
Set Enable Wiki Links.
setEnableKeywords($a_val)
Set enable keywords handling.
setIntLinkHelpDefaultType($a_val)
Set internal link default type.
COPage page object definition handler.
setEnableAnchors($a_val)
Set enable anchors.
getIntLinkFilterWhiteList()
Get internal links filter type list to white list.
getMultiLangSupport()
Get multi language support.
setEnableScheduledActivation($a_val)
Set enable scheduled page activation.
getIntLinkFilters()
Get internal links filter.
getUsePageContainer()
Get if page container css class should be used.
setUsePageContainer($a_val)
Set if page container css class should be used.
static getPCDefinitions()
Get PC definitions.
getEnableWikiLinks()
Get Enable Wiki Links.
setMultiLangSupport($a_val)
Set multi language support.
setSinglePageMode($a_val)
Set single page mode.
getEnableScheduledActivation()
Get enable scheduled page activation.
getUseStoredQuestionTries()
Get use stored answers/tries.
removeIntLinkFilter($a_val)
Remove int link filter.
setEnablePageToc($a_val)
Set enable page toc.
Config class for page editing.
setLocalizationLanguage($a_val)
Set localizazion language.
getEnableKeywords()
Get enable keywords handling.
setQuestionHTML($question_html)
getEnableAnchors()
Get enable anchors.
getEnablePCType($a_pc_type)
Get enable pc type.
getUseAttachedContent()
Get use attached content.
getDisableDefaultQuestionFeedback()
Get disable default question feedback.
getEnableSelfAssessmentScorm()
Is self assessment used in SCORM mode?
global $DIC
Definition: goto.php:24
setEnableInternalLinks($a_enabledinternallinks)
Set Enable internal links.
getIntLinkHelpDefaultType()
Get internal link default type.
setEnableActivation($a_val)
Set enabled actication.
getEnablePermissionChecks()
Get enable permission checks.
setDisableDefaultQuestionFeedback($a_val)
Set disable default question feedback.
getIntLinkHelpDefaultId()
Get internal link default id.
getPreventRteUsage()
Get prevent rte usage.
getSinglePageMode()
Get single page mode.
setPreventHTMLUnmasking($a_preventhtmlunmasking)
Set Prevent HTML Unmasking (true/false).
addIntLinkFilter($a_val)
Add internal links filter.
getEnableUserLinks()
Get enable user links.
setEditLockSupport($a_val)
getIntLinkHelpDefaultIdIsRef()
Get internal link default id.
setIntLinkFilterWhiteList($a_white_list)
Set internal links filter type list to white list.
getEnableActivation()
Get enabled actication.
getPreventHTMLUnmasking()
Get Prevent HTML Unmasking (true/false).
__construct()
Constructor.
setUseStoredQuestionTries($a_val)
Set use stored answers/tries.
getEnabledTopPCTypes()
Get enable pc type.
setPreventRteUsage($a_val)
Set prevent rte usage.
setEnablePermissionChecks($a_val)
Set enable permission checks.
setIntLinkHelpDefaultId($a_val, $a_is_ref=true)
Set internal link default id.
getEnableInternalLinks()
Get Enable internal links.