ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestSkillAdministrationGUI.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 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php';
5require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdsGUI.php';
6
17{
21 private $ilias;
22
26 private $ctrl;
27
31 private $access;
32
36 private $tabs;
37
41 private $tpl;
42
46 private $lng;
47
51 private $db;
52
56 private $tree;
57
61 private $pluginAdmin;
62
66 private $testOBJ;
67
69 {
70 $this->ilias = $ilias;
71 $this->ctrl = $ctrl;
72 $this->access = $access;
73 $this->tabs = $tabs;
74 $this->tpl = $tpl;
75 $this->lng = $lng;
76 $this->db = $db;
77 $this->tree = $tree;
78 $this->pluginAdmin = $pluginAdmin;
79 $this->testOBJ = $testOBJ;
80 $this->refId = $refId;
81 }
82
83 public function executeCommand()
84 {
85 if ($this->isAccessDenied()) {
86 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
87 }
88
89 $nextClass = $this->ctrl->getNextClass();
90
91 $this->manageTabs($nextClass);
92
93 switch ($nextClass) {
94 case 'ilassquestionskillassignmentsgui':
95
96 $questionContainerId = $this->getQuestionContainerId();
97
98 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
99 $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
100 $questionList->setParentObjId($questionContainerId);
101 $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
102 $questionList->load();
103
104 $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
105 $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
106 $gui->setQuestionContainerId($questionContainerId);
107 $gui->setQuestionList($questionList);
108
109 if ($this->testOBJ->isFixedTest()) {
110 $gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
111 } else {
112 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
113 }
114
115 $this->ctrl->forwardCommand($gui);
116
117 break;
118
119 case 'iltestskilllevelthresholdsgui':
120
121 $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
122 $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
123 $gui->setQuestionContainerId($this->getQuestionContainerId());
124 $this->ctrl->forwardCommand($gui);
125 break;
126 }
127 }
128
130 {
131 if (!$this->testOBJ->isFixedTest()) {
132 return false;
133 }
134
135 if ($this->testOBJ->participantDataExist()) {
136 return false;
137 }
138
139 return true;
140 }
141
142 public function manageTabs($activeSubTabId)
143 {
144 $link = $this->ctrl->getLinkTargetByClass(
145 'ilAssQuestionSkillAssignmentsGUI',
147 );
148 $this->tabs->addSubTab(
149 'ilassquestionskillassignmentsgui',
150 $this->lng->txt('qpl_skl_sub_tab_quest_assign'),
151 $link
152
153 );
154
155 $link = $this->ctrl->getLinkTargetByClass(
156 'ilTestSkillLevelThresholdsGUI',
158 );
159 $this->tabs->addSubTab(
160 'iltestskilllevelthresholdsgui',
161 $this->lng->txt('tst_skl_sub_tab_thresholds'),
162 $link
163 );
164
165 $this->tabs->activateTab('tst_tab_competences');
166 $this->tabs->activateSubTab($activeSubTabId);
167 }
168
169 private function isAccessDenied()
170 {
171 if (!$this->testOBJ->isSkillServiceEnabled()) {
172 return true;
173 }
174
176 return true;
177 }
178
179 if (!$this->access->checkAccess('write', '', $this->refId)) {
180 return true;
181 }
182
183 return false;
184 }
185
186 private function getQuestionContainerId()
187 {
188 if ($this->testOBJ->isDynamicTest()) {
189 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
190 $this->tree,
191 $this->db,
192 $this->pluginAdmin,
193 $this->testOBJ
194 );
195
196 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
197
198 return $questionSetConfig->getSourceQuestionPoolId();
199 }
200
201 return $this->testOBJ->getId();
202 }
203
205 {
206 if ($this->testOBJ->isDynamicTest()) {
208 }
209
210 if ($this->testOBJ->isRandomTest()) {
212 }
213
214 return null;
215 }
216
218 {
219 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
220 $this->tree,
221 $this->db,
222 $this->pluginAdmin,
223 $this->testOBJ
224 );
225
226 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
227
228 if ($this->testOBJ->isRandomTest()) {
229 $testMode = $this->lng->txt('tst_question_set_type_random');
230 $poolLinks = $questionSetConfig->getCommaSeparatedSourceQuestionPoolLinks();
231
232 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
233 } elseif ($this->testOBJ->isDynamicTest()) {
234 $testMode = $this->lng->txt('tst_question_set_type_dynamic');
235 $poolLink = $questionSetConfig->getSourceQuestionPoolLink($questionSetConfig->getSourceQuestionPoolId());
236
237 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_dynquestset'), $testMode, $poolLink);
238 }
239
240 return '';
241 }
242}
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
language handling
static isSkillManagementGloballyActivated()
Administration class for plugins.
Tabs GUI.
__construct(ILIAS $ilias, ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db, ilTree $tree, ilPluginAdmin $pluginAdmin, ilObjTest $testOBJ, $refId)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Interface ilAccessHandler.
Interface ilDBInterface.
Class ChatMainBarProvider \MainMenu\Provider.
redirection script todo: (a better solution should control the processing via a xml file)
$refId
Definition: xapitoken.php:42