ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.arConfig.php
Go to the documentation of this file.
1 <?php
2 require_once('./Services/ActiveRecord/class.ActiveRecord.php');
3 
10 class arConfig extends ActiveRecord
11 {
12 
17  public static function returnDbTableName()
18  {
19  return 'ar_demo_config';
20  }
21 
22 
26  protected static $cache = array();
30  protected static $cache_loaded = array();
31 
32 
38  public static function get($name)
39  {
40  if (!self::$cache_loaded[$name]) {
41  $obj = new self($name);
42  self::$cache[$name] = $obj->getValue();
43  self::$cache_loaded[$name] = true;
44  }
45 
46  return self::$cache[$name];
47  }
48 
49 
54  public static function set($name, $value)
55  {
56  $obj = new self($name);
57  $obj->setValue($value);
58  if (self::where(array( 'name' => $name ))->hasSets()) {
59  $obj->update();
60  } else {
61  $obj->create();
62  }
63  }
64 
65 
75  protected $name;
83  protected $value;
84 
85 
89  public function setName($name)
90  {
91  $this->name = $name;
92  }
93 
94 
98  public function getName()
99  {
100  return $this->name;
101  }
102 
103 
107  public function setValue($value)
108  {
109  $this->value = $value;
110  }
111 
112 
116  public function getValue()
117  {
118  return $this->value;
119  }
120 }
static $cache_loaded
setValue($value)
setName($name)
Class ActiveRecord.
static $cache
Class arConfig.
static returnDbTableName()