ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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'];
38  parent::__construct();
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;
55  $rbacreview = $DIC['rbacreview'];
56 
57  $this->setTitle($this->tableview->getId() ? $this->lng->txt('settings') : $this->lng->txt('dcl_tableview_add'));
58 
59  //title
60  $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
61  $item->setValue($this->tableview->getTitle());
62  $item->setRequired(true);
63  $this->addItem($item);
64 
65  //description
66  $item = new ilTextInputGUI($this->lng->txt('description'), 'description');
67  $item->setValue($this->tableview->getDescription());
68  $this->addItem($item);
69 
70  //roles
71  $checkbox_group_input_gui = new ilCheckboxGroupInputGUI($this->lng->txt('roles'), 'roles');
72 
73  foreach ($rbacreview->getParentRoleIds($_GET['ref_id']) as $role_array) {
74  $option = new ilCheckboxOption(ilObjRole::_getTranslation($role_array['title'], $role_array['obj_id']));
75  $option->setValue($role_array['obj_id']);
76  $checkbox_group_input_gui->addOption($option);
77  }
78 
79  $checkbox_group_input_gui->setValue($this->tableview->getRoles());
80  $this->addItem($checkbox_group_input_gui);
81 
82  $this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
83  if ($this->tableview->getId()) {
84  $this->addCommandButton('update', $this->lng->txt('save'));
85  } else {
86  $this->addCommandButton('create', $this->lng->txt('create'));
87  }
88  $this->addCommandButton('cancel', $this->lng->txt('cancel'));
89  }
90 
91 
92  public function updateTableView()
93  {
94  $this->tableview->setTitle($this->getInput('title'));
95  $this->tableview->setDescription($this->getInput('description'));
96  $this->tableview->setRoles((array) $this->getInput('roles'));
97  $this->tableview->update();
98 
99  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_updated'), true);
100  }
101 
102 
103  public function createTableView()
104  {
105  $this->tableview->setTitle($this->getInput('title'));
106  $this->tableview->setDescription($this->getInput('description'));
107  $this->tableview->setRoles((array) $this->getInput('roles'));
108  $this->tableview->setTableId($this->table->getId());
109  $this->tableview->setOrder($this->table->getNewTableviewOrder());
110  $this->tableview->create();
111 
112  $this->ctrl->setParameterByClass('ilDclTableViewGUI', 'tableview_id', $this->tableview->getId());
113 
114  ilUtil::sendSuccess($this->lng->txt('dcl_msg_tableview_created'), true);
115  }
116 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilDclTableViewEditGUI.
This class represents an option in a checkbox group.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
__construct(ilDclTableViewEditGUI $parent_gui, ilDclTableView $tableview, ilDclTable $table=null)
Class ilDclTableViewEditFormGUI.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
Class ilDclBaseFieldModel.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
Class ilDclTableView.
This class represents a text property in a property form.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
This class represents a property in a property form.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static _getTranslation($a_role_title)
Create styles array
The data for the language used.
setValue($a_value)
Set Value.