ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilDclCreateViewTableGUI.php
Go to the documentation of this file.
1<?php
2
9{
14 ];
15
16 public function __construct(ilDclCreateViewDefinitionGUI $a_parent_obj)
17 {
18 global $DIC;
19 $lng = $DIC['lng'];
20 $ilCtrl = $DIC['ilCtrl'];
21 parent::__construct($a_parent_obj);
22
23 $this->setId('dcl_tableviews');
24 $this->setTitle($lng->txt('dcl_tableview_fieldsettings'));
25 $this->addColumn($lng->txt('dcl_tableview_fieldtitle'), null, 'auto');
26 $this->addColumn($lng->txt('dcl_tableview_field_access'), null, 'auto');
27 $this->addColumn($lng->txt('dcl_tableview_default_value'), null, 'auto');
28
29 $ilCtrl->saveParameter($this, 'tableview_id');
30 $this->setFormAction($ilCtrl->getFormActionByClass('ildclcreateviewdefinitiongui'));
31 $this->addCommandButton('saveTable', $lng->txt('dcl_save'));
32
33 $this->setExternalSegmentation(true);
34 $this->setExternalSorting(true);
35
36 $this->setRowTemplate('tpl.tableview_create_view.html', 'Modules/DataCollection');
37 $this->setTopCommands(true);
38 $this->setEnableHeader(true);
39 $this->setShowRowsSelector(false);
40 $this->setShowTemplates(false);
41 $this->setEnableHeader(true);
42 $this->setEnableTitle(true);
43 $this->setDefaultOrderDirection('asc');
44
45 $this->parseData($a_parent_obj->tableview->getFieldSettings());
46 }
47
48
49 public function parseData($data)
50 {
51 $this->setData($data);
52 }
53
54
58 public function fillRow($a_set)
59 {
60 global $DIC;
61 $lng = $DIC['lng'];
62 $field = $a_set->getFieldObject();
63 $match = ilDclTableViewBaseDefaultValue::findSingle(intval($field->getDataTypeId()), $a_set->getId());
64
66 $item = ilDclCache::getFieldRepresentation($field)->getInputField(new ilPropertyFormGUI());
67
68 if (!is_null($match)) {
69 if ($item instanceof ilDclCheckboxInputGUI) {
70 $item->setChecked($match->getValue());
71 } else {
72 $item->setValue($match->getValue());
73 }
74 }
75
76 if (!$field->isStandardField()) {
77 $this->tpl->setVariable('TEXT_VISIBLE', $lng->txt('dcl_tableview_visible'));
78 $this->tpl->setVariable('TEXT_REQUIRED_VISIBLE', $lng->txt('dcl_tableview_required_visible'));
79 $this->tpl->setVariable('TEXT_LOCKED_VISIBLE', $lng->txt('dcl_tableview_locked_visible'));
80 $this->tpl->setVariable('TEXT_NOT_VISIBLE', $lng->txt('dcl_tableview_not_visible'));
81 $this->tpl->setVariable('IS_LOCKED', $a_set->isLockedCreate() ? 'checked' : '');
82 $this->tpl->setVariable('IS_REQUIRED', $a_set->isRequiredCreate() ? 'checked' : '');
83 $this->tpl->setVariable('DEFAULT_VALUE', $a_set->getDefaultValue());
84 $this->tpl->setVariable('IS_VISIBLE', $a_set->isVisibleCreate() ? 'checked' : '');
85 $this->tpl->setVariable('IS_NOT_VISIBLE', !$a_set->isVisibleCreate() ? 'checked' : '');
86 if (!is_null($item) && in_array($field->getDatatypeId(), self::VALID_DEFAULT_VALUE_TYPES)) {
87 $name = "default_" . $a_set->getId() . "_" . $field->getDatatypeId();
88 $item->setPostVar($name);
89 if ($item instanceof ilTextAreaInputGUI) {
90 $replacement_box = new ilTextInputGUI();
91 $replacement_box->setPostVar($item->getPostVar());
92 $replacement_box->setValue($item->getValue());
93 $this->tpl->setVariable('INPUT', $replacement_box->render());
94 } else {
95 $this->tpl->setVariable('INPUT', $item->render());
96 }
97
98 // Workaround as empty checkboxes do not get posted
99 if ($item instanceof ilDclCheckboxInputGUI) {
100 $this->tpl->setVariable('EXTRA_INPUT', "<input type=\"hidden\" name=\"$name\" value=\"0\" />");
101 }
102 }
103 } else {
104 $this->tpl->setVariable('HIDDEN', 'hidden');
105 }
106
107 $this->tpl->setVariable('FIELD_ID', $a_set->getField());
108 $this->tpl->setVariable('TITLE', $field->getTitle());
109 $this->tpl->parseCurrentBlock();
110 }
111}
An exception for terminatinating execution or to throw for unit testing.
static getFieldRepresentation(ilDclBaseFieldModel $field)
Class ilDclCheckboxInputGUI.
Class ilDclCreateViewDefinitionGUI.
Class ilDclCreateViewTableGUI.
__construct(ilDclCreateViewDefinitionGUI $a_parent_obj)
This class represents a property form user interface.
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.
fillRow($a_set)
Standard Version of Fill Row.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
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.
This class represents a text area property in a property form.
This class represents a text property in a property form.
global $DIC
Definition: goto.php:24
if($format !==null) $name
Definition: metadata.php:230
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc