ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilBiblAdminFieldTableGUI.php
Go to the documentation of this file.
1<?php
8{
9 use \ILIAS\Modules\OrgUnit\ARHelper\DIC;
10
11 const TBL_ID = 'tbl_bibl_fields';
15 protected $facade;
19 protected $parent_obj;
23 protected $filter = [];
27 protected $position_index = 1;
28
35 {
36 $this->facade = $facade;
37 $this->parent_obj = $a_parent_obj;
38
39 $this->setId(self::TBL_ID);
40 $this->setPrefix(self::TBL_ID);
41 $this->setFormName(self::TBL_ID);
42 $this->ctrl()->saveParameter($a_parent_obj, $this->getNavParameter());
43
44 parent::__construct($a_parent_obj);
45 $this->parent_obj = $a_parent_obj;
46 $this->setRowTemplate('tpl.bibl_administration_fields_list_row.html', 'Modules/Bibliographic');
47
48 $this->setFormAction($this->ctrl()->getFormAction($this->parent_obj));
49
50 $this->setExternalSorting(true);
51
52 $this->setDefaultOrderField("identifier");
53 $this->setDefaultOrderDirection("asc");
54 $this->setExternalSegmentation(true);
55 $this->setEnableHeader(true);
56
57 $this->initColumns();
58
59 if ($this->parent_obj->checkPermissionBoolAndReturn('write')) {
60 $this->addCommandButton(ilBiblAdminFieldGUI::CMD_SAVE, $this->lng()->txt("save"));
61 }
62
63 $this->addFilterItems();
64 $this->parseData();
65 }
66
67 protected function initColumns()
68 {
69 $this->addColumn($this->lng()->txt('order'));
70 $this->addColumn($this->lng()->txt('identifier'));
71 $this->addColumn($this->lng()->txt('translation'));
72 $this->addColumn($this->lng()->txt('standard'));
73 $this->addColumn($this->lng()->txt('actions'), '', '150px');
74 }
75
76 protected function addFilterItems()
77 {
78 $field = new ilTextInputGUI($this->lng()->txt('identifier'), 'identifier');
79 $this->addAndReadFilterItem($field);
80 }
81
85 protected function addAndReadFilterItem(ilFormPropertyGUI $field)
86 {
87 $this->addFilterItem($field);
88 $field->readFromSession();
89 if ($field instanceof ilCheckboxInputGUI) {
90 $this->filter[$field->getPostVar()] = $field->getChecked();
91 } else {
92 $this->filter[$field->getPostVar()] = $field->getValue();
93 }
94 }
95
100 public function fillRow($a_set)
101 {
102 $field = $this->facade->fieldFactory()->findById($a_set['id']);
103
104 $this->tpl->setVariable('FIELD_ID', $field->getId());
105 $this->tpl->setCurrentBlock("POSITION");
106 $this->tpl->setVariable('POSITION_VALUE', $this->position_index);
107 $this->tpl->parseCurrentBlock();
108
109 $this->tpl->setCurrentBlock("IDENTIFIER");
110 $this->tpl->setVariable('IDENTIFIER_VALUE', $field->getIdentifier());
111 $this->tpl->parseCurrentBlock();
112
113 $this->tpl->setCurrentBlock("TRANSLATION");
114 $this->tpl->setVariable('VAL_TRANSLATION', $this->facade->translationFactory()->translate($field));
115 $this->tpl->parseCurrentBlock();
116
117 $this->tpl->setCurrentBlock("STANDARD");
118 if ($field->getIsStandardField()) {
119 $this->tpl->setVariable('IS_STANDARD_VALUE', $this->lng()->txt('standard'));
120 } else {
121 $this->tpl->setVariable('IS_STANDARD_VALUE', $this->lng()->txt('custom'));
122 }
123
124 $this->tpl->parseCurrentBlock();
125 if ($this->parent_obj->checkPermissionBoolAndReturn('write')) {
126 $this->addActionMenu($field);
127 }
128
129 $this->position_index++;
130 }
131
135 protected function addActionMenu(ilBiblFieldInterface $field)
136 {
137 $selectionList = new ilAdvancedSelectionListGUI();
138 $selectionList->setListTitle($this->lng->txt('actions'));
139 $selectionList->setId($field->getIdentifier());
140
141 $this->ctrl()
142 ->setParameter($this->parent_obj, ilBiblAdminRisFieldGUI::FIELD_IDENTIFIER, $field->getId());
143 $this->ctrl()
144 ->setParameterByClass(ilBiblTranslationGUI::class, ilBiblAdminRisFieldGUI::FIELD_IDENTIFIER, $field->getId());
145
146 $txt = $this->lng()->txt('translate');
147 $selectionList->addItem($txt, '', $this->ctrl()
148 ->getLinkTargetByClass(ilBiblTranslationGUI::class, ilBiblTranslationGUI::CMD_DEFAULT));
149
150 $this->tpl->setVariable('VAL_ACTIONS', $selectionList->getHTML());
151 }
152
153 protected function parseData()
154 {
156 $this->determineLimit();
157
158 $q = new ilBiblTableQueryInfo();
159
160 foreach ($this->filter as $filter_key => $filter_value) {
161 switch ($filter_key) {
162 case 'identifier':
164 $filter->setFieldName($filter_key);
165 $filter->setFieldValue('%' . $filter_value . '%');
166 $filter->setOperator("LIKE");
167 $q->addFilter($filter);
168 break;
169 }
170 }
171 $q->setSortingColumn('position');
172 $q->setSortingDirection('ASC');
173
174 $data = $this->facade->fieldFactory()
175 ->filterAllFieldsForTypeAsArray($this->facade->type(), $q);
176
177 $this->setData($data);
178 }
179}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
Class ilBiblAdminFieldTableGUI.
addAndReadFilterItem(ilFormPropertyGUI $field)
fillRow($a_set)
Fills table rows with content from $a_set.
addActionMenu(ilBiblFieldInterface $field)
__construct($a_parent_obj, ilBiblAdminFactoryFacadeInterface $facade)
ilBiblAdminFieldTableGUI constructor.
Class ilBiblTableQueryInfo.
Class ilBiblTableQueryInfo.
This class represents a checkbox property in a property form.
This class represents a property in a property form.
readFromSession()
Read from session.
getPostVar()
Get Post Variable.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
getFormAction()
Get Form action parameter.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
determineLimit()
Determine the limit.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
This class represents a text property in a property form.
$txt
Definition: error.php:13
filter()
Definition: filter.php:2
Interface ilBiblEntryInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc