19 declare(strict_types=1);
49 $locator = $DIC[
'ilLocator'];
50 $this->parent_obj = $a_parent_obj;
51 $this->
ctrl = $DIC->ctrl();
52 $this->
lng = $DIC->language();
53 $this->tpl = $DIC->ui()->mainTemplate();
54 $this->
tabs = $DIC->tabs();
55 $this->
toolbar = $DIC->toolbar();
56 $this->
http = $DIC->http();
58 $this->ui_factory = $DIC->ui()->factory();
59 $this->
renderer = $DIC->ui()->renderer();
61 $DIC->help()->setScreenId(
'dcl_views');
64 $table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
68 $this->table->getCollectionObject()->setRefId(
69 $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int())
72 $this->
ctrl->saveParameterByClass(
'ilDclTableEditGUI',
'table_id');
73 $locator->addItem($this->table->getTitle(), $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'edit'));
74 $this->tpl->setLocator();
77 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
78 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'listRecords');
84 $this->
ctrl->saveParameter($this,
'table_id');
85 $cmd = $this->
ctrl->getCmd(
"show");
86 $next_class = $this->
ctrl->getNextClass($this);
88 switch ($next_class) {
89 case strtolower(ilDclTableViewEditGUI::class):
90 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
91 $tableview_id = $this->
http->wrapper()->query()->retrieve(
104 $this->
ctrl->saveParameter($edit_gui,
'tableview_id');
105 $this->
ctrl->forwardCommand($edit_gui);
121 $this->parent_obj->getDataCollectionObject()->getRefId(),
122 $this->table->getId()
128 $add_new = $this->ui_factory->button()->primary(
129 $this->
lng->txt(
"dcl_add_new_view"),
130 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'add')
132 $this->
toolbar->addStickyItem($add_new);
134 $this->
toolbar->addSeparator();
137 $switcher->addTableSwitcherToToolbar(
138 $this->parent_obj->getDataCollectionObject()->getTables(),
143 $this->tpl->setContent(
145 $this->ui_factory->panel()->listing()->standard(
146 sprintf($this->
lng->txt(
'dcl_tableviews_of_X'), $this->table->getTitle()),
147 [$this->ui_factory->item()->group(
'', $this->
getItems())]
156 foreach ($this->table->getTableViews() as $tableview) {
158 $this->
ctrl->setParameterByClass(ilDclTableViewEditGUI::class,
'tableview_id', $tableview->getId());
159 $item = $this->ui_factory->item()->standard(
160 $this->ui_factory->link()->standard(
161 $tableview->getTitle(),
162 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'show')
165 ->withDescription($tableview->getDescription())
166 ->withActions($this->ui_factory->dropdown()->standard($this->
getActions($tableview)));
178 $this->
ctrl->setParameterByClass(ilDclTableViewEditGUI::class,
'tableview_id', $tableview->
getId());
181 $actions[] = $this->ui_factory->button()->shy(
182 $this->
lng->txt(
'edit'),
183 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'editGeneralSettings')
185 $actions[] = $this->ui_factory->button()->shy(
186 $this->
lng->txt(
'copy'),
187 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'copy')
189 $actions[] = $this->ui_factory->button()->shy(
190 $this->
lng->txt(
'delete'),
191 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'confirmDelete')
202 if ($delete_count >= count($this->table->getTableViews())) {
203 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_tableviews_delete_all'),
true);
204 $this->
ctrl->redirect($this,
'show');
213 $orders = $this->
http->wrapper()->post()->retrieve(
219 foreach (array_keys($orders) as $tableview_id) {
220 $tableviews[] = ilDclTableView::find($tableview_id);
222 $this->table->sortTableViews($tableviews);
223 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tableviews_order_updated'));
224 $this->
ctrl->redirect($this);
ilDclTableListGUI $parent_obj
ilGlobalTemplateInterface $tpl
ilDclTableViewEditGUI: ilDclDetailedViewDefinitionGUI ilDclTableViewEditGUI: ilDclCreateViewDefiniti...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static findOrGetInstance($primary_key, array $add_constructor_args=[])
saveTableViewOrder()
invoked by ilDclTableViewTableGUI
ilDclTableViewGUI: ilDclTableViewEditGUI
__construct(ilDclTableListGUI $a_parent_obj, int $table_id=0)
Constructor.
ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI ...
checkViewsLeft(int $delete_count)
redirects if there are no tableviews left after deletion of {$delete_count} tableviews ...
static http()
Fetches the global http state from ILIAS.
ILIAS Refinery Factory $refinery
static getTableCache(?int $table_id=null)
getActions(ilDclTableView $tableview)
ILIAS UI Factory $ui_factory
static hasAccessToEditTable(int $ref_id, int $table_id)
ILIAS UI Renderer $renderer
ILIAS HTTP Services $http