ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilDclBaseFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24  protected ilLanguage $lng;
25  protected ilCtrl $ctrl;
26  protected ilObjUser $user;
29 
32 
33  public function __construct(ilDclBaseFieldModel $field)
34  {
35  global $DIC;
36 
37  $this->field = $field;
38  $this->lng = $DIC->language();
39  $this->ctrl = $DIC->ctrl();
40  $this->http = $DIC->http();
41  $this->user = $DIC->user();
42  $this->refinery = $DIC->refinery();
43  $this->component_repository = $DIC["component.repository"];
44  $this->component_factory = $DIC["component.factory"];
45  }
46 
52  public function addFilterInputFieldToTable(ilTable2GUI $table)
53  {
54  return null;
55  }
56 
60  protected function setupFilterInputField(?ilTableFilterItem $input): void
61  {
62  if ($input != null) {
63  $input->setTitle($this->getField()->getTitle());
64  }
65  }
66 
71  public function passThroughFilter(ilDclBaseRecordModel $record, $filter): bool
72  {
73  $value = $record->getRecordFieldValue($this->getField()->getId());
74  $pass = true;
75 
76  if (($this->getField()->getId() == "owner" || $this->getField()->getId() == "last_edit_by") && $filter) {
77  $pass = false;
78  $user = new ilObjUser($value);
79  if (strpos($user->getFullname(), $filter) !== false) {
80  $pass = true;
81  }
82  }
83 
84  return $pass;
85  }
86 
87  public function parseSortingValue(string $value, bool $link = true): mixed
88  {
89  return $value;
90  }
91 
95  public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ?ilFormPropertyGUI
96  {
97  return null;
98  }
99 
105  protected function setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field): void
106  {
107  $input->setInfo($field->getDescription() . ($input->getInfo() ? '<br>' . $input->getInfo() : ''));
108  }
109 
113  protected function getFilterInputFieldValue(
114  ilTableFilterItem $input
115  ) {
116  $value = $input->getValue();
117  if (is_array($value)) {
118  if ($value['from'] || $value['to']) {
119  return $value;
120  }
121  } else {
122  if ($value != '') {
123  return $value;
124  }
125  }
126 
127  return null;
128  }
129 
133  public function addFieldCreationForm(
135  ilObjDataCollection $dcl,
136  string $mode = "create"
137  ): void {
138  $opt = $this->buildFieldCreationInput($dcl, $mode);
139  if ($opt !== null) {
140  $form->addOption($opt);
141  }
142  }
143 
147  protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mode = 'create'): ?ilRadioOption
148  {
149  $opt = null;
150  if ($this->getField()->getDatatypeId() !== null) {
151  $title = $this->field->getPresentationTitle();
152  $info = $this->field->getPresentationDescription();
153  $opt = new ilRadioOption($title, (string) $this->getField()->getDatatypeId());
154  $opt->setInfo($info);
155  }
156 
157  return $opt;
158  }
159 
163  public function getPropertyInputFieldId(string $property): string
164  {
165  return "prop_" . $property;
166  }
167 
171  public function getField(): ilDclBaseFieldModel
172  {
173  return $this->field;
174  }
175 }
This class represents an option in a radio group.
Readable part of repository interface to ilComponentDataDB.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Checks if a filter affects a record.
parseSortingValue(string $value, bool $link=true)
getRecordFieldValue(?string $field_id)
Get Field Value.
getFullname(int $a_max_strlen=0)
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
Returns field-input.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
getPropertyInputFieldId(string $property)
Return post-var for property-fields.
global $DIC
Definition: shib_login.php:26
addFieldCreationForm(ilSubEnabledFormPropertyGUI $form, ilObjDataCollection $dcl, string $mode="create")
Adds the options for the field-types to the field-creation form.
addFilterInputFieldToTable(ilTable2GUI $table)
Add filter input to TableGUI.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
Build the creation-input-field.
getDescription()
Get description.
This class represents a property that may include a sub form.
$info
Definition: entry_point.php:21