ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDclFormulaFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 }
This class represents an option in a radio group.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
static http()
Fetches the global http state from ILIAS.
static getTableCache(?int $table_id=null)
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
This class represents a text area property in a property form.