ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclEditViewTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected ilLanguage $lng;
24 protected ilCtrl $ctrl;
25
26 public function __construct(ilDclEditViewDefinitionGUI $a_parent_obj)
27 {
28 parent::__construct($a_parent_obj);
29
30 $this->setId('dcl_tableviews');
31 $this->setTitle($this->lng->txt('dcl_tableview_fieldsettings'));
32 $this->addColumn($this->lng->txt('dcl_tableview_fieldtitle'), "", 'auto');
33 $this->addColumn($this->lng->txt('dcl_tableview_field_access'), "", 'auto');
34
35 $this->ctrl->saveParameter($this, 'tableview_id');
36 $this->setFormAction($this->ctrl->getFormActionByClass('ildcleditviewdefinitiongui'));
37 $this->addCommandButton('saveTable', $this->lng->txt('save'));
38
39 $this->setExternalSegmentation(true);
40 $this->setExternalSorting(true);
41
42 $this->setRowTemplate('tpl.tableview_edit_view.html', 'components/ILIAS/DataCollection');
43 $this->setTopCommands(true);
44 $this->setEnableHeader(true);
45 $this->setShowRowsSelector(false);
46 $this->setEnableHeader(true);
47 $this->setEnableTitle(true);
48 $this->setDefaultOrderDirection('asc');
49
50 $this->parseData($a_parent_obj->tableview->getFieldSettings());
51 }
52
53 public function parseData($data)
54 {
55 $this->setData($data);
56 }
57
61 public function getHTML(): string
62 {
64 $ilCtrl = $this->ctrl;
65
66 if ($this->getExportMode()) {
67 $this->exportData($this->getExportMode(), true);
68 }
69
70 $this->prepareOutput();
71
72 if (is_object($this->getParentObject()) && $this->getId() == "") {
73 $ilCtrl->saveParameter($this->getParentObject(), $this->getNavParameter());
74 }
75
76 if (!$this->getPrintMode()) {
77 // set form action
78 if ($this->form_action != "" && $this->getOpenFormTag()) {
79 $hash = "";
80
81 if ($this->form_multipart) {
82 $this->tpl->touchBlock("form_multipart_bl");
83 }
84
85 if ($this->getPreventDoubleSubmission()) {
86 $this->tpl->touchBlock("pdfs");
87 }
88
89 $this->tpl->setCurrentBlock("tbl_form_header");
90 $this->tpl->setVariable("FORMACTION", $this->getFormAction() . $hash);
91 $this->tpl->setVariable("FORMNAME", $this->getFormName());
92 $this->tpl->parseCurrentBlock();
93 }
94
95 if ($this->form_action != "" && $this->getCloseFormTag()) {
96 $this->tpl->touchBlock("tbl_form_footer");
97 }
98 }
99
100 if (!$this->enabled['content']) {
101 return $this->render();
102 }
103
104 if (!$this->getExternalSegmentation()) {
105 $this->setMaxCount(count($this->row_data));
106 }
107
109
110 $this->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
111
112 $data = $this->getData();
113 if ($this->dataExists()) {
114 // sort
115 if (!$this->getExternalSorting() && $this->enabled["sort"]) {
117 $data,
118 $this->getOrderField(),
119 $this->getOrderDirection(),
120 $this->numericOrdering($this->getOrderField())
121 );
122 }
123
124 // slice
125 if (!$this->getExternalSegmentation()) {
126 $data = array_slice($data, $this->getOffset(), $this->getLimit());
127 }
128 }
129
130 // fill rows
131 if ($this->dataExists()) {
132 if ($this->getPrintMode()) {
134 }
135
136 $this->tpl->addBlockFile(
137 "TBL_CONTENT",
138 "tbl_content",
139 $this->row_template,
140 $this->row_template_dir
141 );
142
143 foreach ($data as $set) {
144 $this->tpl->setCurrentBlock("tbl_content");
145 $this->css_row = ($this->css_row !== "tblrow1")
146 ? "tblrow1"
147 : "tblrow2";
148 $this->tpl->setVariable("CSS_ROW", $this->css_row);
149
150 $this->fillRowFromObject($set);
151 $this->tpl->setCurrentBlock("tbl_content");
152 $this->tpl->parseCurrentBlock();
153 }
154 } else {
155 // add standard no items text (please tell me, if it messes something up, alex, 29.8.2008)
156 $no_items_text = (trim($this->getNoEntriesText()) != '')
157 ? $this->getNoEntriesText()
158 : $lng->txt("no_items");
159
160 $this->css_row = ($this->css_row !== "tblrow1")
161 ? "tblrow1"
162 : "tblrow2";
163
164 $this->tpl->setCurrentBlock("tbl_no_entries");
165 $this->tpl->setVariable('TBL_NO_ENTRY_CSS_ROW', $this->css_row);
166 $this->tpl->setVariable('TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
167 $this->tpl->setVariable('TBL_NO_ENTRY_TEXT', trim($no_items_text));
168 $this->tpl->parseCurrentBlock();
169 }
170
171 if (!$this->getPrintMode()) {
172 $this->fillFooter();
173
174 $this->fillHiddenRow();
175
176 $this->fillActionRow();
177
178 $this->storeNavParameter();
179 }
180
181 return $this->render();
182 }
183
184 public function fillRowFromObject(object $a_set): void
185 {
186 global $DIC;
187 $lng = $DIC['lng'];
188 $field = $a_set->getFieldObject();
189
190 if (!$field->isStandardField() || $field->getId() === 'owner') {
191 $this->tpl->setVariable('TEXT_VISIBLE', $lng->txt('dcl_tableview_visible'));
192 $this->tpl->setVariable('TEXT_REQUIRED_VISIBLE', $lng->txt('dcl_tableview_required_visible'));
193 $this->tpl->setVariable('TEXT_LOCKED_VISIBLE', $lng->txt('dcl_tableview_locked_visible'));
194 $this->tpl->setVariable('TEXT_NOT_VISIBLE', $lng->txt('dcl_tableview_not_visible'));
195 $this->tpl->setVariable('IS_LOCKED', $a_set->isLockedEdit() ? 'checked' : '');
196 $this->tpl->setVariable('IS_REQUIRED', $a_set->isRequiredEdit() ? 'checked' : '');
197 $this->tpl->setVariable('DEFAULT_VALUE', $a_set->getDefaultValue());
198 $this->tpl->setVariable('IS_VISIBLE', $a_set->isVisibleEdit() ? 'checked' : '');
199 $this->tpl->setVariable('IS_NOT_VISIBLE', !$a_set->isVisibleEdit() ? 'checked' : '');
200 } else {
201 $this->tpl->setVariable('HIDDEN', 'hidden');
202 }
203
204 $this->tpl->setVariable('FIELD_ID', $a_set->getField());
205 $this->tpl->setVariable('TITLE', $field->getTitle());
206 $this->tpl->parseCurrentBlock();
207 }
208}
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
Class ilCtrl provides processing control methods.
static setUseRelativeDates(bool $a_status)
set use relative dates
@ilCtrl_IsCalledBy ilDclEditViewDefinitionGUI: ilDclTableViewEditGUI
__construct(ilDclEditViewDefinitionGUI $a_parent_obj)
language handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
getFormName()
get the name of the parent form
prepareOutput()
Anything that must be done before HTML is generated.
determineOffsetAndOrder(bool $a_omit_offset=false)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setExternalSegmentation(bool $a_val)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setEnableTitle(bool $a_enabletitle)
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)
setEnableHeader(bool $a_enableheader)
numericOrdering(string $a_field)
Should this field be sorted numeric?
setTopCommands(bool $a_val)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
setData(array $a_data)
Set table data.
exportData(int $format, bool $send=false)
Export and optionally send current table data.
setMaxCount(int $a_max_count)
set max.
setFooter(string $a_style, string $a_previous="", string $a_next="")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26