ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.arViewField.php
Go to the documentation of this file.
1 <?php
2 include_once('./Customizing/global/plugins/Libraries/ActiveRecord/Fields/class.arField.php');
3 
11 class arViewField extends arField {
12 
16  protected $txt_prefix = "";
20  protected $txt = "";
24  protected $position = 1000;
28  protected $visible = false;
32  protected $custom_field = false;
36  protected $get_function_name = "";
40  protected $set_function_name = "";
44  protected $is_created_by_field = false;
48  protected $is_modified_by_field = false;
52  protected $is_creation_date_field = false;
56  protected $is_modification_date_field = false;
57 
58 
66  function __construct($name, $txt = NULL, $position = 0, $visible = true, $custom_field = false) {
67  $this->name = $name;
68  $this->position = $position;
69  $this->txt = $txt;
70  $this->visible = $visible;
71  $this->custom_field = $custom_field;
72 
73  $camel_case = ActiveRecord::_toCamelCase($this->getName(), true);
74  $this->get_function_name = "get" . $camel_case;
75  $this->set_function_name = "set" . $camel_case;
76  }
77 
78 
82  public function setPosition($position) {
83  $this->position = $position;
84  }
85 
86 
90  public function getPosition() {
91  return $this->position;
92  }
93 
94 
98  public function setTxt($txt) {
99  $this->txt = $txt;
100  }
101 
102 
106  public function getTxt() {
107  if ($this->txt) {
108  return $this->getTxtPrefix() . $this->txt;
109  }
110 
111  return $this->getTxtPrefix() . $this->getName();
112  }
113 
114 
118  public function setVisible($visible) {
119  $this->visible = $visible;
120  }
121 
122 
126  public function getVisible() {
127  return $this->visible;
128  }
129 
130 
134  public function setCustomField($custom_field) {
135  $this->custom_field = $custom_field;
136  }
137 
138 
142  public function getCustomField() {
143  return $this->custom_field;
144  }
145 
146 
150  public static function setAllowedAttributes($allowed_attributes) {
151  self::$allowed_attributes = $allowed_attributes;
152  }
153 
154 
158  public static function getAllowedAttributes() {
160  }
161 
162 
166  public function setTxtPrefix($txt_prefix) {
167  $this->txt_prefix = $txt_prefix;
168  }
169 
170 
174  public function getTxtPrefix() {
175  return $this->txt_prefix;
176  }
177 
178 
182  public function getGetFunctionName() {
184  }
185 
186 
190  public function getSetFunctionName() {
192  }
193 
194 
199  $this->is_created_by_field = $is_created_by_field;
200  }
201 
202 
207  $this->is_creation_date_field = $is_creation_date_field;
208  }
209 
210 
214  public function getIsCreationDateField() {
216  }
217 
218 
222  public function getIsCreatedByField() {
224  }
225 
226 
231  $this->is_modified_by_field = $is_modified_by_field;
232  }
233 
234 
238  public function getIsModifiedByField() {
240  }
241 
242 
247  $this->is_modification_date_field = $is_modification_date_field;
248  }
249 
250 
254  public function getIsModificationDateField() {
256  }
257 
258 
264  static function castFromFieldToViewField(arField $field) {
265  require_once('./Customizing/global/plugins/Libraries/ActiveRecord/Views/Index/class.arIndexTableField.php');
266  require_once('./Customizing/global/plugins/Libraries/ActiveRecord/Views/Edit/class.arEditField.php');
267  require_once('./Customizing/global/plugins/Libraries/ActiveRecord/Views/Display/class.arDisplayField.php');
268 
269  $field_class = get_called_class();
270  $obj = new $field_class($field->getName());
271  foreach (get_object_vars($field) as $key => $name) {
272  $obj->$key = $name;
273  }
274 
275  return $obj;
276  }
277 }