ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestSkillEvaluationGUI.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 'Modules/Test/classes/toolbars/class.ilTestSkillEvaluationToolbarGUI.php';
5 require_once 'Modules/Test/classes/class.ilTestPersonalSkillsGUI.php';
6 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
7 
18 {
20 
21  const CMD_SHOW = 'show';
25  private $ctrl;
26 
30  private $tabs;
31 
35  private $tpl;
36 
40  private $lng;
41 
45  private $db;
46 
50  protected $testOBJ;
51 
55  private $testSession;
56 
61 
65  private $questionList;
66 
67  protected $noSkillProfileOptionEnabled = false;
69  protected $availableSkills = array();
70 
74  protected $testPassesSelector = null;
75 
77  {
78  $this->ctrl = $ctrl;
79  $this->tabs = $tabs;
80  $this->tpl = $tpl;
81  $this->lng = $lng;
82  $this->db = $db;
83  $this->testOBJ = $testOBJ;
84  }
85 
89  public function getQuestionList()
90  {
91  return $this->questionList;
92  }
93 
97  public function setQuestionList($questionList)
98  {
99  $this->questionList = $questionList;
100  }
101 
106  {
108  }
109 
114  {
115  $this->objectiveOrientedContainer = $objectiveOrientedContainer;
116  }
117 
118  public function executeCommand()
119  {
120  $cmd = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
121 
122  $this->manageTabs($cmd);
123 
124  $this->$cmd();
125  }
126 
127  private function isAccessDenied()
128  {
129  return false;
130  }
131 
132  private function manageTabs($cmd)
133  {
134  $this->tabs->clearTargets();
135 
136  $this->tabs->setBackTarget(
137  $this->lng->txt('tst_results_back_introduction'),
138  $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'infoScreen')
139  );
140 
141  if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
142  require_once 'Services/Link/classes/class.ilLink.php';
143  $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
144  $this->tabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
145  }
146  }
147 
148  protected function init($skillProfileEnabled)
149  {
150  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
151  $this->testPassesSelector = new ilTestPassesSelector($this->db, $this->testOBJ);
152  $this->testPassesSelector->setActiveId($this->testSession->getActiveId());
153  $this->testPassesSelector->setLastFinishedPass($this->testSession->getLastFinishedPass());
154 
155  $assSettings = new ilSetting('assessment');
156  require_once 'Modules/Test/classes/class.ilTestSkillEvaluation.php';
157  $skillEvaluation = new ilTestSkillEvaluation(
158  $this->db,
159  $this->testOBJ->getTestId(),
160  $this->testOBJ->getRefId()
161  );
162 
163  $skillEvaluation->setUserId($this->getTestSession()->getUserId());
164  $skillEvaluation->setActiveId($this->getTestSession()->getActiveId());
165 
166  $skillEvaluation->setNumRequiredBookingsForSkillTriggering($assSettings->get(
167  'ass_skl_trig_num_answ_barrier',
169  ));
170 
171  $skillEvaluation->init($this->getQuestionList());
172 
173  $availableSkillProfiles = $skillEvaluation->getAssignedSkillMatchingSkillProfiles();
175  $skillEvaluation->noProfileMatchingAssignedSkillExists($availableSkillProfiles)
176  );
178 
179  // should be reportedPasses - yes - indeed, skill level status will not respect - avoid confuse here
180  $evaluationPasses = $this->testPassesSelector->getExistingPasses();
181 
183 
184  foreach ($evaluationPasses as $evalPass) {
185  $testResults = $this->testOBJ->getTestResult($this->getTestSession()->getActiveId(), $evalPass, true);
186 
187  $skillEvaluation->setPass($evalPass);
188  $skillEvaluation->evaluate($testResults);
189 
190  if ($skillProfileEnabled && self::INVOLVE_SKILLS_BELOW_NUM_ANSWERS_BARRIER_FOR_GAP_ANALASYS) {
191  $skills = $skillEvaluation->getSkillsInvolvedByAssignment();
192  } else {
193  $skills = $skillEvaluation->getSkillsMatchingNumAnswersBarrier();
194  }
195 
196  $availableSkills = array_merge($availableSkills, $skills);
197  }
198 
199  $this->setAvailableSkills(array_values($availableSkills));
200  }
201 
202  private function showCmd()
203  {
204  //ilUtil::sendInfo($this->lng->txt('tst_skl_res_interpretation_hint_msg'));
205 
207 
208  $this->init($selectedSkillProfile);
209 
210  $evaluationToolbarGUI = $this->buildEvaluationToolbarGUI($selectedSkillProfile);
211 
212  $personalSkillsGUI = $this->buildPersonalSkillsGUI(
213  $this->getTestSession()->getUserId(),
214  $evaluationToolbarGUI->getSelectedEvaluationMode(),
215  $this->getAvailableSkills()
216  );
217 
218  $this->tpl->setContent(
219  $this->ctrl->getHTML($evaluationToolbarGUI) . $this->ctrl->getHTML($personalSkillsGUI)
220  );
221  }
222 
223  private function buildEvaluationToolbarGUI($selectedSkillProfileId)
224  {
225  if (!$this->isNoSkillProfileOptionEnabled() && !$selectedSkillProfileId) {
226  $selectedSkillProfileId = key($this->getAvailableSkillProfiles());
227  }
228 
229  $gui = new ilTestSkillEvaluationToolbarGUI($this->ctrl, $this->lng, $this, self::CMD_SHOW);
230 
231  $gui->setAvailableSkillProfiles($this->getAvailableSkillProfiles());
232  $gui->setNoSkillProfileOptionEnabled($this->isNoSkillProfileOptionEnabled());
233  $gui->setSelectedEvaluationMode($selectedSkillProfileId);
234 
235  $gui->setTestResultButtonEnabled($this->isTestResultButtonRequired());
236 
237  $gui->build();
238 
239  return $gui;
240  }
241 
242  private function isTestResultButtonRequired()
243  {
244  if (!$this->testOBJ->canShowTestResults($this->testSession)) {
245  return false;
246  }
247 
248  if (!count($this->testPassesSelector->getReportablePasses())) {
249  return false;
250  }
251 
252  return true;
253  }
254 
255  private function buildPersonalSkillsGUI($usrId, $selectedSkillProfileId, $availableSkills)
256  {
257  $gui = new ilTestPersonalSkillsGUI($this->lng, $this->testOBJ->getId());
258 
260  $gui->setSelectedSkillProfile($selectedSkillProfileId);
261 
262  $gui->setReachedSkillLevels($reachedSkillLevels);
263  $gui->setUsrId($usrId);
264 
265  return $gui;
266  }
267 
271  public function setTestSession($testSession)
272  {
273  $this->testSession = $testSession;
274  }
275 
279  public function getTestSession()
280  {
281  return $this->testSession;
282  }
283 
288  {
290  }
291 
296  {
297  $this->noSkillProfileOptionEnabled = $noSkillProfileOptionEnabled;
298  }
299 
303  public function getAvailableSkillProfiles()
304  {
306  }
307 
312  {
313  $this->availableSkillProfiles = $availableSkillProfiles;
314  }
315 
319  public function getAvailableSkills()
320  {
321  return $this->availableSkills;
322  }
323 
328  {
329  $this->availableSkills = $availableSkills;
330  }
331 }
This class provides processing control methods.
Tabs GUI.
__construct(ilCtrl $ctrl, ilTabsGUI $tabs, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db, ilObjTest $testOBJ)
buildEvaluationToolbarGUI($selectedSkillProfileId)
setObjectiveOrientedContainer($objectiveOrientedContainer)
Interface ilDBInterface.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
buildPersonalSkillsGUI($usrId, $selectedSkillProfileId, $availableSkills)
setAvailableSkillProfiles($availableSkillProfiles)
setNoSkillProfileOptionEnabled($noSkillProfileOptionEnabled)
language handling
$_POST["username"]