19 declare(strict_types=1);
45 $main_tpl = $DIC->ui()->mainTemplate();
46 $this->
ctrl = $DIC->ctrl();
47 $this->
lng = $DIC->language();
48 $this->tpl = $DIC->ui()->mainTemplate();
49 $this->
tabs = $DIC->tabs();
50 $this->
toolbar = $DIC->toolbar();
51 $this->
http = $DIC->http();
53 $this->ui_factory = $DIC->ui()->factory();
54 $this->renderer = $DIC->ui()->renderer();
56 $this->
tabs->setSetupMode(
true);
57 $DIC->help()->setScreenId(
'dcl_tables');
59 $this->parent_obj = $a_parent_obj;
61 if ($a_parent_obj->
getRefId() >= 0) {
66 $main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
67 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'listRecords');
73 return $this->parent_obj->getObjectId();
78 return $this->parent_obj->getRefId();
87 $cmd = $this->
ctrl->getCmd(
'listTables');
89 $next_class = $this->
ctrl->getNextClass($this);
94 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
99 $DIC->rbac()->review(),
106 if (count($role_titles) > 0) {
107 $this->tpl->setOnScreenMessage(
109 $DIC->language()->txt(
'dcl_rbac_roles_without_read_access_on_any_standard_view') .
" " . implode(
116 switch ($next_class) {
117 case 'ildcltableeditgui':
118 $this->
tabs->clearTargets();
119 if ($cmd !=
'create') {
122 $this->
tabs->setBackTarget(
123 $this->
lng->txt(
'back'),
124 $this->
ctrl->getLinkTarget($this,
'listTables')
128 $this->
ctrl->forwardCommand($ilDclTableEditGUI);
131 case 'ildclfieldlistgui':
132 $this->
tabs->clearTargets();
135 $this->
ctrl->forwardCommand($ilDclFieldListGUI);
138 case "ildclfieldeditgui":
139 $this->
tabs->clearTargets();
142 $this->
ctrl->forwardCommand($ilDclFieldEditGUI);
145 case 'ildcltableviewgui':
146 $this->
tabs->clearTargets();
149 $this->
ctrl->forwardCommand($ilDclTableViewGUI);
153 $this->
ctrl->clearParameterByClass(ilObjDataCollectionGUI::class,
'table_id');
160 $add_new = $this->ui_factory->button()->primary(
161 $this->
lng->txt(
"dcl_add_new_table"),
162 $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'create')
164 $this->
toolbar->addStickyItem($add_new);
167 $this->tpl->setContent($table_gui->getHTML());
170 protected function setTabs(
string $active): void
172 $this->
tabs->setBackTarget($this->
lng->txt(
'dcl_tables'), $this->
ctrl->getLinkTarget($this,
'listTables'));
175 $this->
lng->txt(
'settings'),
176 $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'edit')
180 $this->
lng->txt(
'dcl_list_fields'),
181 $this->
ctrl->getLinkTargetByClass(
'ilDclFieldListGUI',
'listFields')
185 $this->
lng->txt(
'dcl_tableviews'),
186 $this->
ctrl->getLinkTargetByClass(
'ilDclTableViewGUI')
188 $this->
tabs->activateTab($active);
191 protected function save(): void
193 if ($this->
http->wrapper()->post()->has(
"comments")) {
199 if ($this->
http->wrapper()->post()->has(
"visible")) {
200 $visible = $this->
http->wrapper()->post()->retrieve(
205 $orders = $this->
http->wrapper()->post()->retrieve(
211 foreach (array_keys($orders) as $table_id) {
213 $table->setOrder($order);
214 $table->setPublicCommentsEnabled(isset(
$comments[$table_id]));
215 $table->setIsVisible(isset($visible[$table_id]));
219 $this->
ctrl->redirect($this);
225 $has_dcl_table_ids = $this->
http->wrapper()->post()->has(
'dcl_table_ids');
226 if (!$has_dcl_table_ids) {
227 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_delete_tables_no_selection'),
true);
228 $this->
ctrl->redirect($this,
'listTables');
231 $tables = $this->
http->wrapper()->post()->retrieve(
237 $this->
tabs->clearSubTabs();
239 $conf->setFormAction($this->
ctrl->getFormAction($this));
240 $conf->setHeaderText($this->
lng->txt(
'dcl_tables_confirm_delete'));
242 foreach ($tables as $table_id) {
245 $conf->setConfirm($this->
lng->txt(
'delete'),
'deleteTables');
246 $conf->setCancel($this->
lng->txt(
'cancel'),
'listTables');
247 $this->tpl->setContent($conf->getHTML());
252 $has_dcl_table_ids = $this->
http->wrapper()->post()->has(
'dcl_table_ids');
253 if ($has_dcl_table_ids) {
254 $tables = $this->
http->wrapper()->post()->retrieve(
258 foreach ($tables as $table_id) {
262 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tables_deleted'),
true);
263 $this->
ctrl->clearParameterByClass(
"ilobjdatacollectiongui",
"table_id");
264 $this->
ctrl->redirect($this,
'listTables');
274 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_tables_delete_all'),
true);
275 $this->
ctrl->redirect($this,
'listTables');
281 $ref_id = $this->parent_obj->getRefId();
288 return $this->parent_obj->getDataCollectionObject();
ilObjDataCollectionGUI $parent_obj
checkTablesLeft(int $delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDataCollectionObject()
ilDclTableViewGUI: ilDclTableViewEditGUI
ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI ...
ilObjDataCollectionGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI ilObjDataCollectionG...
__construct(ilObjDataCollectionGUI $a_parent_obj)
ilDclTableListGUI constructor.
static http()
Fetches the global http state from ILIAS.
executeCommand()
execute command
static getTableCache(int $table_id=null)
getRoleTitlesWithoutReadRightOnAnyStandardView()
static _lookupObjectId(int $ref_id)
static hasWriteAccess(int $ref, ?int $user_id=0)
ILIAS Refinery Factory $refinery
ILIAS HTTP Services $http
ilGlobalTemplateInterface $tpl
ILIAS UI Factory $ui_factory
ILIAS UI Renderer $renderer