19 declare(strict_types=1);
42 $main_tpl = $DIC->ui()->mainTemplate();
43 $this->
ctrl = $DIC->ctrl();
44 $this->
lng = $DIC->language();
45 $this->tpl = $DIC->ui()->mainTemplate();
46 $this->
tabs = $DIC->tabs();
47 $this->
toolbar = $DIC->toolbar();
48 $this->
http = $DIC->http();
50 $this->ui_factory = $DIC->ui()->factory();
51 $this->renderer = $DIC->ui()->renderer();
53 $this->
tabs->setSetupMode(
true);
54 $DIC->help()->setScreenId(
'dcl_tables');
56 $this->parent_obj = $a_parent_obj;
59 $main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
60 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'listRecords');
66 return $this->parent_obj->getObjectId();
71 return $this->parent_obj->getRefId();
80 $cmd = $this->
ctrl->getCmd(
'listTables');
82 $next_class = $this->
ctrl->getNextClass($this);
84 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
89 $DIC->rbac()->review(),
95 if (count($role_titles) > 0) {
96 $this->tpl->setOnScreenMessage(
98 $this->
lng->txt(
'dcl_rbac_roles_without_read_access_on_any_standard_view') .
" " . implode(
105 switch ($next_class) {
106 case 'ildcltableeditgui':
107 $this->
tabs->clearTargets();
108 if ($cmd !=
'create') {
111 $this->
tabs->setBackTarget(
112 $this->
lng->txt(
'back'),
113 $this->
ctrl->getLinkTarget($this,
'listTables')
117 $this->
ctrl->forwardCommand($ilDclTableEditGUI);
120 case 'ildclfieldlistgui':
121 $this->
tabs->clearTargets();
124 $this->
ctrl->forwardCommand($ilDclFieldListGUI);
127 case "ildclfieldeditgui":
128 $this->
tabs->clearTargets();
131 $this->
ctrl->forwardCommand($ilDclFieldEditGUI);
134 case 'ildcltableviewgui':
135 $this->
tabs->clearTargets();
138 $this->
ctrl->forwardCommand($ilDclTableViewGUI);
142 $this->
ctrl->clearParameterByClass(ilObjDataCollectionGUI::class,
'table_id');
150 $add_new = $this->ui_factory->button()->primary(
151 $this->
lng->txt(
"dcl_add_new_table"),
152 $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'create')
154 $this->
toolbar->addStickyItem($add_new);
156 $this->tpl->setContent(
157 $this->renderer->render(
158 $this->ui_factory->panel()->listing()->standard(
159 $this->
lng->txt(
'dcl_tables'),
160 [$this->ui_factory->item()->group(
'', $this->
getItems())]
169 foreach ($this->parent_obj->getDataCollectionObject()->getTables() as $table) {
171 $this->
ctrl->setParameterByClass(ilObjDataCollectionGUI::class,
'table_id', $table->getId());
172 $item = $this->ui_factory->item()->standard(
173 $this->ui_factory->link()->standard(
175 $this->
ctrl->getLinkTargetByClass(ilDclFieldListGUI::class,
'listFields')
179 $this->
lng->txt(
'visible') => $this->
lng->txt($table->getIsVisible() ?
'yes' :
'no'),
180 $this->
lng->txt(
'comments') => $this->
lng->txt($table->getPublicCommentsEnabled() ?
'active' :
'inactive')
183 $this->ui_factory->dropdown()->standard(
188 if ($table->getOrder() === 10) {
189 $item = $item->withDescription($this->
lng->txt(
'default'));
202 $this->
ctrl->setParameterByClass(ilObjDataCollectionGUI::class,
'table_id', $table->
getId());
205 $actions[] = $this->ui_factory->button()->shy(
206 $this->
lng->txt(
'settings'),
207 $this->
ctrl->getLinkTargetByClass(ilDclTableEditGUI::class,
'edit'),
210 $actions[] = $this->ui_factory->button()->shy(
211 $this->
lng->txt(
'dcl_list_fields'),
212 $this->
ctrl->getLinkTargetByClass(ilDclFieldListGUI::class,
'listFields')
215 $actions[] = $this->ui_factory->button()->shy(
216 $this->
lng->txt(
'dcl_tableviews'),
217 $this->
ctrl->getLinkTargetByClass(ilDclTableViewGUI::class,
'show')
220 $actions[] = $this->ui_factory->button()->shy(
221 $this->
lng->txt(
'delete'),
222 $this->
ctrl->getLinkTargetByClass(ilDclTableEditGUI::class,
'confirmDelete')
226 $actions[] = $this->ui_factory->button()->shy(
227 $this->
lng->txt(
'set_as_default'),
228 $this->
ctrl->getLinkTargetByClass(ilDclTableEditGUI::class,
'setAsDefault')
235 protected function setTabs(
string $active): void
237 $this->
tabs->setBackTarget($this->
lng->txt(
'dcl_tables'), $this->
ctrl->getLinkTarget($this,
'listTables'));
240 $this->
lng->txt(
'settings'),
241 $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'edit')
245 $this->
lng->txt(
'dcl_list_fields'),
246 $this->
ctrl->getLinkTargetByClass(
'ilDclFieldListGUI',
'listFields')
250 $this->
lng->txt(
'dcl_tableviews'),
251 $this->
ctrl->getLinkTargetByClass(
'ilDclTableViewGUI')
253 $this->
tabs->activateTab($active);
256 protected function save(): void
258 if ($this->
http->wrapper()->post()->has(
"comments")) {
264 if ($this->
http->wrapper()->post()->has(
"visible")) {
265 $visible = $this->
http->wrapper()->post()->retrieve(
270 $orders = $this->
http->wrapper()->post()->retrieve(
276 foreach (array_keys($orders) as $table_id) {
278 $table->setOrder($order);
279 $table->setPublicCommentsEnabled(isset(
$comments[$table_id]));
280 $table->setIsVisible(isset($visible[$table_id]));
284 $this->
ctrl->redirect($this);
289 $ref_id = $this->parent_obj->getRefId();
296 return $this->parent_obj->getDataCollectionObject();
ilObjDataCollectionGUI $parent_obj
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 ...
getActions(ilDclTable $table)
ilObjDataCollectionGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI ilObjDataCollectionG...
__construct(ilObjDataCollectionGUI $a_parent_obj)
static http()
Fetches the global http state from ILIAS.
executeCommand()
execute command
static getTableCache(int $table_id=null)
getRoleTitlesWithoutReadRightOnAnyStandardView()
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