ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDclTableViewEditFormGUI.php
Go to the documentation of this file.
1<?php
2
9{
10
14 protected $tableview;
18 protected $table;
22 protected $lng;
26 protected $ctrl;
30 protected $parent_gui;
31
32
34 {
35 global $DIC;
36 $lng = $DIC['lng'];
37 $ilCtrl = $DIC['ilCtrl'];
39 $this->lng = $lng;
40 $this->ctrl = $ilCtrl;
41 $this->parent_gui = $parent_gui;
42 $this->tableview = $tableview;
43 $this->table = $table;
44 $this->ctrl->saveParameterByClass('ilDclTableViewGUI', 'tableview_id');
45 $this->initForm();
46 }
47
48
49 protected function initForm()
50 {
51 global $DIC;
52 $rbacreview = $DIC['rbacreview'];
53
54 $this->setTitle($this->tableview->getId() ? $this->lng->txt('dcl_view_settings') : $this->lng->txt('dcl_tableview_add'));
55
56 //title
57 $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
58 $item->setValue($this->tableview->getTitle());
59 $item->setRequired(true);
60 $this->addItem($item);
61
62 //description
63 $item = new ilTextInputGUI($this->lng->txt('description'), 'description');
64 $item->setValue($this->tableview->getDescription());
65 $this->addItem($item);
66
67 //roles
68 $checkbox_group_input_gui = new ilCheckboxGroupInputGUI($this->lng->txt('roles'), 'roles');
69
70 foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
71 $option = new ilCheckboxOption(ilObjRole::_getTranslation($role_array['title'], $role_array['obj_id']));
72 $option->setValue($role_array['obj_id']);
73 $checkbox_group_input_gui->addOption($option);
74 }
75
76 $checkbox_group_input_gui->setValue($this->tableview->getRoles());
77 $this->addItem($checkbox_group_input_gui);
78
79 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
80 if ($this->tableview->getId()) {
81 $this->addCommandButton('update', $this->lng->txt('save'));
82 } else {
83 $this->addCommandButton('create', $this->lng->txt('create'));
84 }
85 $this->addCommandButton('cancel', $this->lng->txt('cancel'));
86 }
87
88
89 public function updateTableView()
90 {
91 $this->tableview->setTitle($this->getInput('title'));
92 $this->tableview->setDescription($this->getInput('description'));
93 $this->tableview->setRoles((array) $this->getInput('roles'));
94 $this->tableview->update();
95
96 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_updated'), true);
97 }
98
99
100 public function createTableView()
101 {
102 $this->tableview->setTitle($this->getInput('title'));
103 $this->tableview->setDescription($this->getInput('description'));
104 $this->tableview->setRoles((array) $this->getInput('roles'));
105 $this->tableview->setTableId($this->table->getId());
106 $this->tableview->setStepVs(true);
107 $this->tableview->setStepE(false);
108 $this->tableview->setStepC(false);
109 $this->tableview->setStepO(false);
110 $this->tableview->setStepS(false);
111 $this->tableview->setOrder($this->table->getNewTableviewOrder());
112 $this->tableview->create();
113
114 $this->ctrl->setParameterByClass('ilDclTableViewGUI', 'tableview_id', $this->tableview->getId());
115
116 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_created'), true);
117 }
118}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a property in a property form.
This class represents an option in a checkbox group.
Class ilDclTableViewEditFormGUI.
__construct(ilDclTableViewEditGUI $parent_gui, ilDclTableView $tableview, ilDclTable $table=null)
Class ilDclTableViewEditGUI.
Class ilDclTableView.
Class ilDclBaseFieldModel.
setFormAction($a_formaction)
Set FormAction.
static _getTranslation($a_role_title)
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
setTitle($a_title)
Set Title.
This class represents a text property in a property form.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc