ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPageEditorSettings.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2021 ILIAS open source, GPLv3, see LICENSE */
4
11{
12 // settings groups. each group contains one or multiple
13 // page parent types
14 protected static $option_groups = array(
15 "lm" => array("lm"),
16 "wiki" => array("wpg"),
17 "scorm" => array("sahs"),
18 "glo" => array("gdf"),
19 "test" => array("qpl"),
20 "rep" => array("cont"),
21 "copa" => array("copa"),
22 );
23
27 public static function getGroups()
28 {
30 }
31
35 public static function writeSetting($a_grp, $a_name, $a_value)
36 {
37 global $DIC;
38
39 $ilDB = $DIC->database();
40
41 $ilDB->manipulate(
42 "DELETE FROM page_editor_settings WHERE " .
43 "settings_grp = " . $ilDB->quote($a_grp, "text") .
44 " AND name = " . $ilDB->quote($a_name, "text")
45 );
46
47 $ilDB->manipulate("INSERT INTO page_editor_settings " .
48 "(settings_grp, name, value) VALUES (" .
49 $ilDB->quote($a_grp, "text") . "," .
50 $ilDB->quote($a_name, "text") . "," .
51 $ilDB->quote($a_value, "text") .
52 ")");
53 }
54
58 public static function lookupSetting($a_grp, $a_name, $a_default = false)
59 {
60 global $DIC;
61
62 $ilDB = $DIC->database();
63
64 $set = $ilDB->query(
65 "SELECT value FROM page_editor_settings " .
66 " WHERE settings_grp = " . $ilDB->quote($a_grp, "text") .
67 " AND name = " . $ilDB->quote($a_name, "text")
68 );
69 if ($rec = $ilDB->fetchAssoc($set)) {
70 return $rec["value"];
71 }
72
73 return $a_default;
74 }
75
79 public static function lookupSettingByParentType($a_par_type, $a_name, $a_default = false)
80 {
81 foreach (self::$option_groups as $g => $types) {
82 if (in_array($a_par_type, $types)) {
83 $grp = $g;
84 }
85 }
86
87 if ($grp != "") {
88 return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default);
89 }
90
91 return $a_default;
92 }
93}
An exception for terminatinating execution or to throw for unit testing.
static lookupSetting($a_grp, $a_name, $a_default=false)
Lookup setting.
static getGroups()
Get all settings groups.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
static writeSetting($a_grp, $a_name, $a_value)
Write Setting.
global $DIC
Definition: goto.php:24
global $ilDB