ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclFormulaFieldRepresentation.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
26{
27 public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilTextInputGUI
28 {
29 $input = new ilTextInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
30 $input->setDisabled(true);
31 $input->setValue('-');
32 $input->setInfo($this->getField()->getDescription() . '<br>' . $this->lng->txt('dcl_formula_detail_desc'));
33
34 return $input;
35 }
36
37 protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mode = 'create'): ilRadioOption
38 {
39 $opt = parent::buildFieldCreationInput($dcl, $mode);
40
41 $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
42 $table = ilDclCache::getTableCache($table_id);
43 $fields = [];
44 foreach ($table->getFieldsForFormula() as $f) {
45 $placeholder = ($f->isStandardField()) ? $f->getId() : $f->getTitle();
46 $fields[] = '<a class="dclPropExpressionField" data-placeholder="' . $placeholder . '">' . $f->getTitle() . '</a>';
47 }
48 $subitem = new ilTextAreaInputGUI(
49 $this->lng->txt('dcl_prop_expression'),
51 );
52 $operators = implode(', ', array_map(
53 static fn(Operators $operator): string => $operator->value,
54 Tokenizer::$operators
55 ));
56 $functions = implode(', ', array_map(
57 static fn(Functions $function): string => $function->value,
58 Tokenizer::$functions
59 ));
60 $subitem->setInfo(sprintf(
61 $this->lng->txt('dcl_prop_expression_info'),
62 $operators,
63 $functions,
64 implode('<br>', $fields)
65 ));
66 $opt->addSubItem($subitem);
67
68 return $opt;
69 }
70}
static getTableCache(?int $table_id=null)
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
Build the creation-input-field.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
Returns field-input.
This class represents a property form user interface.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static http()
Fetches the global http state from ILIAS.