ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjectCustomUserFieldsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
17  public function __construct($a_parent_obj, $a_parent_cmd)
18  {
19  global $DIC;
20 
21  $ilCtrl = $DIC['ilCtrl'];
22  $lng = $DIC['lng'];
23 
24  $this->ctrl = $ilCtrl;
25  $this->lng = $lng;
26 
27  parent::__construct($a_parent_obj, $a_parent_cmd);
28 
29  $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
30 
31  $this->setTitle($this->lng->txt(ilObject::_lookupType($this->getParentObject()->getObjId()) . '_custom_user_fields'));
32 
33  $this->addColumn('', '', 1);
34  $this->addColumn($this->lng->txt('ps_cdf_name'), 'name', '30%');
35  $this->addColumn($this->lng->txt('ps_cdf_type'), 'type', '30%');
36  $this->addColumn($this->lng->txt('ps_cdf_required'), '', '20%');
37  $this->addColumn('', '', '20%');
38 
39  $this->setDefaultOrderField('name');
40  $this->setDefaultOrderDirection('asc');
41 
42  $this->addMultiCommand('confirmDeleteFields', $this->lng->txt('delete'));
43  $this->addCommandButton('saveFields', $this->lng->txt('save'));
44 
45  $this->setSelectAllCheckbox('field_ids[]');
46 
47  $this->enable('sort');
48  $this->enable('header');
49  $this->enable('numinfo');
50  $this->enable('select_all');
51 
52  $this->setRowTemplate('tpl.mem_cust_user_data_table_row.html', 'Services/Membership');
53  }
54 
60  public function fillRow($row)
61  {
62  $this->tpl->setVariable('VAL_ID', $row['field_id']);
63  $this->tpl->setVariable('VAL_NAME', $row['name']);
64  $this->tpl->setVariable('VAL_TYPE', $row['type']);
65  $this->tpl->setVariable('REQUIRED_CHECKED', $row['required'] ? 'checked="checked"' : '');
66 
67  $this->ctrl->setParameter($this->getParentObject(), 'field_id', $row['field_id']);
68  $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editField'));
69  $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
70  }
71 
77  public function parse($a_defs)
78  {
79  $rows = array();
80  foreach ($a_defs as $def) {
81  $rows[$def->getId()]['field_id'] = $def->getId();
82  $rows[$def->getId()]['name'] = $def->getName();
83 
84  switch ($def->getType()) {
85  case IL_CDF_TYPE_SELECT:
86  $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_select');
87  break;
88 
89  case IL_CDF_TYPE_TEXT:
90  $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_text');
91  break;
92  }
93 
94  $rows[$def->getId()]['required'] = (bool) $def->isRequired();
95  }
96  $this->setData($rows);
97  if (!sizeof($rows)) {
98  $this->clearCommandButtons();
99  }
100  }
101 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
__construct($a_parent_obj, $a_parent_cmd)
Constructor.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
global $DIC
Definition: saml.php:7
getParentCmd()
Get parent command.
getParentObject()
Get parent object.
Table presentation of course/group relevant user data fields
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
$row
$rows
Definition: xhr_table.php:10
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
$def
Definition: croninfo.php:21