ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
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 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
setExternalSorting($a_val)
Set external sorting.
buildActions($id)
build actions menu
setStyle($a_element, $a_style)
global $DIC
Definition: saml.php:7
setShowTemplates($a_value)
Toggle templates.
setExternalSegmentation($a_val)
Set external segmentation.
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
User interface class for advanced drop-down selection lists.
__construct($parent_obj)
ilDclTableListTableGUI constructor.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFormName($a_formname="")
Set Form name.
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.
Class ilDclTableListTableGUI.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setEnableTitle($a_enabletitle)
Set Enable Title.
getStyle($a_element)