ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilTestSkillAdministrationGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 
37 {
38  public function __construct(
39  private ilCtrlInterface $ctrl,
40  private ilAccessHandler $access,
41  private TabsManager $tabs_manager,
42  private ilGlobalTemplateInterface $tpl,
43  private ilLanguage $lng,
44  private Refinery $refinery,
45  private ilDBInterface $db,
46  private TestLogger $logger,
47  private ilTree $tree,
48  private ilComponentRepository $component_repository,
49  private ilObjTest $test_obj,
50  private GeneralQuestionPropertiesRepository $questionrepository,
51  private RequestDataCollector $request_data_collector,
52  private int $ref_id
53  ) {
54  }
55 
56  public function executeCommand()
57  {
58  if ($this->isAccessDenied()) {
59  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("no_permission"), true);
60  $this->ctrl->setParameterByClass(ilObjTestGUI::class, 'ref_id', $this->ref_id);
61  $this->ctrl->redirectByClass(ilObjTestGUI::class);
62  }
63 
64  $nextClass = $this->ctrl->getNextClass();
65 
66  switch ($nextClass) {
67  case 'ilassquestionskillassignmentsgui':
68  $this->tabs_manager->getQuestionsSubTabs();
69  $this->tabs_manager->activateTab(TabsManager::TAB_ID_QUESTIONS);
70  $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_ASSIGN_SKILLS_TO_QUESTIONS);
71 
72  $questionContainerId = $this->test_obj->getId();
73 
74  $questionList = new ilAssQuestionList($this->db, $this->lng, $this->refinery, $this->component_repository);
75  $questionList->setParentObjId($questionContainerId);
76  $questionList->setQuestionInstanceTypeFilter($this->getRequiredQuestionInstanceTypeFilter());
77  $questionList->load();
78 
79  $gui = new ilAssQuestionSkillAssignmentsGUI($this->ctrl, $this->access, $this->tpl, $this->lng, $this->db);
80  $gui->setAssignmentEditingEnabled($this->isAssignmentEditingRequired());
81  $gui->setQuestionContainerId($questionContainerId);
82  $gui->setQuestionList($questionList);
83 
84  if ($this->test_obj->isFixedTest()) {
85  $gui->setQuestionOrderSequence($this->test_obj->getQuestions());
86  } else {
87  $gui->setAssignmentConfigurationHintMessage($this->buildAssignmentConfigurationInPoolHintMessage());
88  }
89 
90  $this->ctrl->forwardCommand($gui);
91 
92  break;
93 
94  case 'iltestskilllevelthresholdsgui':
95  $this->tabs_manager->getSettingsSubTabs();
96  $this->tabs_manager->activateTab(TabsManager::TAB_ID_SETTINGS);
97  $this->tabs_manager->activateSubTab(TabsManager::SETTINGS_SUBTAB_ID_ASSIGN_SKILL_TRESHOLDS);
98 
100  $this->ctrl,
101  $this->tpl,
102  $this->lng,
103  $this->db,
104  $this->request_data_collector,
105  $this->test_obj->getTestId()
106  );
107  $gui->setQuestionAssignmentColumnsEnabled(!$this->test_obj->isRandomTest());
108  $gui->setQuestionContainerId($this->test_obj->getId());
109  $this->ctrl->forwardCommand($gui);
110  break;
111  }
112  }
113 
114  private function isAssignmentEditingRequired(): bool
115  {
116  if (!$this->test_obj->isFixedTest()) {
117  return false;
118  }
119 
120  if ($this->test_obj->participantDataExist()) {
121  return false;
122  }
123 
124  return true;
125  }
126 
127  private function isAccessDenied(): bool
128  {
129  if (!$this->test_obj->isSkillServiceEnabled()) {
130  return true;
131  }
132 
134  return true;
135  }
136 
137  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
138  return true;
139  }
140 
141  return false;
142  }
143 
144  private function getRequiredQuestionInstanceTypeFilter(): ?string
145  {
146  if ($this->test_obj->isRandomTest()) {
148  }
149 
150  return null;
151  }
152 
154  {
155  $question_set_config_factory = new ilTestQuestionSetConfigFactory(
156  $this->tree,
157  $this->db,
158  $this->lng,
159  $this->logger,
160  $this->component_repository,
161  $this->test_obj,
162  $this->questionrepository
163  );
164 
165  $question_set_config = $question_set_config_factory->getQuestionSetConfig();
166 
167  if ($this->test_obj->isRandomTest()) {
168  $testMode = $this->lng->txt('tst_question_set_type_random');
169  $poolLinks = $question_set_config->getCommaSeparatedSourceQuestionPoolLinks();
170 
171  return sprintf($this->lng->txt('tst_qst_skl_cfg_in_pool_hint_rndquestset'), $testMode, $poolLinks);
172  }
173 
174  return '';
175  }
176 }
Readable part of repository interface to ilComponentDataDB.
__construct(private ilCtrlInterface $ctrl, private ilAccessHandler $access, private TabsManager $tabs_manager, private ilGlobalTemplateInterface $tpl, private ilLanguage $lng, private Refinery $refinery, private ilDBInterface $db, private TestLogger $logger, private ilTree $tree, private ilComponentRepository $component_repository, private ilObjTest $test_obj, private GeneralQuestionPropertiesRepository $questionrepository, private RequestDataCollector $request_data_collector, private int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setQuestionAssignmentColumnsEnabled(bool $question_assignment_columns_enabled)
$ref_id
Definition: ltiauth.php:65
static isSkillManagementGloballyActivated()
global $lng
Definition: privfeed.php:31