ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclTableViewFieldSetting.php
Go to the documentation of this file.
1<?php
2
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 public static function returnDbTableName()
89 {
90 return "il_dcl_tview_set";
91 }
92
96 public function getTableviewId()
97 {
99 }
100
105 {
106 $this->tableview_id = $tableview_id;
107 }
108
112 public function getField()
113 {
114 return $this->field;
115 }
116
120 public function setField($field)
121 {
122 $this->field = $field;
123 }
124
128 public function isVisible()
129 {
130 return $this->visible;
131 }
132
136 public function setVisible($visible)
137 {
138 $this->visible = $visible;
139 }
140
144 public function isInFilter()
145 {
146 return $this->in_filter;
147 }
148
152 public function setInFilter($in_filter)
153 {
154 $this->in_filter = $in_filter;
155 }
156
160 public function getFilterValue()
161 {
162 return $this->filter_value;
163 }
164
169 {
170 $this->filter_value = $filter_value;
171 }
172
176 public function isFilterChangeable()
177 {
179 }
180
185 {
186 $this->filter_changeable = $filter_changeable;
187 }
188
192 public function getId()
193 {
194 return $this->id;
195 }
196
200 public function setId($id)
201 {
202 $this->id = $id;
203 }
204
209 public function sleep($field_name)
210 {
211 if ($field_name == 'filter_value' && is_array($this->filter_value)) {
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 $return = array();
226 $json = json_decode($field_value, true);
227 if (is_array($json)) {
228 foreach ($json as $key => $value) {
229 $return['filter_' . $this->getField() . '_' . $key] = $value;
230 }
231 } else {
232 $return = array('filter_' . $this->getField() => $field_value);
233 }
234 return $return;
235 }
236 return null;
237 }
238
240 {
242 $this->setInFilter($orig->isInFilter());
243 $this->setVisible($orig->isVisible());
244 $this->setFilterValue($orig->getFilterValue());
245 $this->create();
246 }
247
251 public function getFieldObject()
252 {
253 if (is_numeric($this->field)) { //normal field
254 return ilDclCache::getFieldCache($this->field);
255 } else { //standard field
256 global $DIC;
257 $lng = $DIC['lng'];
258 $stdfield = new ilDclStandardField();
259 $stdfield->setId($this->field);
260 $stdfield->setDatatypeId(ilDclStandardField::_getDatatypeForId($this->field));
261 $stdfield->setTitle($lng->txt('dcl_' . $this->field));
262 return $stdfield;
263 }
264 }
265
271 public static function getInstance($tableview_id, $field_id)
272 {
273 if ($setting = self::where(array('field' => $field_id, 'tableview_id' => $tableview_id))->first()) {
274 return $setting;
275 } else {
276 $setting = new self();
277 $setting->setField($field_id);
278 $setting->setTableviewId($tableview_id);
279 return $setting;
280 }
281 }
282}
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 $lng
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7