3 declare(strict_types = 1);
30 return 'showLocalUnitCategories';
36 return 'showLocalUnitCategories';
39 return 'showGlobalUnitCategories';
44 if (!$this->request->isset(self::REQUEST_PARAM_SUB_CONTEXT_ID) ||
45 $this->request->raw(self::REQUEST_PARAM_SUB_CONTEXT_ID) == $this->
repository->getConsumerId()) {
69 $ilHelp = $DIC[
'ilHelp'];
71 $this->
ctrl->saveParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID);
73 $ilHelp->setScreenIdComponent(
'qpl');
74 parent::executeCommand();
81 $ilTabs = $DIC->tabs();
83 $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID, $this->
repository->getConsumerId());
84 $ilTabs->addSubTab(
'view_unit_ctx_local', $this->
lng->txt(
'un_local_units'), $this->
ctrl->getLinkTarget($this,
'showLocalUnitCategories'));
85 $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID, 0);
86 $ilTabs->addSubTab(
'view_unit_ctx_global', $this->
lng->txt(
'un_global_units'), $this->
ctrl->getLinkTarget($this,
'showGlobalUnitCategories'));
87 $this->
ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID,
'');
90 $ilTabs->activateSubTab(
'view_unit_ctx_local');
92 $ilTabs->activateSubTab(
'view_unit_ctx_global');
96 protected function showLocalUnitCategories():
void 100 $ilToolbar = $DIC->toolbar();
102 $ilToolbar->addButton($this->
lng->txt(
'un_add_category'), $this->
ctrl->getLinkTarget($this,
'showUnitCategoryCreationForm'));
105 $categories = array_filter(
108 return $category->getQuestionFi() === $repo->getConsumerId();
112 foreach ($categories as $category) {
115 'category_id' => $category->getId(),
116 'category' => $category->getDisplayString()
129 $table->setData($categories);
131 $this->tpl->setContent($table->getHTML());
136 if (!$this->request->isset(
'category_id')) {
137 $this->showGlobalUnitCategories();
157 foreach ($category_ids as $category_id) {
159 $category = $this->
repository->getUnitCategoryById((
int) $category_id);
165 $new_cat_id = $this->
repository->copyCategory($category->getId(), $this->
repository->getConsumerId());
168 $this->
repository->copyUnitsByCategories($category->getId(), $new_cat_id, $this->
repository->getConsumerId());
173 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
176 $this->
ctrl->setParameter($this,
'question_fi', 0);
177 $this->
ctrl->redirect($this,
'showLocalUnitCategories');
const REQUEST_PARAM_SUB_CONTEXT_ID
showUnitCategories(array $categories)
confirmImportGlobalCategory()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getUnitCategoryOverviewCommand()
ilUnitConfigurationRepository $repository
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importGlobalCategories(array $category_ids)
confirmImportGlobalCategories(array $category_ids)