ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPageEditorSettings.php
Go to the documentation of this file.
1<?php
2
25{
26 // settings groups. each group contains one or multiple
27 // page parent types
28 protected static array $option_groups = array(
29 "lm" => array("lm"),
30 "wiki" => array("wpg"),
31 "glo" => array("term"),
32 "test" => array("qpl"),
33 "rep" => array("cont"),
34 "copa" => array("copa"),
35 "frm" => array("frm"),
36 );
37
41 public static function getGroups(): array
42 {
44 }
45
49 public static function writeSetting(
50 string $a_grp,
51 string $a_name,
52 string $a_value
53 ): void {
54 global $DIC;
55
56 $ilDB = $DIC->database();
57
58 $ilDB->manipulate(
59 "DELETE FROM page_editor_settings WHERE " .
60 "settings_grp = " . $ilDB->quote($a_grp, "text") .
61 " AND name = " . $ilDB->quote($a_name, "text")
62 );
63
64 $ilDB->manipulate("INSERT INTO page_editor_settings " .
65 "(settings_grp, name, value) VALUES (" .
66 $ilDB->quote($a_grp, "text") . "," .
67 $ilDB->quote($a_name, "text") . "," .
68 $ilDB->quote($a_value, "text") .
69 ")");
70 }
71
75 public static function lookupSetting(
76 string $a_grp,
77 string $a_name,
78 string $a_default = '0'
79 ): string {
80 global $DIC;
81
82 $ilDB = $DIC->database();
83
84 $set = $ilDB->query(
85 "SELECT value FROM page_editor_settings " .
86 " WHERE settings_grp = " . $ilDB->quote($a_grp, "text") .
87 " AND name = " . $ilDB->quote($a_name, "text")
88 );
89 if ($rec = $ilDB->fetchAssoc($set)) {
90 return (string) $rec["value"];
91 }
92
93 return $a_default;
94 }
95
99 public static function lookupSettingByParentType(
100 string $a_par_type,
101 string $a_name,
102 string $a_default = '0'
103 ): string {
104 $grp = "";
105 foreach (self::$option_groups as $g => $types) {
106 if (in_array($a_par_type, $types)) {
107 $grp = $g;
108 }
109 }
110
111 if ($grp != "") {
112 return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default);
113 }
114
115 return $a_default;
116 }
117}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupSettingByParentType(string $a_par_type, string $a_name, string $a_default='0')
Lookup setting by parent type.
static getGroups()
Get all settings groups.
static writeSetting(string $a_grp, string $a_name, string $a_value)
Write Setting.
static lookupSetting(string $a_grp, string $a_name, string $a_default='0')
Lookup setting.
global $DIC
Definition: shib_login.php:26