ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLogicalAnswerComparisonExpressionInputGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 public function setValues($model_values): void
28 {
29 $form_values = [];
30 foreach ($model_values as $model_value) {
31 $form_values[] = new ASS_AnswerSimple(
32 $model_value->getExpression(),
33 $model_value->getPoints(),
34 $model_value->getOrderIndex() - 1,
35 -1,
36 0
37 );
38 }
39
40 if ($form_values === []) {
41 $form_values[] = new ASS_AnswerSimple('', 0, 1);
42 }
43
44 parent::setValues($form_values);
45 }
46
47 public function getValues(): array
48 {
49 $form_values = parent::getValues();
50
51 $model_values = [];
52 foreach ($form_values as $form_value) {
54 $expression->setExpression($form_value->getAnswertext());
55 $expression->setPoints($form_value->getPoints());
56 $expression->setOrderIndex($form_value->getOrder() + 1);
57 $model_values[] = $expression;
58 }
59
60 return $model_values;
61 }
62
67 protected function getTextInputLabel($lng)
68 {
69 return $lng->txt('tst_sol_comp_expressions');
70 }
71
76 protected function getPointsInputLabel($lng)
77 {
78 return $lng->txt('tst_comp_points');
79 }
80
84 protected function getTemplate(): string
85 {
86 return 'tpl.prop_lac_expression_input.html';
87 }
88
89 public function getInput(): array
90 {
91 if (!$this->isRequestParamArray($this->getPostVar())) {
92 return [];
93 }
94 return $this->getRequestParam(
95 $this->getPostVar(),
96 $this->refinery->kindlyTo()->dictOf(
97 $this->refinery->kindlyTo()->dictOf(
98 $this->refinery->byTrying([
99 $this->refinery->kindlyTo()->float(),
100 $this->refinery->kindlyTo()->string()
101 ])
102 )
103 )
104 );
105 }
106}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a single choice wizard property in a property form.
getRequestParam(string $key, Refinery\Transformation $t)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...