ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilDclTableViewEditFormGUI.php
Go to the documentation of this file.
1<?php
2
20{
22 protected ?ilDclTable $table = null;
24
26 {
27 global $DIC;
28 $lng = $DIC['lng'];
29 $ilCtrl = $DIC['ilCtrl'];
31 $this->lng = $lng;
32 $this->ctrl = $ilCtrl;
33 $this->parent_gui = $parent_gui;
34 $this->tableview = $tableview;
35 $this->table = $table;
36 $this->ctrl->saveParameterByClass('ilDclTableViewGUI', 'tableview_id');
37 $this->initForm();
38 }
39
40 protected function initForm(): void
41 {
42 global $DIC;
43 $rbacreview = $DIC['rbacreview'];
44
45 $this->setTitle($this->tableview->getId() ? $this->lng->txt('dcl_view_settings') : $this->lng->txt('dcl_tableview_add'));
46
47 //title
48 $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
49 $item->setValue($this->tableview->getTitle());
50 $item->setRequired(true);
51 $this->addItem($item);
52
53 //description
54 $item = new ilTextInputGUI($this->lng->txt('description'), 'description');
55 $item->setValue($this->tableview->getDescription());
56 $this->addItem($item);
57
58 //roles
59 $checkbox_group_input_gui = new ilCheckboxGroupInputGUI($this->lng->txt('roles'), 'roles');
60
61 $ref_id = $this->http->wrapper()->query()->retrieve('ref_id', $this->refinery->kindlyTo()->int());
62 foreach ($rbacreview->getParentRoleIds($ref_id) as $role_array) {
63 $option = new ilCheckboxOption(ilObjRole::_getTranslation($role_array['title']));
64 $option->setValue($role_array['obj_id']);
65 $checkbox_group_input_gui->addOption($option);
66 }
67
68 $checkbox_group_input_gui->setValue($this->tableview->getRoles());
69 $this->addItem($checkbox_group_input_gui);
70
71 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
72 if ($this->tableview->getId()) {
73 $this->addCommandButton('update', $this->lng->txt('save'));
74 } else {
75 $this->addCommandButton('create', $this->lng->txt('create'));
76 }
77 $this->addCommandButton('cancel', $this->lng->txt('cancel'));
78 }
79
80 public function updateTableView(): void
81 {
82 $this->tableview->setTitle($this->getInput('title'));
83 $this->tableview->setDescription($this->getInput('description'));
84 $this->tableview->setRoles((array) $this->getInput('roles'));
85 $this->tableview->update();
86
87 $this->global_tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_updated'), true);
88 }
89
90 public function createTableView(): void
91 {
92 $this->tableview->setTitle($this->getInput('title'));
93 $this->tableview->setDescription($this->getInput('description'));
94 $this->tableview->setRoles((array) $this->getInput('roles'));
95 $this->tableview->setTableId($this->table->getId());
96 $this->tableview->setStepVs(true);
97 $this->tableview->setStepE(false);
98 $this->tableview->setStepC(false);
99 $this->tableview->setStepO(false);
100 $this->tableview->setStepS(false);
101 $this->tableview->setOrder($this->table->getNewTableviewOrder());
102 $this->tableview->create();
103
104 $this->ctrl->setParameterByClass('ilDclTableViewGUI', 'tableview_id', $this->tableview->getId());
105
106 $this->global_tpl->setOnScreenMessage('success', $this->lng->txt('dcl_msg_tableview_created'), true);
107 }
108}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilDclTableViewEditGUI $parent_gui, ilDclTableView $tableview, ?ilDclTable $table=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_formaction)
static _getTranslation(string $a_role_title)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
This class represents a text property in a property form.
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc