ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $link = $this->ctrl->getLinkTargetByClass(
155 'ilTestSkillLevelThresholdsGUI',
157 );
158 $this->tabs->addSubTab(
159 'iltestskilllevelthresholdsgui',
160 $this->lng->txt('tst_skl_sub_tab_thresholds'),
161 $link
162 );
163
164 $this->tabs->activateTab('tst_tab_competences');
165 $this->tabs->activateSubTab($activeSubTabId);
166 }
167
168 private function isAccessDenied()
169 {
170 if (!$this->testOBJ->isSkillServiceEnabled()) {
171 return true;
172 }
173
175 return true;
176 }
177
178 if (!$this->access->checkAccess('write', '', $this->refId)) {
179 return true;
180 }
181
182 return false;
183 }
184
185 private function getQuestionContainerId()
186 {
187 if ($this->testOBJ->isDynamicTest()) {
188 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
189 $this->tree,
190 $this->db,
191 $this->pluginAdmin,
192 $this->testOBJ
193 );
194
195 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
196
197 return $questionSetConfig->getSourceQuestionPoolId();
198 }
199
200 return $this->testOBJ->getId();
201 }
202
204 {
205 if ($this->testOBJ->isDynamicTest()) {
207 }
208
209 if ($this->testOBJ->isRandomTest()) {
211 }
212
213 return null;
214 }
215
217 {
218 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
219 $this->tree,
220 $this->db,
221 $this->pluginAdmin,
222 $this->testOBJ
223 );
224
225 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
226
227 if ($this->testOBJ->isRandomTest()) {
228 $testMode = $this->lng->txt('tst_question_set_type_random');
229 $poolLinks = $questionSetConfig->getCommaSeparatedSourceQuestionPoolLinks();
230
231 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
232 } elseif ($this->testOBJ->isDynamicTest()) {
233 $testMode = $this->lng->txt('tst_question_set_type_dynamic');
234 $poolLink = $questionSetConfig->getSourceQuestionPoolLink($questionSetConfig->getSourceQuestionPoolId());
235
236 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_dynquestset'), $testMode, $poolLink);
237 }
238
239 return '';
240 }
241}
sprintf('%.4f', $callTime)
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.
special template class to simplify handling of ITX/PEAR
__construct(ILIAS $ilias, ilCtrl $ctrl, ilAccessHandler $access, ilTabsGUI $tabs, ilTemplate $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 BaseForm.
redirection script todo: (a better solution should control the processing via a xml file)