ILIAS  release_8 Revision v8.24
class.ilUnitCategoryTableGUI.php
Go to the documentation of this file.
1<?php
2
23abstract class ilUnitCategoryTableGUI extends ilTable2GUI
24{
29 public function __construct(ilUnitConfigurationGUI $controller, $cmd)
30 {
34 global $DIC;
35 $ilCtrl = $DIC['ilCtrl'];
36
37 $this->setId('ucats_' . $controller->getUniqueId());
38
39 parent::__construct($controller, $cmd);
40
41 $this->addColumn('', '', '1%', true);
42 $this->addColumn($this->lng->txt('title'), 'category', '99%');
43 $this->addColumn('', '', '1%', true);
44
45 $this->setDefaultOrderDirection('category');
46 $this->setDefaultOrderDirection('ASC');
47 $ref_id = $DIC->testQuestionPool()->internal()->request()->getRefId();
49 if ($type === 'assf') {
50 $hasAccess = $DIC->rbac()->system()->checkAccess('edit', $ref_id);
51 } else {
52 $hasAccess = $DIC->access()->checkAccess('edit', $cmd, $ref_id);
53 }
54 if ($hasAccess) {
55 if ($this->getParentObject()->isCRUDContext()) {
56 $this->addMultiCommand('confirmDeleteCategories', $this->lng->txt('delete'));
57 } else {
58 $this->addMultiCommand('confirmImportGlobalCategories', $this->lng->txt('import'));
59 }
60 }
61
62 $this->populateTitle();
63
64 $this->setFormAction($ilCtrl->getFormAction($this->getParentObject(), $cmd));
65 $this->setSelectAllCheckbox('category_ids[]');
66 $this->setRowTemplate('tpl.unit_category_row.html', 'Modules/TestQuestionPool');
67 }
68
69 abstract protected function populateTitle(): void;
70
74 public function fillRow(array $row): void
75 {
79 global $DIC;
80 $ilCtrl = $DIC['ilCtrl'];
81
82 $row['chb'] = ilLegacyFormElementsUtil::formCheckbox(false, 'category_ids[]', $row['category_id']);
83
84 $action = new ilAdvancedSelectionListGUI();
85 $action->setId('asl_content_' . $row['category_id']);
86 $action->setAsynch(false);
87 $action->setListTitle($this->lng->txt('actions'));
88 $ilCtrl->setParameter($this->getParentObject(), 'category_id', $row['category_id']);
89 $action->addItem($this->lng->txt('un_show_units'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory'));
90 $ref_id = $DIC->testQuestionPool()->internal()->request()->getRefId();
92 if ($type === 'assf') {
93 $hasAccess = $DIC->rbac()->system()->checkAccess('edit', $ref_id);
94 } else {
95 $hasAccess = $DIC->access()->checkAccess('edit', 'showUnitCategoryModificationForm', $ref_id) &&
96 $DIC->access()->checkAccess('edit', 'confirmDeleteCategory', $ref_id);
97 }
98 if ($this->getParentObject()->isCRUDContext()) {
99 if ($hasAccess) {
100 $action->addItem($this->lng->txt('edit'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitCategoryModificationForm'));
101 $action->addItem($this->lng->txt('delete'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmDeleteCategory'));
102 }
103 } else {
104 $action->addItem($this->lng->txt('import'), '', $ilCtrl->getLinkTarget($this->getParentObject(), 'confirmImportGlobalCategory'));
105 }
106 $row['title_href'] = $ilCtrl->getLinkTarget($this->getParentObject(), 'showUnitsOfCategory');
107 $ilCtrl->setParameter($this->getParentObject(), 'category_id', '');
108 $row['actions'] = $action->getHtml();
109
110 $row['category'] = htmlspecialchars($row['category'], ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
111
112 parent::fillRow($row);
113 }
114}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formCheckbox(bool $checked, string $varname, string $value, bool $disabled=false)
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
fillRow(array $a_set)
Standard Version of Fill Row.
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
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...
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type