ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTableViewEditFormGUI.php
Go to the documentation of this file.
1<?php
2require_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
9
13 protected $tableview;
17 protected $table;
21 protected $lng;
25 protected $ctrl;
29 protected $parent_gui;
30
31
33 global $DIC;
34 $lng = $DIC['lng'];
35 $ilCtrl = $DIC['ilCtrl'];
36 parent::__construct();
37 $this->lng = $lng;
38 $this->ctrl = $ilCtrl;
39 $this->parent_gui = $parent_gui;
40 $this->tableview = $tableview;
41 $this->table = $table;
42 $this->ctrl->saveParameterByClass('ilDclTableViewGUI', 'tableview_id');
43 $this->initForm();
44 }
45
46
47 protected function initForm() {
48 global $DIC;
49 $rbacreview = $DIC['rbacreview'];
50
51 $this->setTitle($this->tableview->getId() ? $this->lng->txt('settings') : $this->lng->txt('dcl_tableview_add'));
52
53 //title
54 $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
55 $item->setValue($this->tableview->getTitle());
56 $item->setRequired(true);
57 $this->addItem($item);
58
59 //description
60 $item = new ilTextInputGUI($this->lng->txt('description'), 'description');
61 $item->setValue($this->tableview->getDescription());
62 $this->addItem($item);
63
64 //roles
65 $checkbox_group_input_gui = new ilCheckboxGroupInputGUI($this->lng->txt('roles'), 'roles');
66
67 foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
68 $option = new ilCheckboxOption(ilObjRole::_getTranslation($role_array['title'], $role_array['obj_id']));
69 $option->setValue($role_array['obj_id']);
70 $checkbox_group_input_gui->addOption($option);
71 }
72 foreach ($rbacreview->getLocalRoles($_GET['ref_id']) as $role_id) {
73 $option = new ilCheckboxOption(ilObjRole::_getTranslation($role->getTitle(), $role_id));
74 $option->setValue($role_id);
75 $checkbox_group_input_gui->addOption($option);
76 }
77
78 $checkbox_group_input_gui->setValue($this->tableview->getRoles());
79 $this->addItem($checkbox_group_input_gui);
80
81 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
82 if ($this->tableview->getId()) {
83 $this->addCommandButton('update', $this->lng->txt('save'));
84 } else {
85 $this->addCommandButton('create', $this->lng->txt('create'));
86 }
87 $this->addCommandButton('cancel', $this->lng->txt('cancel'));
88 }
89
90
91 public function updateTableView() {
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->update();
96
97 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_updated'), true);
98 }
99
100
101 public function createTableView() {
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->setOrder($this->table->getNewTableviewOrder());
107 $this->tableview->create();
108
109 $this->ctrl->setParameterByClass('ilDclTableViewGUI', 'tableview_id', $this->tableview->getId());
110
111 ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_created'), true);
112 }
113}
$_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.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $DIC