ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclTableViewTableGUI.php
Go to the documentation of this file.
1<?php
2require_once('./Services/Table/classes/class.ilTable2GUI.php');
3require_once('./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php');
4
14{
15
19 protected $ctrl;
23 protected $table;
27 protected $parent_obj;
28
35 public function __construct(ilDclTableViewGUI $a_parent_obj, $a_parent_cmd, ilDclTable $table)
36 {
37 global $DIC;
38 $lng = $DIC['lng'];
39 $ilCtrl = $DIC['ilCtrl'];
40 parent::__construct($a_parent_obj, $a_parent_cmd);
41
42 $this->parent_obj = $a_parent_obj;
43 $this->table = $table;
44 $this->ctrl = $ilCtrl;
45 $this->lng = $lng;
46
47
48 $this->setExternalSegmentation(true);
49 $this->setExternalSorting(true);
50
51 if ($this->parent_obj instanceof ilDclTableViewGUI)
52 {
53 $ilCtrl->setParameterByClass('ildcltableviewgui', 'table_id', $table->getId());
54 $this->setFormAction($ilCtrl->getFormActionByClass('ildcltableviewgui'));
55 $this->addMultiCommand('confirmDeleteTableviews', $lng->txt('dcl_delete_views'));
56 $this->addCommandButton('saveTableViewOrder', $lng->txt('dcl_save_order'));
57
58 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
59 $this->setFormName('tableview_list');
60
61 $this->addColumn('', '', '1', true);
62 $this->addColumn($lng->txt('dcl_order'), NULL, '30px');
63
64 $this->setRowTemplate('tpl.tableview_list_row.html', 'Modules/DataCollection');
65 $this->setData($this->table->getTableViews());
66 }
67 elseif ($this->parent_obj instanceof ilDclDetailedViewGUI)
68 {
69 $this->setRowTemplate('tpl.detailview_list_row.html', 'Modules/DataCollection');
70 $this->setData($this->table->getVisibleTableViews($this->parent_obj->parent_obj->ref_id, true));
71
72 }
73
74 $this->addColumn($lng->txt('title'), NULL, 'auto');
75 $this->addColumn($lng->txt('description'), NULL, 'auto');
76 $this->addColumn($lng->txt('actions'), NULL, '30px');
77
78
79 $this->setTopCommands(true);
80 $this->setEnableHeader(true);
81 $this->setShowRowsSelector(false);
82 $this->setShowTemplates(false);
83 $this->setEnableHeader(true);
84 $this->setEnableTitle(true);
85 $this->setDefaultOrderDirection('asc');
86 $this->setLimit(0);
87
88 $this->setId('dcl_tableviews');
89 $this->setTitle($lng->txt("dcl_tableviews_table"));
90 $this->setStyle('table', $this->getStyle('table') . ' ' . 'dcl_record_list');
91 }
92
96 public function fillRow($a_set)
97 {
98 if ($this->parent_obj instanceof ilDclTableViewGUI) {
99 $this->tpl->setVariable("ID", $a_set->getId());
100 $this->tpl->setVariable("ORDER_NAME", "order[{$a_set->getId()}]");
101 $this->tpl->setVariable("ORDER_VALUE", $a_set->getOrder());
102 }
103 $this->tpl->setVariable("TITLE", $a_set->getTitle());
104 $this->ctrl->setParameterByClass('ilDclTableViewEditGUI', 'tableview_id', $a_set->getId());
105 $this->tpl->setVariable("TITLE_LINK", $this->ctrl->getLinkTargetByClass('ilDclTableViewEditGUI'));
106 $this->tpl->setVariable("DESCRIPTION", $a_set->getDescription());
107 $this->tpl->setVariable('ACTIONS', $this->buildAction($a_set->getId()));
108
109 }
110
116 protected function buildAction($id) {
117
118 if ($this->parent_obj instanceof ilDclTableViewGUI)
119 {
120 $alist = new ilAdvancedSelectionListGUI();
121 $alist->setId($id);
122 $alist->setListTitle($this->lng->txt('actions'));
123 $this->ctrl->setParameterByClass('ildcltableviewgui', 'tableview_id', $id);
124 $this->ctrl->setParameterByClass('ilDclDetailedViewDefinitionGUI', 'tableview_id', $id);
125 $alist->addItem($this->lng->txt('settings'), '', $this->ctrl->getLinkTargetByClass('ildcltablevieweditgui', 'editGeneralSettings'));
126 $alist->addItem($this->lng->txt('dcl_list_visibility_and_filter'), '', $this->ctrl->getLinkTargetByClass('ildcltablevieweditgui', 'editFieldSettings'));
127 $alist->addItem($this->lng->txt('dcl_detailed_view'), '', $this->ctrl->getLinkTargetByClass(array('ildcltablevieweditgui', 'ilDclDetailedViewDefinitionGUI'), 'edit'));
128 $alist->addItem($this->lng->txt('delete'), '', $this->ctrl->getLinkTargetByClass('ildcltablevieweditgui', 'confirmDelete'));
129 return $alist->getHTML();
130 }
131 elseif ($this->parent_obj instanceof ilDclDetailedViewGUI)
132 {
134 $this->ctrl->setParameterByClass('ilDclDetailedViewGUI', 'tableview_id', $id);
135 $this->ctrl->saveParameterByClass('ilDclDetailedViewGUI', 'record_id');
136 $button->setUrl($this->ctrl->getLinkTargetByClass('ilDclDetailedViewGUI', 'renderRecord'));
137 $button->setCaption('view');
138 return $button->getToolbarHTML();
139 }
140
141
142 }
143
144}
An exception for terminatinating execution or to throw for unit testing.
User interface class for advanced drop-down selection lists.
static getInstance()
Factory.
Class ilDclTableViewGUI.
Class ilDclTableViewTableGUI.
buildAction($id)
build either actions menu or view button
__construct(ilDclTableViewGUI $a_parent_obj, $a_parent_cmd, ilDclTable $table)
ilDclTableViewTableGUI constructor.
Class ilDclBaseFieldModel.
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.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command 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 $lng
Definition: privfeed.php:17
global $DIC