ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.arViewField.php
Go to the documentation of this file.
1<?php
2include_once('./Services/ActiveRecord/Fields/class.arField.php');
3
11class arViewField extends arField
12{
13
17 protected $txt_prefix = "";
21 protected $txt = "";
25 protected $position = 1000;
29 protected $visible = false;
33 protected $custom_field = false;
37 protected $get_function_name = "";
41 protected $set_function_name = "";
45 protected $is_created_by_field = false;
49 protected $is_modified_by_field = false;
53 protected $is_creation_date_field = false;
57 protected $is_modification_date_field = false;
58
59
67 public function __construct($name, $txt = null, $position = 0, $visible = true, $custom_field = false)
68 {
69 $this->name = $name;
70 $this->position = $position;
71 $this->txt = $txt;
72 $this->visible = $visible;
73 $this->custom_field = $custom_field;
74
75 $camel_case = ActiveRecord::_toCamelCase($this->getName(), true);
76 $this->get_function_name = "get" . $camel_case;
77 $this->set_function_name = "set" . $camel_case;
78 }
79
80
84 public function setPosition($position)
85 {
86 $this->position = $position;
87 }
88
89
93 public function getPosition()
94 {
95 return $this->position;
96 }
97
98
102 public function setTxt($txt)
103 {
104 $this->txt = $txt;
105 }
106
107
111 public function getTxt()
112 {
113 if ($this->txt) {
114 return $this->getTxtPrefix() . $this->txt;
115 }
116
117 return $this->getTxtPrefix() . $this->getName();
118 }
119
120
124 public function setVisible($visible)
125 {
126 $this->visible = $visible;
127 }
128
129
133 public function getVisible()
134 {
135 return $this->visible;
136 }
137
138
143 {
144 $this->custom_field = $custom_field;
145 }
146
147
151 public function getCustomField()
152 {
153 return $this->custom_field;
154 }
155
156
161 {
162 self::$allowed_attributes = $allowed_attributes;
163 }
164
165
169 public static function getAllowedAttributes()
170 {
172 }
173
174
178 public function setTxtPrefix($txt_prefix)
179 {
180 $this->txt_prefix = $txt_prefix;
181 }
182
183
187 public function getTxtPrefix()
188 {
189 return $this->txt_prefix;
190 }
191
192
196 public function getGetFunctionName()
197 {
199 }
200
201
205 public function getSetFunctionName()
206 {
208 }
209
210
215 {
216 $this->is_created_by_field = $is_created_by_field;
217 }
218
219
224 {
225 $this->is_creation_date_field = $is_creation_date_field;
226 }
227
228
232 public function getIsCreationDateField()
233 {
235 }
236
237
241 public function getIsCreatedByField()
242 {
244 }
245
246
251 {
252 $this->is_modified_by_field = $is_modified_by_field;
253 }
254
255
259 public function getIsModifiedByField()
260 {
262 }
263
264
269 {
270 $this->is_modification_date_field = $is_modification_date_field;
271 }
272
273
278 {
280 }
281
282
288 public static function castFromFieldToViewField(arField $field)
289 {
290 require_once('./Services/ActiveRecord/Views/Index/class.arIndexTableField.php');
291 require_once('./Services/ActiveRecord/Views/Edit/class.arEditField.php');
292 require_once('./Services/ActiveRecord/Views/Display/class.arDisplayField.php');
293
294 $field_class = get_called_class();
295 $obj = new $field_class($field->getName());
296 foreach (get_object_vars($field) as $key => $name) {
297 $obj->$key = $name;
298 }
299
300 return $obj;
301 }
302}
static _toCamelCase($str, $capitalise_first_char=false)
An exception for terminatinating execution or to throw for unit testing.
Class arField.
static $allowed_attributes
GUI-Class arViewField.
static getAllowedAttributes()
static castFromFieldToViewField(arField $field)
setVisible($visible)
__construct($name, $txt=null, $position=0, $visible=true, $custom_field=false)
setIsCreatedByField($is_created_by_field)
setTxtPrefix($txt_prefix)
setIsModificationDateField($is_modification_date_field)
setIsModifiedByField($is_modified_by_field)
setPosition($position)
setCustomField($custom_field)
setIsCreationDateField($is_creation_date_field)
static setAllowedAttributes($allowed_attributes)
$key
Definition: croninfo.php:18