ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
5 
6 require_once 'Modules/TestQuestionPool/classes/class.ilLogicalAnswerComparisonExpressionInputGUI.php';
7 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSolutionComparisonExpressionList.php';
8 
9 require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
10 require_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  $this->addCommandButton(
115  $this->lng->txt('save')
116  );
117 
118  $this->addCommandButton(
120  $this->lng->txt('cancel')
121  );
122  } else {
123  $this->addCommandButton(
125  $this->lng->txt('back')
126  );
127  }
128 
129  $this->setTitle($this->assignment->getSkillTitle());
130 
131  $questionTitle = new ilNonEditableValueGUI($this->lng->txt('question'));
132  $questionTitle->setValue($this->question->getTitle());
133  $this->addItem($questionTitle);
134 
135  $questionDesc = new ilNonEditableValueGUI($this->lng->txt('description'));
136  $questionDesc->setValue($this->question->getComment());
137  $this->addItem($questionDesc);
138 
139  if ($this->questionSupportsSolutionCompare()) {
140  $this->populateFullProperties();
141  } else {
142  $this->populateLimitedProperties();
143  }
144  }
145 
146  private function buildLacLegendToggleButton()
147  {
148  if ($this->assignment->hasEvalModeBySolution()) {
149  $langVar = 'ass_lac_hide_legend_btn';
150  } else {
151  $langVar = 'ass_lac_show_legend_btn';
152  }
153 
154  return '<a id="lac_legend_toggle_btn" href="#">' . $this->lng->txt($langVar) . '</a>';
155  }
156 
157  private function populateFullProperties()
158  {
159  $evaluationMode = new ilRadioGroupInputGUI($this->lng->txt('condition'), 'eval_mode');
160  $evalOptionReachedQuestionPoints = new ilRadioOption(
161  $this->lng->txt('qpl_skill_point_eval_by_quest_result'),
162  'result'
163  );
164  $evaluationMode->addOption($evalOptionReachedQuestionPoints);
165  $evalOptionLogicalAnswerCompare = new ilRadioOption(
166  $this->lng->txt('qpl_skill_point_eval_by_solution_compare'),
167  'solution'
168  );
169  $evaluationMode->addOption($evalOptionLogicalAnswerCompare);
170  $evaluationMode->setRequired(true);
171  $evaluationMode->setValue($this->assignment->getEvalMode());
172  if (!$this->isManipulationEnabled()) {
173  $evaluationMode->setDisabled(true);
174  }
175  $this->addItem($evaluationMode);
176 
177  $questSolutionCompareExpressions = new ilLogicalAnswerComparisonExpressionInputGUI(
178  $this->lng->txt('tst_solution_compare_cfg'),
179  'solution_compare_expressions'
180  );
181  $questSolutionCompareExpressions->setRequired(true);
182  $questSolutionCompareExpressions->setAllowMove($this->isManipulationEnabled());
183  $questSolutionCompareExpressions->setAllowAddRemove($this->isManipulationEnabled());
184  $questSolutionCompareExpressions->setQuestionObject($this->question);
185  $questSolutionCompareExpressions->setValues($this->assignment->getSolutionComparisonExpressionList()->get());
186  $questSolutionCompareExpressions->setMinvalueShouldBeGreater(false);
187  $questSolutionCompareExpressions->setMinValue(1);
188  if (!$this->isManipulationEnabled()) {
189  $questSolutionCompareExpressions->setDisabled(true);
190  } else {
191  // #19192
192  $questSolutionCompareExpressions->setInfo($this->buildLacLegendToggleButton());
193  }
194  $evalOptionLogicalAnswerCompare->addSubItem($questSolutionCompareExpressions);
195 
196  $questResultSkillPoints = $this->buildResultSkillPointsInputField();
197  $evalOptionReachedQuestionPoints->addSubItem($questResultSkillPoints);
198  }
199 
200  private function populateLimitedProperties()
201  {
202  $evaluationMode = new ilNonEditableValueGUI($this->lng->txt('condition'));
203  $evaluationMode->setValue($this->lng->txt('qpl_skill_point_eval_by_quest_result'));
204  $this->addItem($evaluationMode);
205 
206  $questResultSkillPoints = $this->buildResultSkillPointsInputField();
207  $evaluationMode->addSubItem($questResultSkillPoints);
208  }
209 
211  {
212  $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points');
213  $questResultSkillPoints->setRequired(true);
214  $questResultSkillPoints->setSize(4);
215  $questResultSkillPoints->setMinvalueShouldBeGreater(false);
216  $questResultSkillPoints->setMinValue(1);
217  $questResultSkillPoints->allowDecimals(false);
218  $questResultSkillPoints->setValue($this->assignment->getSkillPoints());
219  if (!$this->isManipulationEnabled()) {
220  $questResultSkillPoints->setDisabled(true);
221  }
222 
223  return $questResultSkillPoints;
224  }
225 
227  {
228  return (
229  $this->question instanceof iQuestionCondition
230  );
231  }
232 }
This class represents an option in a radio group.
This class provides processing control methods.
Class iQuestionCondition.
This class represents a property form user interface.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
setValue($a_value)
Set Value.
setTitle($a_title)
Set Title.
This class represents a number property in a property form.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
This class represents a non editable value in a property form.
__construct(ilCtrl $ctrl, ilLanguage $lng, ilAssQuestionSkillAssignmentsGUI $parentGUI)
language handling
setRequired($a_required)
Set Required.