ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTableViewFieldsTableGUI.php
Go to the documentation of this file.
1 <?php
2 include_once('./Services/Table/classes/class.ilTable2GUI.php');
3 include_once('./Modules/DataCollection/classes/TableView/class.ilDclTableViewFieldSetting.php');
4 include_once('./Modules/DataCollection/classes/Fields/class.ilDclFieldFactory.php');
5 
13 {
14 
15  public function __construct(ilDclTableViewEditGUI $a_parent_obj)
16  {
17  global $DIC;
18  $lng = $DIC['lng'];
19  $ilCtrl = $DIC['ilCtrl'];
20  parent::__construct($a_parent_obj);
21 
22  $this->setId('dcl_tableviews');
23  $this->setTitle($lng->txt('dcl_tableview_fieldsettings'));
24  $this->addColumn($lng->txt('dcl_fieldtitle'), NULL, 'auto');
25  $this->addColumn($lng->txt('dcl_field_visible'), NULL, 'auto');
26  $this->addColumn($lng->txt('dcl_filter'), NULL, 'auto');
27  $this->addColumn($lng->txt('dcl_std_filter'), NULL, 'auto');
28  $this->addColumn($lng->txt('dcl_filter_changeable'), NULL, 'auto');
29 
30 
31  $ilCtrl->saveParameter($this, 'tableview_id');
32  $this->setFormAction($ilCtrl->getFormActionByClass('ildcltablevieweditgui'));
33  $this->addCommandButton('saveTable', $lng->txt('dcl_save'));
34 
35  $this->setExternalSegmentation(true);
36  $this->setExternalSorting(true);
37 
38  $this->setRowTemplate('tpl.tableview_fields_row.html', 'Modules/DataCollection');
39  $this->setTopCommands(true);
40  $this->setEnableHeader(true);
41  $this->setShowRowsSelector(false);
42  $this->setShowTemplates(false);
43  $this->setEnableHeader(true);
44  $this->setEnableTitle(true);
45  $this->setDefaultOrderDirection('asc');
46 
47  $this->parseData($a_parent_obj->tableview->getFieldSettings());
48  }
49 
50  public function parseData($data) {
51  //enable/disable comments
52  if (!$this->parent_obj->table->getPublicCommentsEnabled()) {
53  foreach ($data as $key => $rec) {
54  if ($rec->getField() == 'comments') {
55  unset($data[$key]);
56  }
57  }
58  }
59  $this->setData($data);
60  }
61 
65  public function fillRow($a_set)
66  {
67  $field = $a_set->getFieldObject();
68  if ($field->getId() == 'comments' && !$this->parent_obj->table->getPublicCommentsEnabled()) {
69  return;
70  }
71 
72  $this->tpl->setVariable('FIELD_TITLE', $field->getTitle());
73  $this->tpl->setVariable('ID', $a_set->getId());
74  $this->tpl->setVariable('FIELD_ID', $a_set->getField());
75  $this->tpl->setVariable('VISIBLE', $a_set->isVisible() ? 'checked' : '');
76  if ($field->allowFilterInListView())
77  {
78  $this->tpl->setVariable('IN_FILTER', $a_set->isInFilter() ? 'checked' : '');
79  $this->tpl->setVariable('FILTER_VALUE', $this->getStandardFilterHTML($field, $a_set->getFilterValue()));
80  $this->tpl->setVariable('FILTER_CHANGEABLE', $a_set->isFilterChangeable() ? 'checked' : '');
81  }
82  else
83  {
84  $this->tpl->setVariable('NO_FILTER', '');
85  }
86 
87  }
88 
95  protected function getStandardFilterHTML(ilDclBaseFieldModel $field, $value)
96  {
97  $field_representation = ilDclFieldFactory::getFieldRepresentationInstance($field);
98  $field_representation->addFilterInputFieldToTable($this);
99  $filter = end($this->filters);
100  $this->filters = null;
101  $filter->setValueByArray($value);
102  return $filter->render();
103  }
104 
105 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
Class ilDclBaseFieldModel.
setExternalSorting($a_val)
Set external sorting.
Class ilDclTableViewEditGUI.
setShowTemplates($a_value)
Toggle templates.
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
setExternalSegmentation($a_val)
Set external segmentation.
Class ilDclTableViewEditFieldsTableGUI.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
__construct(ilDclTableViewEditGUI $a_parent_obj)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
getStandardFilterHTML(ilDclBaseFieldModel $field, $value)
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
global $DIC
setEnableTitle($a_enabletitle)
Set Enable Title.
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.