ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.arConfig.php
Go to the documentation of this file.
1<?php
2require_once('./Services/ActiveRecord/class.ActiveRecord.php');
3
10class arConfig extends ActiveRecord {
11
16 static function returnDbTableName() {
17 return 'ar_demo_config';
18 }
19
20
24 protected static $cache = array();
28 protected static $cache_loaded = array();
29
30
36 public static function get($name) {
37 if (!self::$cache_loaded[$name]) {
38 $obj = new self($name);
39 self::$cache[$name] = $obj->getValue();
40 self::$cache_loaded[$name] = true;
41 }
42
43 return self::$cache[$name];
44 }
45
46
51 public static function set($name, $value) {
52 $obj = new self($name);
53 $obj->setValue($value);
54 if (self::where(array( 'name' => $name ))->hasSets()) {
55 $obj->update();
56 } else {
57 $obj->create();
58 }
59 }
60
61
72 protected $name;
80 protected $value;
81
82
86 public function setName($name) {
87 $this->name = $name;
88 }
89
90
94 public function getName() {
95 return $this->name;
96 }
97
98
102 public function setValue($value) {
103 $this->value = $value;
104 }
105
106
110 public function getValue() {
111 return $this->value;
112 }
113}
114
115?>
Class ActiveRecord.
Class arConfig.
setName($name)
static $cache
static returnDbTableName()
static $cache_loaded
setValue($value)