19 declare(strict_types=1);
47 $locator = $DIC[
'ilLocator'];
48 $this->parent_obj = $a_parent_obj;
49 $this->
ctrl = $DIC->ctrl();
50 $this->
lng = $DIC->language();
51 $this->tpl = $DIC->ui()->mainTemplate();
52 $this->
tabs = $DIC->tabs();
53 $this->
toolbar = $DIC->toolbar();
54 $this->
http = $DIC->http();
56 $this->ui_factory = $DIC->ui()->factory();
57 $this->renderer = $DIC->ui()->renderer();
59 $DIC->help()->setScreenId(
'dcl_views');
62 $table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
67 $this->
ctrl->saveParameterByClass(
'ilDclTableEditGUI',
'table_id');
68 $locator->addItem($this->table->getTitle(), $this->
ctrl->getLinkTargetByClass(
'ilDclTableEditGUI',
'edit'));
69 $this->tpl->setLocator();
72 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
73 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'listRecords');
79 $this->
ctrl->saveParameter($this,
'table_id');
80 $cmd = $this->
ctrl->getCmd(
"show");
81 $next_class = $this->
ctrl->getNextClass($this);
83 switch ($next_class) {
84 case strtolower(ilDclTableViewEditGUI::class):
85 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
86 $tableview_id = $this->
http->wrapper()->query()->retrieve(
99 $this->
ctrl->saveParameter($edit_gui,
'tableview_id');
100 $this->
ctrl->forwardCommand($edit_gui);
116 $this->parent_obj->getDataCollectionObject()->getRefId(),
117 $this->table->getId()
123 $add_new = $this->ui_factory->button()->primary(
124 $this->
lng->txt(
"dcl_add_new_view"),
125 $this->
ctrl->getLinkTargetByClass(ilDclTableViewEditGUI::class,
'add')
127 $this->
toolbar->addStickyItem($add_new);
129 $this->
toolbar->addSeparator();
132 $switcher->addTableSwitcherToToolbar(
133 $this->parent_obj->getDataCollectionObject()->getTables(),
139 $this->tpl->setContent($table_gui->getHTML());
148 $has_dcl_tableview_ids = $this->
http->wrapper()->post()->has(
'dcl_tableview_ids');
149 if (!$has_dcl_tableview_ids) {
150 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_delete_views_no_selection'),
true);
151 $this->
ctrl->redirect($this,
'show');
154 $tableviews = $this->
http->wrapper()->post()->retrieve(
160 $this->
tabs->clearSubTabs();
162 $conf->setFormAction($this->
ctrl->getFormAction($this));
163 $conf->setHeaderText($this->
lng->txt(
'dcl_tableviews_confirm_delete'));
165 foreach ($tableviews as $tableview_id) {
166 $conf->addItem(
'dcl_tableview_ids[]', (
string) $tableview_id, ilDclTableView::find($tableview_id)->getTitle());
168 $conf->setConfirm($this->
lng->txt(
'delete'),
'deleteTableviews');
169 $conf->setCancel($this->
lng->txt(
'cancel'),
'show');
170 $this->tpl->setContent($conf->getHTML());
175 $has_dcl_tableview_ids = $this->
http->wrapper()->post()->has(
'dcl_tableview_ids');
176 if ($has_dcl_tableview_ids) {
177 $tableviews = $this->
http->wrapper()->post()->retrieve(
181 foreach ($tableviews as $tableview_id) {
182 ilDclTableView::find($tableview_id)->delete();
186 $this->table->sortTableViews();
187 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tableviews_deleted'),
true);
188 $this->
ctrl->redirect($this,
'show');
197 if ($delete_count >= count($this->table->getTableViews())) {
198 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_tableviews_delete_all'),
true);
199 $this->
ctrl->redirect($this,
'show');
208 $orders = $this->
http->wrapper()->post()->retrieve(
214 foreach (array_keys($orders) as $tableview_id) {
215 $tableviews[] = ilDclTableView::find($tableview_id);
217 $this->table->sortTableViews($tableviews);
218 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tableviews_order_updated'));
219 $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 ...
confirmDeleteTableviews()
Confirm deletion of multiple fields.
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.
static getTableCache(int $table_id=null)
ILIAS Refinery Factory $refinery
ILIAS UI Factory $ui_factory
static hasAccessToEditTable(int $ref_id, int $table_id)
ILIAS UI Renderer $renderer
ILIAS HTTP Services $http