ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
17 {
18  const CMD_SHOW = 'show';
22  private $ctrl;
23 
27  private $tabs;
28 
32  private $tpl;
33 
37  private $lng;
38 
42  private $db;
43 
47  private $testOBJ;
48 
53 
58 
60  {
61  $this->ctrl = $ctrl;
62  $this->tabs = $tabs;
63  $this->tpl = $tpl;
64  $this->lng = $lng;
65  $this->db = $db;
66  $this->testOBJ = $testOBJ;
67 
68  require_once 'Modules/Test/classes/class.ilTestSkillEvaluation.php';
69  $this->skillEvaluation = new ilTestSkillEvaluation($this->db, $this->testOBJ);
70 
71  require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
72  $this->testSessionFactory = new ilTestSessionFactory($this->testOBJ);
73  }
74 
75  public function executeCommand()
76  {
77  $cmd = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
78 
79  $this->manageTabs($cmd);
80 
81  $this->$cmd();
82  }
83 
84  private function isAccessDenied()
85  {
86  return false;
87  }
88 
89  private function manageTabs($cmd)
90  {
91  $this->tabs->clearTargets();
92 
93  $this->tabs->setBackTarget(
94  $this->lng->txt('tst_results_back_introduction'),
95  $this->ctrl->getLinkTargetByClass('ilObjTestGUI', 'infoScreen')
96  );
97  }
98 
99  private function showCmd()
100  {
102 
103  $testSession = $this->testSessionFactory->getSession();
104 
105  $this->skillEvaluation->init()->evaluate(
106  $testSession->getActiveId(), $testSession->getLastFinishedPass(), $testSession->getUserId()
107  );
108 
109  $evaluationToolbarGUI = $this->buildEvaluationToolbarGUI($testSession->getUserId(), $selectedSkillProfile);
110  $personalSkillsGUI = $this->buildPersonalSkillsGUI($testSession->getUserId(), $selectedSkillProfile);
111 
112  $this->tpl->setContent(
113  $this->ctrl->getHTML($evaluationToolbarGUI) . $this->ctrl->getHTML($personalSkillsGUI)
114  );
115  }
116 
117  private function buildEvaluationToolbarGUI($usrId, $selectedSkillProfileId)
118  {
119  $availableSkillProfiles = $this->skillEvaluation->getAssignedSkillMatchingSkillProfiles(
120  $usrId
121  );
122 
123  $noSkillProfileOptionEnabled = $this->skillEvaluation->noProfileMatchingAssignedSkillExists(
124  $usrId, $availableSkillProfiles
125  );
126 
127  $gui = new ilTestSkillEvaluationToolbarGUI($this->ctrl, $this->lng, $this, self::CMD_SHOW);
128 
129  $gui->setAvailableSkillProfiles($availableSkillProfiles);
130  $gui->setNoSkillProfileOptionEnabled($noSkillProfileOptionEnabled);
131  $gui->setSelectedEvaluationMode($selectedSkillProfileId);
132 
133  $gui->build();
134 
135  return $gui;
136  }
137 
138  private function buildPersonalSkillsGUI($usrId, $selectedSkillProfileId)
139  {
140  $availableSkills = $this->skillEvaluation->getUniqueAssignedSkillsForPersonalSkillGUI();
141  $reachedSkillLevels = $this->skillEvaluation->getReachedSkillLevelsForPersonalSkillGUI();
142 
143  $gui = new ilTestPersonalSkillsGUI($this->lng, $this->testOBJ);
144 
145  $gui->setAvailableSkills($availableSkills);
146  $gui->setSelectedSkillProfile($selectedSkillProfileId);
147 
148  $gui->setReachedSkillLevels($reachedSkillLevels);
149  $gui->setUsrId($usrId);
150 
151  return $gui;
152  }
153 }