ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclTableViewFieldSetting.php
Go to the documentation of this file.
1<?php
2
12{
13
25 protected $id;
34 protected $tableview_id;
44 protected $field;
52 protected $visible;
60 protected $in_filter;
68 protected $filter_value;
77
78
83 public static function returnDbTableName()
84 {
85 return "il_dcl_tview_set";
86 }
87
88
92 public function getTableviewId()
93 {
95 }
96
97
102 {
103 $this->tableview_id = $tableview_id;
104 }
105
106
110 public function getField()
111 {
112 return $this->field;
113 }
114
115
119 public function setField($field)
120 {
121 $this->field = $field;
122 }
123
124
128 public function isVisible()
129 {
130 return $this->visible;
131 }
132
133
137 public function setVisible($visible)
138 {
139 $this->visible = $visible;
140 }
141
142
146 public function isInFilter()
147 {
148 return $this->in_filter;
149 }
150
151
155 public function setInFilter($in_filter)
156 {
157 $this->in_filter = $in_filter;
158 }
159
160
164 public function getFilterValue()
165 {
166 return $this->filter_value;
167 }
168
169
174 {
175 $this->filter_value = $filter_value;
176 }
177
178
182 public function isFilterChangeable()
183 {
185 }
186
187
192 {
193 $this->filter_changeable = $filter_changeable;
194 }
195
196
200 public function getId()
201 {
202 return $this->id;
203 }
204
205
209 public function setId($id)
210 {
211 $this->id = $id;
212 }
213
214
220 public function sleep($field_name)
221 {
222 if ($field_name == 'filter_value' && is_array($this->filter_value)) {
223 return json_encode($this->filter_value);
224 }
225
226 return null;
227 }
228
229
236 public function wakeUp($field_name, $field_value)
237 {
238 if ($field_name == 'filter_value') {
239 $return = array();
240 $json = json_decode($field_value, true);
241 if (is_array($json)) {
242 foreach ($json as $key => $value) {
243 $return['filter_' . $this->getField() . '_' . $key] = $value;
244 }
245 } else {
246 $return = array('filter_' . $this->getField() => $field_value);
247 }
248
249 return $return;
250 }
251
252 return null;
253 }
254
255
257 {
259 $this->setInFilter($orig->isInFilter());
260 $this->setVisible($orig->isVisible());
261 $this->setFilterValue($orig->getFilterValue());
262 $this->create();
263 }
264
265
269 public function getFieldObject()
270 {
271 if (is_numeric($this->field)) { //normal field
272 return ilDclCache::getFieldCache($this->field);
273 } else { //standard field
274 global $DIC;
275 $lng = $DIC['lng'];
276 $stdfield = new ilDclStandardField();
277 $stdfield->setId($this->field);
278 $stdfield->setDatatypeId(ilDclStandardField::_getDatatypeForId($this->field));
279 $stdfield->setTitle($lng->txt('dcl_' . $this->field));
280
281 return $stdfield;
282 }
283 }
284
285
292 public static function getInstance($tableview_id, $field_id)
293 {
294 if ($setting = self::where(array('field' => $field_id, 'tableview_id' => $tableview_id))->first()) {
295 return $setting;
296 } else {
297 $setting = new self();
298 $setting->setField($field_id);
299 $setting->setTableviewId($tableview_id);
300
301 return $setting;
302 }
303 }
304}
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)
$key
Definition: croninfo.php:18
global $DIC
Definition: saml.php:7
$lng