ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  );
23 
27  public static function getGroups()
28  {
29  return self::$option_groups;
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 }
global $DIC
Definition: saml.php:7
static lookupSetting($a_grp, $a_name, $a_default=false)
Lookup setting.
static getGroups()
Get all settings groups.
static writeSetting($a_grp, $a_name, $a_value)
Write Setting.
Create styles array
The data for the language used.
static lookupSettingByParentType($a_par_type, $a_name, $a_default=false)
Lookup setting by parent type.
global $ilDB