4 require_once
'Modules/TestQuestionPool/classes/class.ilUnitConfigurationGUI.php';
18 return 'showLocalUnitCategories';
28 return 'showLocalUnitCategories';
32 return 'showGlobalUnitCategories';
41 if(!isset(
$_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID]) ||
$_GET[self::REQUEST_PARAM_SUB_CONTEXT_ID] == $this->repository->getConsumerId())
56 $id = $this->repository->getConsumerId();
75 $this->ctrl->saveParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID);
90 $this->ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID, $this->repository->getConsumerId());
91 $ilTabs->addSubTab(
'view_unit_ctx_local', $this->lng->txt(
'un_local_units'), $this->ctrl->getLinkTarget($this,
'showLocalUnitCategories'));
92 $this->ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID, 0);
93 $ilTabs->addSubTab(
'view_unit_ctx_global', $this->lng->txt(
'un_global_units'), $this->ctrl->getLinkTarget($this,
'showGlobalUnitCategories'));
94 $this->ctrl->setParameter($this, self::REQUEST_PARAM_SUB_CONTEXT_ID,
'');
98 $ilTabs->activateSubTab(
'view_unit_ctx_local');
102 $ilTabs->activateSubTab(
'view_unit_ctx_global');
109 protected function showLocalUnitCategories()
116 $ilToolbar->addButton($this->lng->txt(
'un_add_category'), $this->ctrl->getLinkTarget($this,
'showUnitCategoryCreationForm'));
119 $categories = array_filter(
120 $this->repository->getAllUnitCategories(),
122 return $category->getQuestionFi() == $repo->getConsumerId() ?
true :
false;
126 foreach($categories as $category)
132 'category_id' => $category->getId(),
133 'category' => $category->getDisplayString()
145 require_once
'Modules/TestQuestionPool/classes/tables/class.ilLocalUnitCategoryTableGUI.php';
147 $table->setData($categories);
149 $this->tpl->setContent($table->getHTML());
157 if(!isset(
$_GET[
'category_id']))
159 $this->showGlobalUnitCategories();
162 $_POST[
'category_ids'] = array(
$_GET[
'category_id']);
172 if(!isset(
$_POST[
'category_ids']) || !is_array(
$_POST[
'category_ids']))
174 $this->showGlobalUnitCategories();
193 if(!isset(
$_POST[
'category_ids']) || !is_array(
$_POST[
'category_ids']))
195 $this->showGlobalUnitCategories();
200 foreach(
$_POST[
'category_ids'] as $category_id)
204 $category = $this->repository->getUnitCategoryById((
int)$category_id);
212 $new_cat_id = $this->repository->copyCategory($category->getId(), $this->repository->getConsumerId());
215 $this->repository->copyUnitsByCategories($category->getId(), $new_cat_id, $this->repository->getConsumerId());
224 $this->ctrl->setParameter($this,
'question_fi', 0);
225 $this->ctrl->redirect($this,
'showLocalUnitCategories');