ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
5
19{
20
24 protected $table;
25
31 public function __construct(ilDclFieldListGUI $a_parent_obj, $a_parent_cmd, $table_id)
32 {
33 global $DIC;
34 $lng = $DIC['lng'];
35 $ilCtrl = $DIC['ilCtrl'];
36
37 parent::__construct($a_parent_obj, $a_parent_cmd);
38
39 $this->parent_obj = $a_parent_obj;
40 $this->table = ilDclCache::getTableCache($table_id);
41
42 $this->setId('dcl_field_list');
43 $this->addColumn('', '', '1', true);
44 $this->addColumn($lng->txt('dcl_order'), null, '30px');
45 $this->addColumn($lng->txt('dcl_fieldtitle'), null, 'auto');
46 $this->addColumn($lng->txt('dcl_locked'), null, '30px', false, "", $lng->txt('dcl_locked_tooltip'));
47 $this->addColumn($lng->txt('dcl_in_export'), null, '30px');
48 $this->addColumn($lng->txt('dcl_description'), null, 'auto');
49 $this->addColumn($lng->txt('dcl_field_datatype'), null, 'auto');
50 $this->addColumn($lng->txt('dcl_required'), null, 'auto');
51 $this->addColumn($lng->txt('dcl_unique'), null, 'auto');
52 $this->addColumn($lng->txt('actions'), null, '30px');
53 // Only add mutli command for custom fields
54 if (count($this->table->getRecordFields())) {
55 $this->setSelectAllCheckbox('dcl_field_ids[]');
56 $this->addMultiCommand('confirmDeleteFields', $lng->txt('dcl_delete_fields'));
57 }
58
59 $ilCtrl->setParameterByClass('ildclfieldeditgui', 'table_id', $this->parent_obj->table_id);
60 $ilCtrl->setParameterByClass('ildclfieldlistgui', 'table_id', $this->parent_obj->table_id);
61
62 $this->setFormAction($ilCtrl->getFormActionByClass('ildclfieldlistgui'));
63 $this->addCommandButton('save', $lng->txt('dcl_save'));
64
65 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
66 $this->setFormName('field_list');
67
68 //those two are important as we get our data as objects not as arrays.
69 $this->setExternalSegmentation(true);
70 $this->setExternalSorting(true);
71
72 $this->setTopCommands(true);
73 $this->setEnableHeader(true);
74 $this->setShowRowsSelector(false);
75 $this->setShowTemplates(false);
76 $this->setEnableHeader(true);
77 $this->setEnableTitle(true);
78 $this->setDefaultOrderDirection('asc');
79
80 $this->setTitle($lng->txt('dcl_table_list_fields'));
81 $this->setRowTemplate('tpl.field_list_row.html', 'Modules/DataCollection');
82 $this->setStyle('table', $this->getStyle('table') . ' ' . 'dcl_record_list');
83
84 $this->setData($this->table->getFields());
85 }
86
87
91 public function fillRow($a_set)
92 {
93 global $DIC;
94 $lng = $DIC['lng'];
95 $ilCtrl = $DIC['ilCtrl'];
96
97 if (!$a_set->isStandardField()) {
98 $this->tpl->setVariable('FIELD_ID', $a_set->getId());
99 }
100
101 $this->tpl->setVariable('NAME', 'order[' . $a_set->getId() . ']');
102 $this->tpl->setVariable('VALUE', $this->order);
103
104 /* Don't enable setting filter for MOB fields or reference fields that reference a MOB field */
105 $show_exportable = true;
106
107 if ($a_set->getId() == 'comments') {
108 $show_exportable = false;
109 }
110
111 if ($show_exportable) {
112 $this->tpl->setVariable('CHECKBOX_EXPORTABLE', 'exportable[' . $a_set->getId() . ']');
113 if ($a_set->getExportable()) {
114 $this->tpl->setVariable('CHECKBOX_EXPORTABLE_CHECKED', 'checked');
115 }
116 } else {
117 $this->tpl->setVariable('NO_FILTER_EXPORTABLE', '');
118 }
119
120 if (!$a_set->isStandardField()) {
121 $this->tpl->setVariable('CHECKBOX_NAME_LOCKED', 'locked[' . $a_set->getId() . ']');
122 if ($a_set->getLocked()) {
123 $this->tpl->setVariable('CHECKBOX_CHECKED_LOCKED', 'checked');
124 }
125 } else {
126 $this->tpl->setVariable('NOT_LOCKED', '');
127 }
128
129 $this->order = $this->order + 10;
130 $this->tpl->setVariable('ORDER_NAME', 'order[' . $a_set->getId() . ']');
131 $this->tpl->setVariable('ORDER_VALUE', $this->order);
132
133 $this->tpl->setVariable('TITLE', $a_set->getTitle());
134 $this->tpl->setVariable('DESCRIPTION', $a_set->getDescription());
135 $this->tpl->setVariable('DATATYPE', $a_set->getDatatypeTitle());
136
137 if (!$a_set->isStandardField()) {
138 switch ($a_set->getRequired()) {
139 case 0:
140 $required = ilUtil::getImagePath('icon_not_ok.svg');
141 break;
142 case 1:
143 $required = ilUtil::getImagePath('icon_ok.svg');
144 break;
145 }
146 switch ($a_set->isUnique()) {
147 case 0:
148 $uniq = ilUtil::getImagePath('icon_not_ok.svg');
149 break;
150 case 1:
151 $uniq = ilUtil::getImagePath('icon_ok.svg');
152 break;
153 }
154 $this->tpl->setVariable('REQUIRED', $required);
155 $this->tpl->setVariable('UNIQUE', $uniq);
156 } else {
157 $this->tpl->setVariable('NO_REQUIRED', '');
158 $this->tpl->setVariable('NO_UNIQUE', '');
159 }
160
161 $ilCtrl->setParameterByClass('ildclfieldeditgui', 'field_id', $a_set->getId());
162
163 if (!$a_set->isStandardField()) {
164 include_once('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
165 $alist = new ilAdvancedSelectionListGUI();
166 $alist->setId($a_set->getId());
167 $alist->setListTitle($lng->txt('actions'));
168
169 if (ilObjDataCollectionAccess::hasAccessToFields($this->parent_obj->getDataCollectionObject()->ref_id, $this->table->getId())) {
170 $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass('ildclfieldeditgui', 'edit'));
171 $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass('ildclfieldeditgui', 'confirmDelete'));
172 }
173
174 $this->tpl->setVariable('ACTIONS', $alist->getHTML());
175 }
176 }
177}
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.
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.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all 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