ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTableListTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once ('./Services/Table/classes/class.ilTable2GUI.php');
5require_once ('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
12
16 protected $lng;
20 protected $ctrl;
24 protected $parent_obj;
25
26
30 public function __construct($parent_obj) {
31 global $DIC;
32 $lng = $DIC['lng'];
33 $ilCtrl = $DIC['ilCtrl'];
34
35 parent::__construct($parent_obj);
36
37 $this->parent_obj = $parent_obj;
38 $this->ctrl = $ilCtrl;
39 $this->lng = $lng;
40
41 $this->setId('dcl_table_list');
42 $this->addColumn('', '', '1', true);
43 $this->addColumn($lng->txt('dcl_order'), NULL, '30px');
44 $this->addColumn($lng->txt('title'), NULL, 'auto');
45 $this->addColumn($lng->txt('dcl_visible'), NULL, '250px', false, '', $this->lng->txt('dcl_visible_desc'));
46 $this->addColumn($lng->txt('dcl_comments'), NULL, '200px', false, '', $this->lng->txt('dcl_public_comments_desc'));
47 $this->addColumn($lng->txt('actions'), NULL, '30px');
48
49 $this->setSelectAllCheckbox('dcl_table_ids[]');
50 $this->addMultiCommand('confirmDeleteTables', $lng->txt('dcl_delete_tables'));
51
52 $this->setFormAction($ilCtrl->getFormActionByClass('ildcltablelistgui'));
53 $this->addCommandButton('save', $lng->txt('dcl_save'));
54
55 $this->setFormAction($ilCtrl->getFormAction($parent_obj));
56 $this->setFormName('table_list');
57
58 //those two are important as we get our data as objects not as arrays.
59 $this->setExternalSegmentation(true);
60 $this->setExternalSorting(true);
61
62 $this->setTopCommands(true);
63 $this->setEnableHeader(true);
64 $this->setShowRowsSelector(false);
65 $this->setShowTemplates(false);
66 $this->setEnableHeader(true);
67 $this->setEnableTitle(true);
68 $this->setDefaultOrderDirection('asc');
69
70 $this->setTitle($lng->txt('dcl_table_list_tables'));
71 $this->setRowTemplate('tpl.table_list_row.html', 'Modules/DataCollection');
72 $this->setStyle('table', $this->getStyle('table') . ' ' . 'dcl_record_list');
73
74 $tables = $this->parent_obj->getDataCollectionObject()->getTables();
75 $this->setData($tables);
76 }
77
81 public function fillRow($a_set)
82 {
83 $this->tpl->setVariable("ID", $a_set->getId());
84 $this->tpl->setVariable("ORDER_NAME", "order[{$a_set->getId()}]");
85 $this->tpl->setVariable("ORDER_VALUE", $a_set->getOrder());
86 $this->tpl->setVariable("TITLE", $a_set->getTitle());
87
88 $this->ctrl->setParameterByClass('ildclfieldlistgui', 'table_id', $a_set->getId());
89 $this->tpl->setVariable("TITLE_LINK", $this->ctrl->getLinkTargetByClass('ildclfieldlistgui'));
90
91 $this->tpl->setVariable("CHECKBOX_NAME_VISIBLE", 'visible[' . $a_set->getId() . ']');
92 if ($a_set->getIsVisible()) {
93 $this->tpl->setVariable("CHECKBOX_CHECKED_VISIBLE", 'checked');
94 }
95 $this->tpl->setVariable("CHECKBOX_NAME_COMMENTS", 'comments[' . $a_set->getId() . ']');
96 if ($a_set->getPublicCommentsEnabled()) {
97 $this->tpl->setVariable("CHECKBOX_CHECKED_COMMENTS", 'checked');
98 }
99 $this->tpl->setVariable('ACTIONS', $this->buildActions($a_set->getId()));
100 }
101
107 protected function buildActions($id) {
108
109 $alist = new ilAdvancedSelectionListGUI();
110 $alist->setId($id);
111 $alist->setListTitle($this->lng->txt('actions'));
112 $this->ctrl->setParameterByClass('ildclfieldlistgui', 'table_id', $id);
113 $this->ctrl->setParameterByClass('ildcltableviewgui', 'table_id', $id);
114 $this->ctrl->setParameterByClass('ildcltableeditgui', 'table_id', $id);
115 $alist->addItem($this->lng->txt('settings'), '', $this->ctrl->getLinkTargetByClass('ildcltableeditgui', 'edit'));
116 $alist->addItem($this->lng->txt('dcl_list_fields'), '', $this->ctrl->getLinkTargetByClass('ildclfieldlistgui', 'listFields'));
117 $alist->addItem($this->lng->txt('dcl_tableviews'), '', $this->ctrl->getLinkTargetByClass('ildcltableviewgui'));
118 $alist->addItem($this->lng->txt('delete'), '', $this->ctrl->getLinkTargetByClass('ildcltableeditgui', 'confirmDelete'));
119 return $alist->getHTML();
120
121 }
122}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
Class ilDclTableListTableGUI.
__construct($parent_obj)
ilDclTableListTableGUI constructor.
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.
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.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
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.
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.
getStyle($a_element)
setStyle($a_element, $a_style)
global $ilCtrl
Definition: ilias.php:18
global $DIC