ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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;
68  protected $availableSkillProfiles = array();
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 # {
143 # require_once 'Services/Link/classes/class.ilLink.php';
144 # $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
145 # $this->tabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
146 # }
147  }
148 
149  protected function init($skillProfileEnabled)
150  {
151  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
152  $this->testPassesSelector = new ilTestPassesSelector($this->db, $this->testOBJ);
153  $this->testPassesSelector->setActiveId($this->testSession->getActiveId());
154  $this->testPassesSelector->setLastFinishedPass($this->testSession->getLastFinishedPass());
155 
156  $assSettings = new ilSetting('assessment');
157  require_once 'Modules/Test/classes/class.ilTestSkillEvaluation.php';
158  $skillEvaluation = new ilTestSkillEvaluation(
159  $this->db,
160  $this->testOBJ->getTestId(),
161  $this->testOBJ->getRefId()
162  );
163 
164  $skillEvaluation->setUserId($this->getTestSession()->getUserId());
165  $skillEvaluation->setActiveId($this->getTestSession()->getActiveId());
166 
167  $skillEvaluation->setNumRequiredBookingsForSkillTriggering($assSettings->get(
168  'ass_skl_trig_num_answ_barrier',
170  ));
171 
172  $skillEvaluation->init($this->getQuestionList());
173 
174  $availableSkillProfiles = $skillEvaluation->getAssignedSkillMatchingSkillProfiles();
176  $skillEvaluation->noProfileMatchingAssignedSkillExists($availableSkillProfiles)
177  );
179 
180  // should be reportedPasses - yes - indeed, skill level status will not respect - avoid confuse here
181  $evaluationPasses = $this->testPassesSelector->getExistingPasses();
182 
183  $availableSkills = array();
184 
185  foreach ($evaluationPasses as $evalPass) {
186  $testResults = $this->testOBJ->getTestResult($this->getTestSession()->getActiveId(), $evalPass, true);
187 
188  $skillEvaluation->setPass($evalPass);
189  $skillEvaluation->evaluate($testResults);
190 
191  if ($skillProfileEnabled && self::INVOLVE_SKILLS_BELOW_NUM_ANSWERS_BARRIER_FOR_GAP_ANALASYS) {
192  $skills = $skillEvaluation->getSkillsInvolvedByAssignment();
193  } else {
194  $skills = $skillEvaluation->getSkillsMatchingNumAnswersBarrier();
195  }
196 
197  $availableSkills = array_merge($availableSkills, $skills);
198  }
199 
200  $this->setAvailableSkills(array_values($availableSkills));
201  }
202 
203  private function showCmd()
204  {
205  //ilUtil::sendInfo($this->lng->txt('tst_skl_res_interpretation_hint_msg'));
206 
208 
209  $this->init($selectedSkillProfile);
210 
211  $evaluationToolbarGUI = $this->buildEvaluationToolbarGUI($selectedSkillProfile);
212 
213  $personalSkillsGUI = $this->buildPersonalSkillsGUI(
214  $this->getTestSession()->getUserId(),
215  $evaluationToolbarGUI->getSelectedEvaluationMode(),
216  $this->getAvailableSkills()
217  );
218 
219  $this->tpl->setContent(
220  $this->ctrl->getHTML($evaluationToolbarGUI) . $this->ctrl->getHTML($personalSkillsGUI)
221  );
222  }
223 
224  private function buildEvaluationToolbarGUI($selectedSkillProfileId)
225  {
226  if (!$this->isNoSkillProfileOptionEnabled() && !$selectedSkillProfileId) {
227  $selectedSkillProfileId = key($this->getAvailableSkillProfiles());
228  }
229 
230  $gui = new ilTestSkillEvaluationToolbarGUI($this->ctrl, $this->lng, $this, self::CMD_SHOW);
231 
232  $gui->setAvailableSkillProfiles($this->getAvailableSkillProfiles());
233  $gui->setNoSkillProfileOptionEnabled($this->isNoSkillProfileOptionEnabled());
234  $gui->setSelectedEvaluationMode($selectedSkillProfileId);
235 
236  $gui->build();
237 
238  return $gui;
239  }
240 
241  private function buildPersonalSkillsGUI($usrId, $selectedSkillProfileId, $availableSkills)
242  {
243  $gui = new ilTestPersonalSkillsGUI($this->lng, $this->testOBJ->getId());
244 
246  $gui->setSelectedSkillProfile($selectedSkillProfileId);
247 
248  $gui->setReachedSkillLevels($reachedSkillLevels);
249  $gui->setUsrId($usrId);
250 
251  return $gui;
252  }
253 
257  public function setTestSession($testSession)
258  {
259  $this->testSession = $testSession;
260  }
261 
265  public function getTestSession()
266  {
267  return $this->testSession;
268  }
269 
274  {
276  }
277 
282  {
283  $this->noSkillProfileOptionEnabled = $noSkillProfileOptionEnabled;
284  }
285 
289  public function getAvailableSkillProfiles()
290  {
292  }
293 
298  {
299  $this->availableSkillProfiles = $availableSkillProfiles;
300  }
301 
305  public function getAvailableSkills()
306  {
307  return $this->availableSkills;
308  }
309 
314  {
315  $this->availableSkills = $availableSkills;
316  }
317 }
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)
special template class to simplify handling of ITX/PEAR
buildPersonalSkillsGUI($usrId, $selectedSkillProfileId, $availableSkills)
setAvailableSkillProfiles($availableSkillProfiles)
setNoSkillProfileOptionEnabled($noSkillProfileOptionEnabled)
language handling
$_POST["username"]