19 declare(strict_types=1);
40 $this->
http = $DIC->http();
42 $this->table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
43 $locator = $DIC[
'ilLocator'];
44 $this->parent_obj = $a_parent_obj;
45 $this->obj_id = $a_parent_obj->
getObjId();
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->ui_factory = $DIC->ui()->factory();
52 $this->
renderer = $DIC->ui()->renderer();
54 $DIC->help()->setScreenId(
'dcl_fields');
56 $this->
ctrl->saveParameterByClass(ilDclTableEditGUI::class,
'table_id');
59 $this->
ctrl->getLinkTargetByClass(ilDclTableEditGUI::class,
'edit')
61 $this->tpl->setLocator();
64 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
65 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'listRecords');
79 $cmd = $this->
ctrl->getCmd(
'listFields');
88 if ($this->
http->wrapper()->post()->has(
'dcl_field_ids')) {
89 $field_ids = $this->
http->wrapper()->post()->retrieve(
94 foreach ($field_ids as $field_id) {
95 $table->deleteField($field_id);
99 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_fields_deleted'),
true);
100 $this->
ctrl->redirect($this,
'listFields');
106 public function confirmDeleteFields():
void 108 $this->
tabs->clearSubTabs();
110 $conf->setFormAction($this->
ctrl->getFormAction($this));
111 $conf->setHeaderText($this->
lng->txt(
'dcl_confirm_delete_fields'));
113 $has_field_ids = $this->
http->wrapper()->post()->has(
'dcl_field_ids');
114 if (!$has_field_ids) {
115 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_delete_fields_no_selection'),
true);
116 $this->
ctrl->redirect($this,
'listFields');
119 $field_ids = $this->
http->wrapper()->post()->retrieve(
123 foreach ($field_ids as $field_id) {
126 $conf->addItem(
'dcl_field_ids[]', (
string) $field_id, $field->getTitle());
129 $conf->setConfirm($this->
lng->txt(
'delete'),
'deleteFields');
130 $conf->setCancel($this->
lng->txt(
'cancel'),
'listFields');
131 $this->tpl->setContent($conf->getHTML());
139 $table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
142 $fields = $table->getFields();
144 $order = $this->
http->wrapper()->post()->retrieve(
150 foreach (array_keys($order) as $field_id) {
151 $order[$field_id] = $val;
156 if ($this->
http->wrapper()->post()->has(
"exportable")) {
157 $exportable = $this->
http->wrapper()->post()->retrieve(
159 $this->
refinery->kindlyTo()->dictOf(
160 $this->
refinery->kindlyTo()->string()
165 foreach ($fields as $field) {
166 $field->setExportable(array_key_exists($field->getId(), $exportable) && $exportable[$field->getId()] ===
"on");
167 $field->setOrder($order[$field->getId()]);
171 $table->reloadFields();
172 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"dcl_table_settings_saved"));
182 $add_new = $this->ui_factory->button()->primary(
183 $this->
lng->txt(
"dcl_add_new_field"),
184 $this->
ctrl->getLinkTargetByClass(ilDclFieldEditGUI::class,
'create')
186 $this->
toolbar->addStickyItem($add_new);
189 $switcher->addTableSwitcherToToolbar(
190 $this->parent_obj->getDataCollectionObject()->getTables(),
197 $this->tpl->setContent($list->getHTML());
209 return $this->parent_obj->getDataCollectionObject();
ILIAS HTTP Services $http
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getFieldCache(int $field_id=0)
ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI ...
ilGlobalTemplateInterface $tpl
getDataCollectionObject()
static http()
Fetches the global http state from ILIAS.
deleteFields()
Delete multiple fields.
static getTableCache(?int $table_id=null)
ILIAS UI Factory $ui_factory
executeCommand()
execute command
ilDclTableListGUI $parent_obj
static hasAccessToEditTable(int $ref_id, int $table_id)
ILIAS Refinery Factory $refinery
ILIAS UI Renderer $renderer
__construct(ilDclTableListGUI $a_parent_obj)