ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTableViewFieldSetting.php
Go to the documentation of this file.
1<?php
2require_once('./Services/ActiveRecord/class.ActiveRecord.php');
12{
13
25 protected $id;
26
35 protected $tableview_id;
36
46 protected $field;
47
55 protected $visible;
56
64 protected $in_filter;
65
73 protected $filter_value;
74
83
88 static function returnDbTableName() {
89 return "il_dcl_tview_set";
90 }
91
95 public function getTableviewId()
96 {
98 }
99
104 {
105 $this->tableview_id = $tableview_id;
106 }
107
111 public function getField()
112 {
113 return $this->field;
114 }
115
119 public function setField($field)
120 {
121 $this->field = $field;
122 }
123
127 public function isVisible()
128 {
129 return $this->visible;
130 }
131
135 public function setVisible($visible)
136 {
137 $this->visible = $visible;
138 }
139
143 public function isInFilter()
144 {
145 return $this->in_filter;
146 }
147
151 public function setInFilter($in_filter)
152 {
153 $this->in_filter = $in_filter;
154 }
155
159 public function getFilterValue()
160 {
161 return $this->filter_value;
162 }
163
168 {
169 $this->filter_value = $filter_value;
170 }
171
175 public function isFilterChangeable()
176 {
178 }
179
184 {
185 $this->filter_changeable = $filter_changeable;
186 }
187
191 public function getId()
192 {
193 return $this->id;
194 }
195
199 public function setId($id)
200 {
201 $this->id = $id;
202 }
203
208 public function sleep($field_name)
209 {
210 if ($field_name == 'filter_value' && is_array($this->filter_value))
211 {
212 return json_encode($this->filter_value);
213 }
214 return null;
215 }
216
222 public function wakeUp($field_name, $field_value)
223 {
224 if ($field_name == 'filter_value')
225 {
226 $return = array();
227 $json = json_decode($field_value, true);
228 if (is_array($json))
229 {
230 foreach ($json as $key => $value) {
231 $return['filter_' . $this->getField() . '_' . $key] = $value;
232 }
233 } else {
234 $return = array('filter_' . $this->getField() => $field_value);
235 }
236 return $return;
237 }
238 return null;
239 }
240
243 $this->setInFilter($orig->isInFilter());
244 $this->setVisible($orig->isVisible());
245 $this->setFilterValue($orig->getFilterValue());
246 $this->create();
247 }
248
252 public function getFieldObject()
253 {
254 if (is_numeric($this->field))
255 { //normal field
256 return ilDclCache::getFieldCache($this->field);
257 }
258 else
259 { //standard field
260 global $DIC;
261 $lng = $DIC['lng'];
262 $stdfield = new ilDclStandardField();
263 $stdfield->setId($this->field);
264 $stdfield->setDatatypeId(ilDclStandardField::_getDatatypeForId($this->field));
265 $stdfield->setTitle($lng->txt('dcl_'.$this->field));
266 return $stdfield;
267 }
268
269 }
270
276 public static function getInstance($tableview_id, $field_id) {
277 if ($setting = self::where(array('field' => $field_id, 'tableview_id' => $tableview_id))->first()) {
278 return $setting;
279 } else {
280 $setting = new self();
281 $setting->setField($field_id);
282 $setting->setTableviewId($tableview_id);
283 return $setting;
284 }
285 }
286}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
static getFieldCache($field_id=0)
Class ilDclBaseFieldModel.
static _getDatatypeForId($id)
gives you the datatype id of a specified standard field.
Class ilDclTableViewFieldSetting.
cloneStructure(ilDclTableViewFieldSetting $orig)
static getInstance($tableview_id, $field_id)
global $lng
Definition: privfeed.php:17
global $DIC