ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
4require_once('./Services/ActiveRecord/class.ActiveRecord.php');
5
6
15{
16
28 protected $id;
29
39 protected $field_id;
40
49 protected $name;
50
58 protected $value;
59
60
67 public function __construct($primary_key = 0, $connector = NULL)
68 {
69 parent::__construct($primary_key, $connector);
70 }
71
76 static function returnDbTableName() {
77 return "il_dcl_field_prop";
78 }
79
80
84 public function getId() {
85 return $this->id;
86 }
87
88
92 public function setId($id) {
93 $this->id = $id;
94 }
95
96
100 public function getFieldId() {
101 return $this->field_id;
102 }
103
104
108 public function setFieldId($field_id) {
109 $this->field_id = $field_id;
110 }
111
112
116 public function getName() {
117 return $this->name;
118 }
119
120
124 public function setName($name) {
125 $this->name = $name;
126 }
127
128
132 public function getValue() {
133 return $this->value;
134 }
135
136
140 public function setValue($value) {
141 $this->value = $value;
142 }
143
144
148 public function create() {
149 $this->value = $this->serializeData($this->value);
150 parent::create();
151 }
152
153
157 public function update() {
158 $this->value = $this->serializeData($this->value);
159 parent::update();
160 }
161
162
166 public function afterObjectLoad() {
167 $this->value = $this->deserializeData($this->value);
168 }
169
170
177 public function serializeData($value) {
178 if(is_array($value)) {
179 $value = json_encode($value);
180 }
181 return $value;
182 }
183
184
191 public function deserializeData($value) {
192 $deserialize = json_decode($value, true);
193 if(is_array($deserialize)) {
194 return $deserialize;
195 }
196 return $value;
197 }
198}
199
200
201?>
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class ilDclFieldProperty.
serializeData($value)
Serialize data before storing to db.
__construct($primary_key=0, $connector=NULL)
ilDclFieldProperty constructor.
deserializeData($value)
Deserialize data before applying to field.