ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilAssQuestionSkillAssignmentPropertyFormGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 private $parentGUI;
15 private $question = null;
17 private $assignment = null;
19 private $manipulationEnabled = false;
21 private $uiFactory;
23 private $uiRenderer;
24
25 public function __construct(
31 ) {
32 global $DIC;
33
34 $this->pageTemplate = $pageTemplate;
35 $this->ctrl = $ctrl;
36 $this->lng = $lng;
37 $this->parentGUI = $parentGUI;
38 $this->uiFactory = $DIC->ui()->factory();
39 $this->uiRenderer = $DIC->ui()->renderer();
40
42 }
43
47 public function getQuestion()
48 {
49 return $this->question;
50 }
51
55 public function setQuestion($question)
56 {
57 $this->question = $question;
58 }
59
63 public function getAssignment()
64 {
65 return $this->assignment;
66 }
67
71 public function setAssignment($assignment)
72 {
73 $this->assignment = $assignment;
74 }
75
79 public function isManipulationEnabled()
80 {
82 }
83
88 {
89 $this->manipulationEnabled = $manipulationEnabled;
90 }
91
92 public function build()
93 {
94 $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
95
96 if ($this->isManipulationEnabled()) {
97 $this->addCommandButton(
99 $this->lng->txt('save')
100 );
101
102 $this->addCommandButton(
104 $this->lng->txt('cancel')
105 );
106 } else {
107 $this->addCommandButton(
109 $this->lng->txt('back')
110 );
111 }
112
113 $this->setTitle($this->assignment->getSkillTitle());
114
115 $questionTitle = new ilNonEditableValueGUI($this->lng->txt('question'));
116 $questionTitle->setValue($this->question->getTitle());
117 $this->addItem($questionTitle);
118
119 $questionDesc = new ilNonEditableValueGUI($this->lng->txt('description'));
120 $questionDesc->setValue($this->question->getComment());
121 $this->addItem($questionDesc);
122
123 if ($this->questionSupportsSolutionCompare()) {
124 $this->populateFullProperties();
125 } else {
127 }
128 }
129
130 private function populateFullProperties()
131 {
132 $evaluationMode = new ilRadioGroupInputGUI($this->lng->txt('condition'), 'eval_mode');
133 $evalOptionReachedQuestionPoints = new ilRadioOption(
134 $this->lng->txt('qpl_skill_point_eval_by_quest_result'),
135 'result'
136 );
137 $evaluationMode->addOption($evalOptionReachedQuestionPoints);
138 $evalOptionLogicalAnswerCompare = new ilRadioOption(
139 $this->lng->txt('qpl_skill_point_eval_by_solution_compare'),
140 'solution'
141 );
142 $evaluationMode->addOption($evalOptionLogicalAnswerCompare);
143 $evaluationMode->setRequired(true);
144 $evaluationMode->setValue($this->assignment->getEvalMode());
145 if (!$this->isManipulationEnabled()) {
146 $evaluationMode->setDisabled(true);
147 }
148 $this->addItem($evaluationMode);
149
150 $questSolutionCompareExpressions = new ilLogicalAnswerComparisonExpressionInputGUI(
151 $this->lng->txt('tst_solution_compare_cfg'),
152 'solution_compare_expressions'
153 );
154 $questSolutionCompareExpressions->setRequired(true);
155 $questSolutionCompareExpressions->setAllowMove($this->isManipulationEnabled());
156 $questSolutionCompareExpressions->setAllowAddRemove($this->isManipulationEnabled());
157 $questSolutionCompareExpressions->setQuestionObject($this->question);
158 $questSolutionCompareExpressions->setValues($this->assignment->getSolutionComparisonExpressionList()->get());
159 $questSolutionCompareExpressions->setMinvalueShouldBeGreater(false);
160
161 $questSolutionCompareExpressions->setMinValue(1);
162 if ($this->isManipulationEnabled()) {
163 if ($this->getQuestion() instanceof iQuestionCondition) {
164 // #19192
165 $legendGUI = new ilAssLacLegendGUI($this->pageTemplate, $this->lng, $this->uiFactory);
166 $legendGUI->setQuestionOBJ($this->getQuestion());
167 $legenModal = $legendGUI->get();
168
169 $legendToggleButton = $this->uiFactory
170 ->button()
171 ->shy($this->lng->txt('ass_lac_show_legend_btn'), '#')
172 ->withOnClick($legenModal->getShowSignal());
173
174 $questSolutionCompareExpressions->setInfo($this->uiRenderer->render([
175 $legendToggleButton,
176 $legenModal
177 ]));
178 }
179 } else {
180 $questSolutionCompareExpressions->setDisabled(true);
181 }
182 $evalOptionLogicalAnswerCompare->addSubItem($questSolutionCompareExpressions);
183
184 $questResultSkillPoints = $this->buildResultSkillPointsInputField();
185 $evalOptionReachedQuestionPoints->addSubItem($questResultSkillPoints);
186 }
187
188 private function populateLimitedProperties()
189 {
190 $evaluationMode = new ilNonEditableValueGUI($this->lng->txt('condition'));
191 $evaluationMode->setValue($this->lng->txt('qpl_skill_point_eval_by_quest_result'));
192 $this->addItem($evaluationMode);
193
194 $questResultSkillPoints = $this->buildResultSkillPointsInputField();
195 $evaluationMode->addSubItem($questResultSkillPoints);
196 }
197
199 {
200 $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points');
201 $questResultSkillPoints->setRequired(true);
202 $questResultSkillPoints->setSize(4);
203 $questResultSkillPoints->setMinvalueShouldBeGreater(false);
204 $questResultSkillPoints->setMinValue(1);
205 $questResultSkillPoints->allowDecimals(false);
206 $questResultSkillPoints->setValue($this->assignment->getSkillPoints());
207 if (!$this->isManipulationEnabled()) {
208 $questResultSkillPoints->setDisabled(true);
209 }
210
211 return $questResultSkillPoints;
212 }
213
215 {
216 return (
217 $this->question instanceof iQuestionCondition
218 );
219 }
220}
An exception for terminatinating execution or to throw for unit testing.
__construct(ilGlobalTemplateInterface $pageTemplate, ilCtrl $ctrl, ilLanguage $lng, ilAssQuestionSkillAssignmentsGUI $parentGUI)
This class provides processing control methods.
setFormAction($a_formaction)
Set FormAction.
language handling
This class represents a non editable value in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setTitle($a_title)
Set Title.
This class represents a property in a property form.
This class represents an option in a radio group.
global $DIC
Definition: goto.php:24
Class iQuestionCondition.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc