ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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"),
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 "copa" => array("copa"),
23 );
24
28 public static function getGroups()
29 {
31 }
32
36 public static function writeSetting($a_grp, $a_name, $a_value)
37 {
38 global $DIC;
39
40 $ilDB = $DIC->database();
41
42 $ilDB->manipulate(
43 "DELETE FROM page_editor_settings WHERE " .
44 "settings_grp = " . $ilDB->quote($a_grp, "text") .
45 " AND name = " . $ilDB->quote($a_name, "text")
46 );
47
48 $ilDB->manipulate("INSERT INTO page_editor_settings " .
49 "(settings_grp, name, value) VALUES (" .
50 $ilDB->quote($a_grp, "text") . "," .
51 $ilDB->quote($a_name, "text") . "," .
52 $ilDB->quote($a_value, "text") .
53 ")");
54 }
55
59 public static function lookupSetting($a_grp, $a_name, $a_default = false)
60 {
61 global $DIC;
62
63 $ilDB = $DIC->database();
64
65 $set = $ilDB->query(
66 "SELECT value FROM page_editor_settings " .
67 " WHERE settings_grp = " . $ilDB->quote($a_grp, "text") .
68 " AND name = " . $ilDB->quote($a_name, "text")
69 );
70 if ($rec = $ilDB->fetchAssoc($set)) {
71 return $rec["value"];
72 }
73
74 return $a_default;
75 }
76
80 public static function lookupSettingByParentType($a_par_type, $a_name, $a_default = false)
81 {
82 foreach (self::$option_groups as $g => $types) {
83 if (in_array($a_par_type, $types)) {
84 $grp = $g;
85 }
86 }
87
88 if ($grp != "") {
89 return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default);
90 }
91
92 return $a_default;
93 }
94}
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 $ilDB
$DIC
Definition: xapitoken.php:46