ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclBaseFieldRepresentation.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11
12 protected $field;
13
17 protected $lng;
18
22 protected $ctrl;
23
25 global $DIC;
26 $lng = $DIC['lng'];
27 $ilCtrl = $DIC['ilCtrl'];
28 $this->field = $field;
29 $this->lng = $lng;
30 $this->ctrl = $ilCtrl;
31 }
32
33
40 public function addFilterInputFieldToTable(ilTable2GUI $table) {
41 return null;
42 }
43
44
49 protected function setupFilterInputField(ilFormPropertyGUI $input) {
50 if ($input != NULL) {
51 $input->setTitle($this->getField()->getTitle());
52 }
53 }
54
55
64 public function passThroughFilter(ilDclBaseRecordModel $record, $filter) {
65 $value = $record->getRecordFieldValue($this->getField()->getId());
66 $pass = true;
67
68 if (($this->getField()->getId() == "owner" || $this->getField()->getId() == "last_edit_by") && $filter) {
69 $pass = false;
70 $user = new ilObjUser($value);
71 if (strpos($user->getFullname(), $filter) !== false) {
72 $pass = true;
73 }
74 }
75
76 return $pass;
77 }
78
79
87 public function parseSortingValue($value, $link = true) {
88 return $value;
89 }
90
91
99 public function getInputField(ilPropertyFormGUI $form, $record_id = 0) {
100 return null;
101 }
102
103
110 $input->setRequired($field->getRequired());
111 $input->setInfo($field->getDescription() . ($input->getInfo() ? '<br>' . $input->getInfo() : ''));
112 }
113
114
120 protected function getFilterInputFieldValue(/*ilPropertyFormGUI*/ $input) {
121 $value = $input->getValue();
122 if (is_array($value)) {
123 if ($value['from'] || $value['to']) {
124 return $value;
125 }
126 } else {
127 if ($value != '') {
128 return $value;
129 }
130 }
131 return null;
132 }
133
134
142 public function addFieldCreationForm($form, ilObjDataCollection $dcl, $mode = "create") {
143 $opt = $this->buildFieldCreationInput($dcl, $mode);
144
145 if($mode != 'create' && $this->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_PLUGIN) {
146
147 $new_plugin_title = $opt->getTitle();
149 if($plugin_name !== "DclBase") {
150 $new_plugin_title .= ': '.$plugin_name;
151 }
152 $opt->setTitle($new_plugin_title);
153 }
154
155 $form->addOption($opt);
156 }
157
158
167 protected function buildFieldCreationInput(ilObjDataCollection $dcl, $mode = 'create') {
168 $opt = new ilRadioOption($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()), $this->getField()->getDatatypeId());
169 $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle(). '_desc'));
170
171 return $opt;
172 }
173
180 public function getPropertyInputFieldId($property) {
181 return "prop_".$property;
182 }
183
184
189 public function getField() {
190 return $this->field;
191 }
192
193}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
Class ilDclBaseFieldRepresentation.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Checks if a filter affects a record.
getPropertyInputFieldId($property)
Return post-var for property-fields.
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
addFieldCreationForm($form, ilObjDataCollection $dcl, $mode="create")
Adds the options for the field-types to the field-creation form.
buildFieldCreationInput(ilObjDataCollection $dcl, $mode='create')
Build the creation-input-field.
addFilterInputFieldToTable(ilTable2GUI $table)
Add filter input to TableGUI.
getInputField(ilPropertyFormGUI $form, $record_id=0)
Returns field-input.
Class ilDclBaseRecordModel.
getRecordFieldValue($field_id)
Get Field Value.
static getPluginNameFromFieldModel(ilDclBaseFieldModel $object)
Get plugin-name from FieldModel.
This class represents a property in a property form.
getInfo()
Get Information Text.
setTitle($a_title)
Set Title.
setInfo($a_info)
Set Information Text.
setRequired($a_required)
Set Required.
Class ilObjDataCollection.
This class represents a property form user interface.
This class represents an option in a radio group.
Class ilTable2GUI.
global $ilCtrl
Definition: ilias.php:18
global $DIC