ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclFormulaRecordFieldModel.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23
25{
26 protected string $expression = '';
27 protected string $parsed_value = '';
28
30 {
32
33 $this->expression = (string) $this->getField()->getProperty(ilDclBaseFieldModel::PROP_FORMULA_EXPRESSION);
34 }
35
36 public function addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation): void
37 {
38 }
39
43 protected function loadValue(): void
44 {
45 }
46
52 public function setValue($value, bool $omit_parsing = false): void
53 {
54 unset($value);
55 }
56
60 public function doUpdate(): void
61 {
62 }
63
67 protected function doRead(): void
68 {
69 }
70
74 public function delete(): void
75 {
76 }
77
78 public function getFormInput(): string
79 {
80 return $this->parse();
81 }
82
83 public function getHTML(): string
84 {
85 return $this->parse();
86 }
87
88 public function getExportValue(): string
89 {
90 return $this->parse();
91 }
92
93 public function getValue(): string
94 {
95 return $this->parse();
96 }
97
101 protected function parse(): string
102 {
103 if (!$this->parsed_value && $this->expression) {
104 $substitution = new FieldSubstitution(
105 $this->getRecord(),
106 $this->getField()
107 );
108
109 $parser = new ExpressionParser(
110 $this->expression,
111 $substitution
112 );
113
114
115 //$parser = new ilDclExpressionParser($this->expression, $this->getRecord(), $this->getField());
116 try {
117 $this->parsed_value = $parser->parse();
118 } catch (ilException $e) {
119 return $this->lng->txt('dcl_error_parsing_expression') . ' (' . $e->getMessage() . ')';
120 }
121 }
122
123 return $this->parsed_value;
124 }
125}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHiddenItemsToConfirmation(ilConfirmationGUI $confirmation)
doRead()
Do nothing, value is runtime only and not stored in DB.
setValue($value, bool $omit_parsing=false)
Set value for record field.
__construct(ilDclBaseRecordModel $record, ilDclBaseFieldModel $field)
loadValue()
Do nothing, value is runtime only and not stored in DB.
doUpdate()
Do nothing, value is runtime only and not stored in DB.
Base class for ILIAS Exception handling.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc