ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
87 $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
88 }
89
90 $nextClass = $this->ctrl->getNextClass();
91
92 $this->manageTabs($nextClass);
93
94 switch($nextClass)
95 {
96 case 'ilassquestionskillassignmentsgui':
97
98 $questionContainerId = $this->getQuestionContainerId();
99
100 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
101 $questionList = new ilAssQuestionList($this->db, $this->lng, $this->pluginAdmin);
102 $questionList->setParentObjId($questionContainerId);
103 $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
104 $questionList->load();
105
106 $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
107 $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
108 $gui->setQuestionContainerId($questionContainerId);
109 $gui->setQuestionList($questionList);
110
111 if( $this->testOBJ->isFixedTest() )
112 {
113 $gui->setQuestionOrderSequence($this->testOBJ->getQuestions());
114 }
115 else
116 {
117 $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
118 }
119
120 $this->ctrl->forwardCommand($gui);
121
122 break;
123
124 case 'iltestskilllevelthresholdsgui':
125
126 $gui = new ilTestSkillLevelThresholdsGUI($this->ctrl, $this->tpl, $this->lng, $this->db, $this->testOBJ->getTestId());
127 $gui->setQuestionAssignmentColumnsEnabled(!$this->testOBJ->isRandomTest());
128 $gui->setQuestionContainerId($this->getQuestionContainerId());
129 $this->ctrl->forwardCommand($gui);
130 break;
131 }
132 }
133
135 {
136 if( !$this->testOBJ->isFixedTest() )
137 {
138 return false;
139 }
140
141 if( $this->testOBJ->participantDataExist() )
142 {
143 return false;
144 }
145
146 return true;
147 }
148
149 public function manageTabs($activeSubTabId)
150 {
151 $link = $this->ctrl->getLinkTargetByClass(
153 );
154 $this->tabs->addSubTab(
155 'ilassquestionskillassignmentsgui', $this->lng->txt('qpl_skl_sub_tab_quest_assign'), $link
156
157 );
158
159 $link = $this->ctrl->getLinkTargetByClass(
160 'ilTestSkillLevelThresholdsGUI', ilTestSkillLevelThresholdsGUI::CMD_SHOW_SKILL_THRESHOLDS
161 );
162 $this->tabs->addSubTab(
163 'iltestskilllevelthresholdsgui', $this->lng->txt('tst_skl_sub_tab_thresholds'), $link
164 );
165
166 $this->tabs->activateTab('tst_tab_competences');
167 $this->tabs->activateSubTab($activeSubTabId);
168 }
169
170 private function isAccessDenied()
171 {
172 if( !$this->testOBJ->isSkillServiceEnabled() )
173 {
174 return true;
175 }
176
178 {
179 return true;
180 }
181
182 if( ! $this->access->checkAccess('write', '', $this->refId) )
183 {
184 return true;
185 }
186
187 return false;
188 }
189
190 private function getQuestionContainerId()
191 {
192 if( $this->testOBJ->isDynamicTest() )
193 {
194 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
195 $this->tree, $this->db, $this->pluginAdmin, $this->testOBJ
196 );
197
198 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
199
200 return $questionSetConfig->getSourceQuestionPoolId();
201 }
202
203 return $this->testOBJ->getId();
204 }
205
207 {
208 if( $this->testOBJ->isDynamicTest() )
209 {
211 }
212
213 if( $this->testOBJ->isRandomTest() )
214 {
216 }
217
218 return null;
219 }
220
222 {
223 $questionSetConfigFactory = new ilTestQuestionSetConfigFactory(
224 $this->tree, $this->db, $this->pluginAdmin, $this->testOBJ
225 );
226
227 $questionSetConfig = $questionSetConfigFactory->getQuestionSetConfig();
228
229 if( $this->testOBJ->isRandomTest() )
230 {
231 $testMode = $this->lng->txt('tst_question_set_type_random');
232 $poolLinks = $questionSetConfig->getCommaSeparatedSourceQuestionPoolLinks();
233
234 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
235 }
236 elseif( $this->testOBJ->isDynamicTest() )
237 {
238 $testMode = $this->lng->txt('tst_question_set_type_dynamic');
239 $poolLink = $questionSetConfig->getSourceQuestionPoolLink($questionSetConfig->getSourceQuestionPoolId());
240
241 return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_dynquestset'), $testMode, $poolLink);
242 }
243
244 return '';
245 }
246}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
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 ilDBInterface.
Interface Card \UI\Component\Card.
redirection script todo: (a better solution should control the processing via a xml file)