ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclFieldListTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
18{
19
23 protected $table;
24
30 public function __construct(ilDclFieldListGUI $a_parent_obj, $a_parent_cmd, $table_id)
31 {
32 global $DIC;
33 $lng = $DIC['lng'];
34 $ilCtrl = $DIC['ilCtrl'];
35
36 parent::__construct($a_parent_obj, $a_parent_cmd);
37
38 $this->parent_obj = $a_parent_obj;
39 $this->table = ilDclCache::getTableCache($table_id);
40
41 $this->setId('dcl_field_list');
42 $this->addColumn('', '', '1', true);
43 $this->addColumn($lng->txt('dcl_order'), null, '30px');
44 $this->addColumn($lng->txt('dcl_fieldtitle'), null, 'auto');
45 $this->addColumn($lng->txt('dcl_locked'), null, '30px', false, "", $lng->txt('dcl_locked_tooltip'));
46 $this->addColumn($lng->txt('dcl_in_export'), null, '30px');
47 $this->addColumn($lng->txt('dcl_description'), null, 'auto');
48 $this->addColumn($lng->txt('dcl_field_datatype'), null, 'auto');
49 $this->addColumn($lng->txt('dcl_required'), null, 'auto');
50 $this->addColumn($lng->txt('dcl_unique'), null, 'auto');
51 $this->addColumn($lng->txt('actions'), null, '30px');
52 // Only add mutli command for custom fields
53 if (count($this->table->getRecordFields())) {
54 $this->setSelectAllCheckbox('dcl_field_ids[]');
55 $this->addMultiCommand('confirmDeleteFields', $lng->txt('dcl_delete_fields'));
56 }
57
58 $ilCtrl->setParameterByClass('ildclfieldeditgui', 'table_id', $this->parent_obj->table_id);
59 $ilCtrl->setParameterByClass('ildclfieldlistgui', 'table_id', $this->parent_obj->table_id);
60
61 $this->setFormAction($ilCtrl->getFormActionByClass('ildclfieldlistgui'));
62 $this->addCommandButton('save', $lng->txt('dcl_save'));
63
64 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
65 $this->setFormName('field_list');
66
67 //those two are important as we get our data as objects not as arrays.
68 $this->setExternalSegmentation(true);
69 $this->setExternalSorting(true);
70
71 $this->setTopCommands(true);
72 $this->setEnableHeader(true);
73 $this->setShowRowsSelector(false);
74 $this->setShowTemplates(false);
75 $this->setEnableHeader(true);
76 $this->setEnableTitle(true);
77 $this->setDefaultOrderDirection('asc');
78
79 $this->setTitle($lng->txt('dcl_table_list_fields'));
80 $this->setRowTemplate('tpl.field_list_row.html', 'Modules/DataCollection');
81 $this->setStyle('table', $this->getStyle('table') . ' ' . 'dcl_record_list');
82
83 $this->setData($this->table->getFields());
84 }
85
86
90 public function fillRow($a_set)
91 {
92 global $DIC;
93 $lng = $DIC['lng'];
94 $ilCtrl = $DIC['ilCtrl'];
95
96 if (!$a_set->isStandardField()) {
97 $this->tpl->setVariable('FIELD_ID', $a_set->getId());
98 }
99
100 $this->tpl->setVariable('NAME', 'order[' . $a_set->getId() . ']');
101 $this->tpl->setVariable('VALUE', $this->order);
102
103 /* Don't enable setting filter for MOB fields or reference fields that reference a MOB field */
104 $show_exportable = true;
105
106 if ($a_set->getId() == 'comments') {
107 $show_exportable = false;
108 }
109
110 if ($show_exportable) {
111 $this->tpl->setVariable('CHECKBOX_EXPORTABLE', 'exportable[' . $a_set->getId() . ']');
112 if ($a_set->getExportable()) {
113 $this->tpl->setVariable('CHECKBOX_EXPORTABLE_CHECKED', 'checked');
114 }
115 } else {
116 $this->tpl->setVariable('NO_FILTER_EXPORTABLE', '');
117 }
118
119 if (!$a_set->isStandardField()) {
120 $this->tpl->setVariable('CHECKBOX_NAME_LOCKED', 'locked[' . $a_set->getId() . ']');
121 if ($a_set->getLocked()) {
122 $this->tpl->setVariable('CHECKBOX_CHECKED_LOCKED', 'checked');
123 }
124 } else {
125 $this->tpl->setVariable('NOT_LOCKED', '');
126 }
127
128 $this->order = $this->order + 10;
129 $this->tpl->setVariable('ORDER_NAME', 'order[' . $a_set->getId() . ']');
130 $this->tpl->setVariable('ORDER_VALUE', $this->order);
131
132 $this->tpl->setVariable('TITLE', $a_set->getTitle());
133 $this->tpl->setVariable('DESCRIPTION', $a_set->getDescription());
134 $this->tpl->setVariable('DATATYPE', $a_set->getDatatypeTitle());
135
136 if (!$a_set->isStandardField()) {
137 switch ($a_set->getRequired()) {
138 case 0:
139 $required = ilUtil::getImagePath('icon_not_ok.svg');
140 break;
141 case 1:
142 $required = ilUtil::getImagePath('icon_ok.svg');
143 break;
144 }
145 switch ($a_set->isUnique()) {
146 case 0:
147 $uniq = ilUtil::getImagePath('icon_not_ok.svg');
148 break;
149 case 1:
150 $uniq = ilUtil::getImagePath('icon_ok.svg');
151 break;
152 }
153 $this->tpl->setVariable('REQUIRED', $required);
154 $this->tpl->setVariable('UNIQUE', $uniq);
155 } else {
156 $this->tpl->setVariable('NO_REQUIRED', '');
157 $this->tpl->setVariable('NO_UNIQUE', '');
158 }
159
160 $ilCtrl->setParameterByClass('ildclfieldeditgui', 'field_id', $a_set->getId());
161
162 if (!$a_set->isStandardField()) {
163 include_once('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
164 $alist = new ilAdvancedSelectionListGUI();
165 $alist->setId($a_set->getId());
166 $alist->setListTitle($lng->txt('actions'));
167
168 if (ilObjDataCollectionAccess::hasAccessToFields($this->parent_obj->getDataCollectionObject()->ref_id, $this->table->getId())) {
169 $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass('ildclfieldeditgui', 'edit'));
170 $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass('ildclfieldeditgui', 'confirmDelete'));
171 }
172
173 $this->tpl->setVariable('ACTIONS', $alist->getHTML());
174 }
175 }
176}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getTableCache($table_id=0)
Class ilDclFieldListTableGUI.
__construct(ilDclFieldListGUI $a_parent_obj, $a_parent_cmd, $table_id)
static hasAccessToFields($ref_id, $table_id)
Class ilTable2GUI.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
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.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
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.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setShowTemplates($a_value)
Toggle templates.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
getStyle($a_element)
setStyle($a_element, $a_style)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7