ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjectCustomUserFieldsTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
30 public function __construct(object $a_parent_obj, string $a_parent_cmd)
31 {
32 parent::__construct($a_parent_obj, $a_parent_cmd);
33 $this->setFormAction($this->ctrl->getFormAction($this->getParentObject(), $this->getParentCmd()));
34
35 $this->setTitle($this->lng->txt(
36 ilObject::_lookupType($this->getParentObject()->getObjId()) .
37 '_custom_user_fields_table_title'
38 ));
39
40 $this->addColumn('', '', "1");
41 $this->addColumn($this->lng->txt('ps_cdf_name'), 'name', '30%');
42 $this->addColumn($this->lng->txt('ps_cdf_type'), 'type', '30%');
43 $this->addColumn($this->lng->txt('ps_cdf_required'), '', '20%');
44 $this->addColumn('', '', '20%');
45
46 $this->setDefaultOrderField('name');
47 $this->setDefaultOrderDirection('asc');
48
49 $this->addMultiCommand('confirmDeleteFields', $this->lng->txt('delete'));
50 $this->addCommandButton('saveFields', $this->lng->txt('save'));
51
52 $this->setSelectAllCheckbox('field_ids[]');
53
54 $this->enable('sort');
55 $this->enable('header');
56 $this->enable('numinfo');
57 $this->enable('select_all');
58
59 $this->setRowTemplate('tpl.mem_cust_user_data_table_row.html', 'components/ILIAS/Membership');
60 }
61
65 protected function fillRow(array $a_set): void
66 {
67 $this->tpl->setVariable('VAL_ID', $a_set['field_id']);
68 $this->tpl->setVariable('VAL_NAME', $a_set['name']);
69 $this->tpl->setVariable('VAL_TYPE', $a_set['type']);
70 $this->tpl->setVariable('REQUIRED_CHECKED', $a_set['required'] ? 'checked="checked"' : '');
71
72 $this->ctrl->setParameter($this->getParentObject(), 'field_id', $a_set['field_id']);
73 $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->getParentObject(), 'editField'));
74 $this->tpl->setVariable('TXT_EDIT', $this->lng->txt('edit'));
75 }
76
80 public function parse(array $a_defs): void
81 {
82 $rows = [];
83 foreach ($a_defs as $def) {
84 $rows[$def->getId()]['field_id'] = $def->getId();
85 $rows[$def->getId()]['name'] = $def->getName();
86
87 switch ($def->getType()) {
89 $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_select');
90 break;
91
93 $rows[$def->getId()]['type'] = $this->lng->txt('ps_type_text');
94 break;
95 }
96
97 $rows[$def->getId()]['required'] = $def->isRequired();
98 }
99 $this->setData($rows);
100 if (!count($rows)) {
101 $this->clearCommandButtons();
102 }
103 }
104}
@classDescription Table presentation of course/group relevant user data fields
__construct(object $a_parent_obj, string $a_parent_cmd)
Constructor.
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
enable(string $a_module_name)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc