ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  "scorm" => array("sahs"),
18  "glo" => array("gdf"),
19  "test" => array("qpl"),
20  "rep" => array("root", "cat", "grp", "crs", "fold")
21  );
22 
26  static function getGroups()
27  {
28  return self::$option_groups;
29  }
30 
34  static function writeSetting($a_grp, $a_name, $a_value)
35  {
36  global $ilDB;
37 
38  $ilDB->manipulate("DELETE FROM page_editor_settings WHERE ".
39  "settings_grp = ".$ilDB->quote($a_grp, "text").
40  " AND name = ".$ilDB->quote($a_name, "text")
41  );
42 
43  $ilDB->manipulate("INSERT INTO page_editor_settings ".
44  "(settings_grp, name, value) VALUES (".
45  $ilDB->quote($a_grp, "text").",".
46  $ilDB->quote($a_name, "text").",".
47  $ilDB->quote($a_value, "text").
48  ")");
49  }
50 
54  static function lookupSetting($a_grp, $a_name, $a_default = false)
55  {
56  global $ilDB;
57 
58  $set = $ilDB->query("SELECT value FROM page_editor_settings ".
59  " WHERE settings_grp = ".$ilDB->quote($a_grp, "text").
60  " AND name = ".$ilDB->quote($a_name, "text")
61  );
62  if ($rec = $ilDB->fetchAssoc($set))
63  {
64  return $rec["value"];
65  }
66 
67  return $a_default;
68  }
69 
73  static function lookupSettingByParentType($a_par_type, $a_name, $a_default = false)
74  {
75  foreach(self::$option_groups as $g => $types)
76  {
77  if (in_array($a_par_type, $types))
78  {
79  $grp = $g;
80  }
81  }
82 
83  if ($grp != "")
84  {
85  return ilPageEditorSettings::lookupSetting($grp, $a_name, $a_default);
86  }
87 
88  return $a_default;
89  }
90 
91 }
92 ?>