19 declare(strict_types=1);
45 $ilCtrl = $DIC[
'ilCtrl'];
47 $ilTabs = $DIC[
'ilTabs'];
48 $locator = $DIC[
'ilLocator'];
52 $this->
ctrl = $ilCtrl;
55 $this->tabs_gui = $ilTabs;
56 $this->
help = $DIC->help();
57 $this->
http = $DIC->http();
60 $this->
ctrl->saveParameterByClass(
'ilDclTableEditGUI',
'table_id');
61 $this->
ctrl->saveParameter($this,
'tableview_id');
62 if ($this->tableview->getTitle()) {
63 $locator->addItem($this->tableview->getTitle(), $this->
ctrl->getLinkTarget($this,
'show'));
65 $this->tpl->setLocator();
70 $cmd = $this->
ctrl->getCmd(
'show');
71 $next_class = $this->
ctrl->getNextClass($this);
77 $this->tabs_gui->clearTargets();
78 $this->tabs_gui->clearSubTabs();
79 $this->tabs_gui->setBackTarget(
80 $this->
lng->txt(
'dcl_tableviews'),
81 $this->
ctrl->getLinkTarget($this->parent_obj)
83 $this->tabs_gui->setBack2Target(
84 $this->
lng->txt(
'dcl_tables'),
85 $this->
ctrl->getLinkTarget($this->parent_obj->getParentObj())
88 switch ($next_class) {
89 case 'ildcldetailedviewdefinitiongui':
90 $this->
help->setSubScreenId(
'detailed_view');
91 $this->
setTabs(
'detailed_view');
93 $ret = $this->
ctrl->forwardCommand($recordedit_gui);
95 $this->tpl->setContent($ret);
98 case 'ildclcreateviewdefinitiongui':
99 $this->
help->setSubScreenId(
'record_create');
102 $this->
ctrl->forwardCommand($creation_gui);
104 case 'ildcleditviewdefinitiongui':
105 $this->
help->setSubScreenId(
'record_edit');
108 $this->
ctrl->forwardCommand($edit_gui);
113 if ($this->tableview->getId()) {
114 $this->
ctrl->redirect($this,
'editGeneralSettings');
116 $this->
ctrl->redirect($this,
'add');
120 $this->
help->setSubScreenId(
'create');
122 $this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
124 case 'editGeneralSettings':
125 $this->
help->setSubScreenId(
'edit');
126 $this->
setTabs(
'general_settings');
128 $this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
130 case 'editFieldSettings':
131 $this->
help->setSubScreenId(
'overview');
132 $this->
setTabs(
'field_settings');
134 $this->tpl->setContent($this->table_gui->getHTML());
144 protected function setTabs(
string $active): void
146 $this->tabs_gui->addTab(
148 $this->
lng->txt(
'dcl_view_settings'),
149 $this->
ctrl->getLinkTarget($this,
'editGeneralSettings')
151 $this->tabs_gui->addTab(
153 $this->
lng->txt(
'dcl_create_entry_rules'),
154 $this->
ctrl->getLinkTargetByClass(
'ilDclCreateViewDefinitionGUI',
'presentation')
156 $this->tabs_gui->addTab(
158 $this->
lng->txt(
'dcl_edit_entry_rules'),
159 $this->
ctrl->getLinkTargetByClass(
'ilDclEditViewDefinitionGUI',
'presentation')
161 $this->tabs_gui->addTab(
163 $this->
lng->txt(
'dcl_list_visibility_and_filter'),
164 $this->
ctrl->getLinkTarget($this,
'editFieldSettings')
166 $this->tabs_gui->addTab(
168 $this->
lng->txt(
'dcl_detailed_view'),
169 $this->
ctrl->getLinkTargetByClass(
'ilDclDetailedViewDefinitionGUI',
'edit')
171 $this->tabs_gui->setTabActive($active);
177 $ilDclTableViewEditFormGUI->setValuesByPost();
178 if ($ilDclTableViewEditFormGUI->checkInput()) {
179 $ilDclTableViewEditFormGUI->updateTableView();
180 $this->
ctrl->redirect($this,
'editGeneralSettings');
182 $this->
setTabs(
'general_settings');
183 $this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
190 $ilDclTableViewEditFormGUI->setValuesByPost();
191 if ($ilDclTableViewEditFormGUI->checkInput()) {
192 $ilDclTableViewEditFormGUI->createTableView();
193 $this->
ctrl->redirect($this,
'editGeneralSettings');
195 $this->tpl->setContent($ilDclTableViewEditFormGUI->getHTML());
199 public function saveTable():
void 204 foreach ($this->tableview->getFieldSettings() as $setting) {
206 foreach ([
"Visible",
"InFilter",
"FilterChangeable"] as $attribute) {
207 $key = $attribute .
'_' . $setting->getField();
208 if ($this->
http->wrapper()->post()->has(
$key)) {
209 $checkbox_value = $this->
http->wrapper()->post()->retrieve(
211 $this->
refinery->kindlyTo()->string()
213 $setting->{
'set' . $attribute}($checkbox_value ===
'on');
215 $setting->{
'set' . $attribute}(
false);
220 $key =
'filter_' . $setting->getField();
221 if ($this->
http->wrapper()->post()->has($key)) {
222 $setting->setFilterValue($this->
http->wrapper()->post()->retrieve(
224 $this->
refinery->kindlyTo()->string()
226 } elseif ($this->
http->wrapper()->post()->has($key .
'_from') && $this->
http->wrapper()->post()->has($key .
'_to')) {
227 $setting->setFilterValue([
"from" => $this->
http->wrapper()->post()->retrieve(
229 $this->
refinery->kindlyTo()->string()
231 "to" => $this->
http->wrapper()->post()->retrieve(
233 $this->
refinery->kindlyTo()->string()
237 $setting->setFilterValue(null);
244 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tableview_updated'),
true);
245 $this->
ctrl->saveParameter($this->parent_obj,
'tableview_id');
246 $this->
ctrl->redirect($this,
'editFieldSettings');
252 $this->table_gui =
$table;
257 $this->
ctrl->setParameter($this->parent_obj,
'table_id', $this->table->getId());
258 $this->
ctrl->redirect($this->parent_obj);
264 $this->parent_obj->checkViewsLeft(1);
267 $conf->setFormAction($this->
ctrl->getFormAction($this));
268 $conf->setHeaderText($this->
lng->txt(
'dcl_tableview_confirm_delete'));
270 $conf->addItem(
'tableview_id', (
string) $this->tableview->getId(), $this->tableview->getTitle());
272 $conf->setConfirm($this->
lng->txt(
'delete'),
'delete');
273 $conf->setCancel($this->
lng->txt(
'cancel'),
'cancel');
275 $this->tpl->setContent($conf->getHTML());
278 protected function delete():
void 280 $this->tableview->delete();
281 $this->table->sortTableViews();
282 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'dcl_msg_tableview_deleted'),
true);
288 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
289 $this->
ctrl->redirectByClass(
290 [ilObjDataCollectionGUI::class, ilDclRecordListGUI::class],
297 if (in_array($cmd, [
'add',
'create',
'cancel'])) {
299 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
300 $this->table->getId()
303 return ilObjDataCollectionAccess::hasAccessTo(
304 $this->parent_obj->getParentObj()->getDataCollectionObject()->getRefId(),
305 $this->table->getId(),
306 $this->tableview->getId()
314 $new_tableview->setTableId($this->table->getId());
315 $new_tableview->cloneStructure($this->tableview, []);
316 $this->table->sortTableViews();
317 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"dcl_tableview_copy"),
true);
ilDclTableViewEditGUI: ilDclDetailedViewDefinitionGUI ilDclTableViewEditGUI: ilDclCreateViewDefiniti...
ILIAS HTTP Services $http
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilDclTableViewGUI $parent_obj, ilDclTable $table, ilDclTableView $tableview)
ilDclTableViewGUI: ilDclTableViewEditGUI
ilDclCreateViewDefinitionGUI: ilDclTableViewEditGUI
ilDclTableViewGUI $parent_obj
ilDclEditViewDefinitionGUI: ilDclTableViewEditGUI
ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector ilDcl...
ilDclTableViewEditFieldsTableGUI $table_gui
static http()
Fetches the global http state from ILIAS.
ILIAS Refinery Factory $refinery
ilGlobalPageTemplate $tpl
static hasAccessToEditTable(int $ref_id, int $table_id)
ilDclTableView $tableview