ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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;
52  $rbacreview = $DIC['rbacreview'];
53 
54  $this->setTitle($this->tableview->getId() ? $this->lng->txt('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->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 }
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)
setValue($a_value)
Set Value.