ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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;
16  protected $lng;
20  protected $ctrl;
21 
22 
24  {
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 
41  public function addFilterInputFieldToTable(ilTable2GUI $table)
42  {
43  return null;
44  }
45 
46 
52  protected function setupFilterInputField(ilFormPropertyGUI $input)
53  {
54  if ($input != null) {
55  $input->setTitle($this->getField()->getTitle());
56  }
57  }
58 
59 
68  public function passThroughFilter(ilDclBaseRecordModel $record, $filter)
69  {
70  $value = $record->getRecordFieldValue($this->getField()->getId());
71  $pass = true;
72 
73  if (($this->getField()->getId() == "owner" || $this->getField()->getId() == "last_edit_by") && $filter) {
74  $pass = false;
75  $user = new ilObjUser($value);
76  if (strpos($user->getFullname(), $filter) !== false) {
77  $pass = true;
78  }
79  }
80 
81  return $pass;
82  }
83 
84 
92  public function parseSortingValue($value, $link = true)
93  {
94  return $value;
95  }
96 
97 
106  public function getInputField(ilPropertyFormGUI $form, $record_id = 0)
107  {
108  return null;
109  }
110 
111 
119  {
120  $input->setInfo($field->getDescription() . ($input->getInfo() ? '<br>' . $input->getInfo() : ''));
121  }
122 
123 
129  protected function getFilterInputFieldValue(/*ilPropertyFormGUI*/
130  $input
131  ) {
132  $value = $input->getValue();
133  if (is_array($value)) {
134  if ($value['from'] || $value['to']) {
135  return $value;
136  }
137  } else {
138  if ($value != '') {
139  return $value;
140  }
141  }
142 
143  return null;
144  }
145 
146 
154  public function addFieldCreationForm($form, ilObjDataCollection $dcl, $mode = "create")
155  {
156  $opt = $this->buildFieldCreationInput($dcl, $mode);
157 
158  if ($mode != 'create' && $this->getField()->getDatatypeId() == ilDclDatatype::INPUTFORMAT_PLUGIN) {
159  $new_plugin_title = $opt->getTitle();
161  if ($plugin_name !== "DclBase") {
162  $new_plugin_title .= ': ' . $plugin_name;
163  }
164  $opt->setTitle($new_plugin_title);
165  }
166 
167  $form->addOption($opt);
168  }
169 
170 
179  protected function buildFieldCreationInput(ilObjDataCollection $dcl, $mode = 'create')
180  {
181  $opt = new ilRadioOption($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()), $this->getField()->getDatatypeId());
182  $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle() . '_desc'));
183 
184  return $opt;
185  }
186 
187 
195  public function getPropertyInputFieldId($property)
196  {
197  return "prop_" . $property;
198  }
199 
200 
206  public function getField()
207  {
208  return $this->field;
209  }
210 }
This class represents an option in a radio group.
Class ilDclBaseFieldModel.
This class represents a property form user interface.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Checks if a filter affects a record.
addFieldCreationForm($form, ilObjDataCollection $dcl, $mode="create")
Adds the options for the field-types to the field-creation form.
getPropertyInputFieldId($property)
Return post-var for property-fields.
setInfo($a_info)
Set Info.
buildFieldCreationInput(ilObjDataCollection $dcl, $mode='create')
Build the creation-input-field.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
setInfo($a_info)
Set Information Text.
setTitle($a_title)
Set Title.
global $DIC
Definition: goto.php:24
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
addFilterInputFieldToTable(ilTable2GUI $table)
Add filter input to TableGUI.
getDescription()
Get description.
getInputField(ilPropertyFormGUI $form, $record_id=0)
Returns field-input.
Class ilDclBaseRecordModel.
This class represents a property in a property form.
getRecordFieldValue($field_id)
Get Field Value.
getInfo()
Get Information Text.
Class ilDclBaseFieldRepresentation.
static getPluginNameFromFieldModel(ilDclBaseFieldModel $object)
Get plugin-name from FieldModel.
Class ilObjDataCollection.