ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclBaseFieldRepresentation.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
24 protected ilLanguage $lng;
25 protected ilCtrl $ctrl;
26 protected ilObjUser $user;
29
32
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
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
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(
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}
Builds data types.
Definition: Factory.php:36
Class Services.
Definition: Services.php:38
Class ilCtrl provides processing control methods.
addFieldCreationForm(ilSubEnabledFormPropertyGUI $form, ilObjDataCollection $dcl, string $mode="create")
Adds the options for the field-types to the field-creation form.
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Checks if a filter affects a record.
parseSortingValue(string $value, bool $link=true)
getPropertyInputFieldId(string $property)
Return post-var for property-fields.
addFilterInputFieldToTable(ilTable2GUI $table)
Add filter input to TableGUI.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
Returns field-input.
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
Build the creation-input-field.
getRecordFieldValue(?string $field_id)
Get Field Value.
This class represents a property in a property form.
language handling
User class.
getFullname(int $max_strlen=0)
This class represents a property form user interface.
This class represents an option in a radio group.
This class represents a property that may include a sub form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$info
Definition: entry_point.php:21
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26