ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPageEditorSettings.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 // settings groups. each group contains one or multiple
14 // page parent types
15 protected static $option_groups = array(
16 "lm" => array("lm", "dbk"),
17 "wiki" => array("wpg"),
18 "scorm" => array("sahs"),
19 "glo" => array("gdf"),
20 "test" => array("qpl"),
21 "rep" => array("root", "cat", "grp", "crs", "fold")
22 );
23
27 static function getGroups()
28 {
30 }
31
35 static function writeSetting($a_grp, $a_name, $a_value)
36 {
37 global $ilDB;
38
39 $ilDB->manipulate("DELETE FROM page_editor_settings WHERE ".
40 "settings_grp = ".$ilDB->quote($a_grp, "text").
41 " AND name = ".$ilDB->quote($a_name, "text")
42 );
43
44 $ilDB->manipulate("INSERT INTO page_editor_settings ".
45 "(settings_grp, name, value) VALUES (".
46 $ilDB->quote($a_grp, "text").",".
47 $ilDB->quote($a_name, "text").",".
48 $ilDB->quote($a_value, "text").
49 ")");
50 }
51
55 static function lookupSetting($a_grp, $a_name, $a_default = false)
56 {
57 global $ilDB;
58
59 $set = $ilDB->query("SELECT value FROM page_editor_settings ".
60 " WHERE settings_grp = ".$ilDB->quote($a_grp, "text").
61 " AND name = ".$ilDB->quote($a_name, "text")
62 );
63 if ($rec = $ilDB->fetchAssoc($set))
64 {
65 return $rec["value"];
66 }
67
68 return $a_default;
69 }
70
74 static function lookupSettingByParentType($a_par_type, $a_name, $a_default = false)
75 {
76 foreach(self::$option_groups as $g => $types)
77 {
78 if (in_array($a_par_type, $types))
79 {
80 $grp = $g;
81 }
82 }
83
84 if ($grp != "")
85 {
86 return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default);
87 }
88
89 return $a_default;
90 }
91
92}
93?>
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 $ilDB