ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclTableViewFieldsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
10 {
11  public function __construct(ilDclTableViewEditGUI $a_parent_obj)
12  {
13  global $DIC;
14  $lng = $DIC['lng'];
15  $ilCtrl = $DIC['ilCtrl'];
16  parent::__construct($a_parent_obj);
17 
18  $this->setId('dcl_tableviews');
19  $this->setTitle($lng->txt('dcl_tableview_fieldsettings'));
20  $this->addColumn($lng->txt('dcl_fieldtitle'), null, 'auto');
21  $this->addColumn($lng->txt('dcl_field_visible'), null, 'auto');
22  $this->addColumn($lng->txt('dcl_filter'), null, 'auto');
23  $this->addColumn($lng->txt('dcl_std_filter'), null, 'auto');
24  $this->addColumn($lng->txt('dcl_filter_changeable'), null, 'auto');
25 
26  $ilCtrl->saveParameter($this, 'tableview_id');
27  $this->setFormAction($ilCtrl->getFormActionByClass('ildcltablevieweditgui'));
28  $this->addCommandButton('saveTable', $lng->txt('dcl_save'));
29 
30  $this->setExternalSegmentation(true);
31  $this->setExternalSorting(true);
32 
33  $this->setRowTemplate('tpl.tableview_fields_row.html', 'Modules/DataCollection');
34  $this->setTopCommands(true);
35  $this->setEnableHeader(true);
36  $this->setShowRowsSelector(false);
37  $this->setShowTemplates(false);
38  $this->setEnableHeader(true);
39  $this->setEnableTitle(true);
40  $this->setDefaultOrderDirection('asc');
41 
42  $this->parseData($a_parent_obj->tableview->getFieldSettings());
43  }
44 
45 
46  public function parseData($data)
47  {
48  //enable/disable comments
49  if (!$this->parent_obj->table->getPublicCommentsEnabled()) {
50  foreach ($data as $key => $rec) {
51  if ($rec->getField() == 'comments') {
52  unset($data[$key]);
53  }
54  }
55  }
56  $this->setData($data);
57  }
58 
59 
63  public function fillRow($a_set)
64  {
65  $field = $a_set->getFieldObject();
66  if ($field->getId() == 'comments' && !$this->parent_obj->table->getPublicCommentsEnabled()) {
67  return;
68  }
69 
70  $this->tpl->setVariable('FIELD_TITLE', $field->getTitle());
71  $this->tpl->setVariable('ID', $a_set->getId());
72  $this->tpl->setVariable('FIELD_ID', $a_set->getField());
73  $this->tpl->setVariable('VISIBLE', $a_set->isVisible() ? 'checked' : '');
74  if ($field->allowFilterInListView()) {
75  $this->tpl->setVariable('IN_FILTER', $a_set->isInFilter() ? 'checked' : '');
76  $this->tpl->setVariable('FILTER_VALUE', $this->getStandardFilterHTML($field, $a_set->getFilterValue()));
77  $this->tpl->setVariable('FILTER_CHANGEABLE', $a_set->isFilterChangeable() ? 'checked' : '');
78  } else {
79  $this->tpl->setVariable('NO_FILTER', '');
80  }
81  }
82 
83 
91  protected function getStandardFilterHTML(ilDclBaseFieldModel $field, $value)
92  {
93  $field_representation = ilDclFieldFactory::getFieldRepresentationInstance($field);
94  $field_representation->addFilterInputFieldToTable($this);
95  $filter = end($this->filters);
96  $this->filters = array();
97  $filter->setValueByArray($value);
98 
99  return $filter->render();
100  }
101 }
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.
global $DIC
Definition: saml.php:7
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.
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
$key
Definition: croninfo.php:18