ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclFieldProperty.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 
25  protected $id;
35  protected $field_id;
44  protected $name;
52  protected $value;
53 
54 
61  public function __construct($primary_key = 0, $connector = null)
62  {
63  parent::__construct($primary_key, $connector);
64  }
65 
66 
71  public static function returnDbTableName()
72  {
73  return "il_dcl_field_prop";
74  }
75 
76 
80  public function getId()
81  {
82  return $this->id;
83  }
84 
85 
89  public function setId($id)
90  {
91  $this->id = $id;
92  }
93 
94 
98  public function getFieldId()
99  {
100  return $this->field_id;
101  }
102 
103 
107  public function setFieldId($field_id)
108  {
109  $this->field_id = $field_id;
110  }
111 
112 
116  public function getName()
117  {
118  return $this->name;
119  }
120 
121 
125  public function setName($name)
126  {
127  $this->name = $name;
128  }
129 
130 
134  public function getValue()
135  {
136  return $this->value;
137  }
138 
139 
143  public function setValue($value)
144  {
145  $this->value = $value;
146  }
147 
148 
152  public function create()
153  {
154  $this->value = $this->serializeData($this->value);
155  parent::create();
156  }
157 
158 
162  public function update()
163  {
164  $this->value = $this->serializeData($this->value);
165  parent::update();
166  }
167 
168 
172  public function afterObjectLoad()
173  {
174  $this->value = $this->deserializeData($this->value);
175  }
176 
177 
185  public function serializeData($value)
186  {
187  if (is_array($value)) {
188  $value = json_encode($value);
189  }
190 
191  return $value;
192  }
193 
194 
202  public function deserializeData($value)
203  {
204  $deserialize = json_decode($value, true);
205  if (is_array($deserialize)) {
206  return $deserialize;
207  }
208 
209  return $value;
210  }
211 }
Class ActiveRecord.
Class ilDclFieldProperty.
serializeData($value)
Serialize data before storing to db.
deserializeData($value)
Deserialize data before applying to field.
update($pash, $contents, Config $config)
__construct($primary_key=0, $connector=null)
ilDclFieldProperty constructor.