19 declare(strict_types=1);
36 $input->setWidth(100);
37 $input->setWidthUnit(
'%');
47 $options[
""] = $this->
lng->txt(
'dcl_please_select');
50 foreach ($reftable->getRecords() as $record) {
51 $record_field = $record->getRecordField($fieldref);
52 switch ($reffield->getDatatypeId()) {
54 if ($record_field->getValue()) {
55 $file_obj =
new ilObjFile($record_field->getValue(),
false);
56 $options[$record->getId()] = $file_obj->
getFileName();
61 $options[$record->getId()] = $media_obj->
getTitle();
64 $options[$record->getId()] = strtotime($record->getRecordFieldSingleHTML($fieldref));
65 $options2[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
68 $value = $record_field->getValue();
70 if (!is_array($value)) {
71 $value = [
'title' =>
'',
'link' => $value];
73 $value = $value[
'title'] ?: $value[
'link'];
75 $options[$record->getId()] = $value;
78 $value = $record_field->getValue();
82 $options[$record->getId()] = $record_field->getExportValue();
86 asort($options, SORT_NATURAL | SORT_FLAG_CASE);
90 foreach ($options as $key => $opt) {
91 if ($key !=
"" && isset($options2) && is_array($options2)) {
92 $options[$key] = $options2[$key];
97 $options = [
"" => $this->
lng->txt(
'dcl_please_select')] + $options;
100 $input->setOptions($options);
102 $input->setHeight(32 * min(5, max(1, count($options))));
106 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
109 $input->addCustomAttribute(
'data-ref="1"');
110 $input->addCustomAttribute(
'data-ref-table-id="' . $reftable->getId() .
'"');
111 $input->addCustomAttribute(
'data-ref-field-id="' . $reffield->getId() .
'"');
132 foreach ($ref_table->getRecords() as $record) {
133 $options[$record->getId()] = $record->getRecordField($ref_field_id)->getPlainText();
137 $options = [
'' => $this->
lng->txt(
'dcl_all_entries')]
139 + [
'none' => $this->
lng->txt(
'dcl_no_entry')];
140 $input->setOptions($options);
161 if (!$filter || $filter == $value) {
170 $opt = parent::buildFieldCreationInput($dcl, $mode);
175 foreach ($tables as $table) {
176 foreach ($table->getRecordFields() as
$field) {
184 $this->
lng->txt(
'dcl_reference_title'),
188 $prop_table_selection->setInfo($this->
lng->txt(
'dcl_reference_title_desc'));
190 $opt->addSubItem($prop_table_selection);
193 $this->
lng->txt(
'dcl_reference_link'),
196 $prop_ref_link->
setInfo($this->
lng->txt(
'dcl_reference_link_info'));
197 $opt->addSubItem($prop_ref_link);
200 $this->
lng->txt(
'dcl_multiple_selection'),
This class represents an option in a radio group.
const PROP_REFERENCE_LINK
ilDclBaseFieldModel $field
const REFERENCE_SEPARATOR
addFilterInputFieldToTable(ilTable2GUI $table)
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
static getFieldCache(int $field_id=0)
getRecordFieldValue(?string $field_id)
Get Field Value.
getFilterInputFieldValue(ilTableFilterItem $input)
passThroughFilter(ilDclBaseRecordModel $record, $filter)
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
static http()
Fetches the global http state from ILIAS.
static _lookupTitle(int $obj_id)
static _lookupObjectId(int $ref_id)
static getTableCache(?int $table_id=null)
const INPUTFORMAT_ILIAS_REF
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
const INPUTFORMAT_REFERENCE
getField()
Return BaseFieldModel.
const INPUTFORMAT_FILEUPLOAD
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
static hasPermissionToAddRecord(int $ref_id, int $table_id)
getDatatypeId()
Get datatype_id.