ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
10{
11
15 protected $lng;
19 protected $ctrl;
23 protected $parent_obj;
24
25
29 public function __construct($parent_obj)
30 {
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
78
82 public function fillRow($a_set)
83 {
84 $this->tpl->setVariable("ID", $a_set->getId());
85 $this->tpl->setVariable("ORDER_NAME", "order[{$a_set->getId()}]");
86 $this->tpl->setVariable("ORDER_VALUE", $a_set->getOrder());
87 $this->tpl->setVariable("TITLE", $a_set->getTitle());
88
89 $this->ctrl->setParameterByClass('ildclfieldlistgui', 'table_id', $a_set->getId());
90 $this->tpl->setVariable("TITLE_LINK", $this->ctrl->getLinkTargetByClass('ildclfieldlistgui'));
91
92 $this->tpl->setVariable("CHECKBOX_NAME_VISIBLE", 'visible[' . $a_set->getId() . ']');
93 if ($a_set->getIsVisible()) {
94 $this->tpl->setVariable("CHECKBOX_CHECKED_VISIBLE", 'checked');
95 }
96 $this->tpl->setVariable("CHECKBOX_NAME_COMMENTS", 'comments[' . $a_set->getId() . ']');
97 if ($a_set->getPublicCommentsEnabled()) {
98 $this->tpl->setVariable("CHECKBOX_CHECKED_COMMENTS", 'checked');
99 }
100 $this->tpl->setVariable('ACTIONS', $this->buildActions($a_set->getId()));
101 }
102
103
111 protected function buildActions($id)
112 {
113 $alist = new ilAdvancedSelectionListGUI();
114 $alist->setId($id);
115 $alist->setListTitle($this->lng->txt('actions'));
116 $this->ctrl->setParameterByClass('ildclfieldlistgui', 'table_id', $id);
117 $this->ctrl->setParameterByClass('ildcltableviewgui', 'table_id', $id);
118 $this->ctrl->setParameterByClass('ildcltableeditgui', 'table_id', $id);
119 $alist->addItem($this->lng->txt('settings'), '', $this->ctrl->getLinkTargetByClass('ildcltableeditgui', 'edit'));
120 $alist->addItem($this->lng->txt('dcl_list_fields'), '', $this->ctrl->getLinkTargetByClass('ildclfieldlistgui', 'listFields'));
121 $alist->addItem($this->lng->txt('dcl_tableviews'), '', $this->ctrl->getLinkTargetByClass('ildcltableviewgui'));
122 $alist->addItem($this->lng->txt('delete'), '', $this->ctrl->getLinkTargetByClass('ildcltableeditgui', 'confirmDelete'));
123
124 return $alist->getHTML();
125 }
126}
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
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.
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.
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)
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7