ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
5
6require_once 'Modules/TestQuestionPool/classes/class.ilLogicalAnswerComparisonExpressionInputGUI.php';
7require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSolutionComparisonExpressionList.php';
8
9require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
10require_once 'Services/Form/classes/class.ilRadioGroupInputGUI.php';
11
19{
23 protected $ctrl;
24
28 protected $lng;
29
33 protected $parentGUI;
34
38 private $question = null;
39
43 private $assignment = null;
44
48 private $manipulationEnabled = false;
49
50
52 {
53 $this->ctrl = $ctrl;
54 $this->lng = $lng;
55 $this->parentGUI = $parentGUI;
56
57 parent::__construct();
58 }
59
63 public function getQuestion()
64 {
65 return $this->question;
66 }
67
71 public function setQuestion($question)
72 {
73 $this->question = $question;
74 }
75
79 public function getAssignment()
80 {
81 return $this->assignment;
82 }
83
87 public function setAssignment($assignment)
88 {
89 $this->assignment = $assignment;
90 }
91
95 public function isManipulationEnabled()
96 {
98 }
99
104 {
105 $this->manipulationEnabled = $manipulationEnabled;
106 }
107
108 public function build()
109 {
110 $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
111
112 if( $this->isManipulationEnabled() )
113 {
114 $this->addCommandButton(
116 $this->lng->txt('save')
117 );
118
119 $this->addCommandButton(
121 $this->lng->txt('cancel')
122 );
123 }
124 else
125 {
126 $this->addCommandButton(
128 $this->lng->txt('back')
129 );
130 }
131
132 $this->setTitle($this->assignment->getSkillTitle());
133
134 $questionTitle = new ilNonEditableValueGUI($this->lng->txt('question'));
135 $questionTitle->setValue($this->question->getTitle());
136 $this->addItem($questionTitle);
137
138 $questionDesc = new ilNonEditableValueGUI($this->lng->txt('description'));
139 $questionDesc->setValue($this->question->getComment());
140 $this->addItem($questionDesc);
141
143 {
144 $this->populateFullProperties();
145 }
146 else
147 {
149 }
150
151
152 }
153
154 private function buildLacLegendToggleButton()
155 {
156 if( $this->assignment->hasEvalModeBySolution() )
157 {
158 $langVar = 'ass_lac_hide_legend_btn';
159 }
160 else
161 {
162 $langVar = 'ass_lac_show_legend_btn';
163 }
164
165 return '<a id="lac_legend_toggle_btn" href="#">'.$this->lng->txt($langVar).'</a>';
166 }
167
168 private function populateFullProperties()
169 {
170 $evaluationMode = new ilRadioGroupInputGUI($this->lng->txt('condition'), 'eval_mode');
171 $evalOptionReachedQuestionPoints = new ilRadioOption(
172 $this->lng->txt('qpl_skill_point_eval_by_quest_result'), 'result'
173 );
174 $evaluationMode->addOption($evalOptionReachedQuestionPoints);
175 $evalOptionLogicalAnswerCompare = new ilRadioOption(
176 $this->lng->txt('qpl_skill_point_eval_by_solution_compare'), 'solution'
177 );
178 $evaluationMode->addOption($evalOptionLogicalAnswerCompare);
179 $evaluationMode->setRequired(true);
180 $evaluationMode->setValue($this->assignment->getEvalMode());
181 if( !$this->isManipulationEnabled() )
182 {
183 $evaluationMode->setDisabled(true);
184 }
185 $this->addItem($evaluationMode);
186
187 $questSolutionCompareExpressions = new ilLogicalAnswerComparisonExpressionInputGUI(
188 $this->lng->txt('tst_solution_compare_cfg'), 'solution_compare_expressions'
189 );
190 $questSolutionCompareExpressions->setInfo($this->buildLacLegendToggleButton());
191 $questSolutionCompareExpressions->setRequired(true);
192 $questSolutionCompareExpressions->setAllowMove(true);
193 $questSolutionCompareExpressions->setQuestionObject($this->question);
194 $questSolutionCompareExpressions->setValues($this->assignment->getSolutionComparisonExpressionList()->get());
195 $questSolutionCompareExpressions->setMinvalueShouldBeGreater(false);
196 $questSolutionCompareExpressions->setMinValue(1);
197 if( !$this->isManipulationEnabled() )
198 {
199 $questSolutionCompareExpressions->setDisabled(true);
200 }
201 $evalOptionLogicalAnswerCompare->addSubItem($questSolutionCompareExpressions);
202
203 $questResultSkillPoints = $this->buildResultSkillPointsInputField();
204 $evalOptionReachedQuestionPoints->addSubItem($questResultSkillPoints);
205 }
206
207 private function populateLimitedProperties()
208 {
209 $evaluationMode = new ilNonEditableValueGUI($this->lng->txt('condition'));
210 $evaluationMode->setValue($this->lng->txt('qpl_skill_point_eval_by_quest_result'));
211 $this->addItem($evaluationMode);
212
213 $questResultSkillPoints = $this->buildResultSkillPointsInputField();
214 $evaluationMode->addSubItem($questResultSkillPoints);
215 }
216
218 {
219 $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points');
220 $questResultSkillPoints->setRequired(true);
221 $questResultSkillPoints->setSize(4);
222 $questResultSkillPoints->setMinvalueShouldBeGreater(false);
223 $questResultSkillPoints->setMinValue(1);
224 $questResultSkillPoints->allowDecimals(false);
225 $questResultSkillPoints->setValue($this->assignment->getSkillPoints());
226 if( !$this->isManipulationEnabled() )
227 {
228 $questResultSkillPoints->setDisabled(true);
229 }
230
231 return $questResultSkillPoints;
232 }
233
235 {
236 return (
237 $this->question instanceof iQuestionCondition
238 );
239 }
240}
__construct(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)
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.
Class iQuestionCondition.