ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilShopTopicsTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
14include_once('Services/Table/classes/class.ilTable2GUI.php');
15
16
18{
19 protected $lng = null;
20 protected $ctrl;
21
29 public function __construct($a_parent_obj, $a_parent_cmd = '')
30 {
31 global $lng, $ilCtrl;
32
33 $this->lng = $lng;
34 $this->ctrl = $ilCtrl;
35
36 parent::__construct($a_parent_obj, $a_parent_cmd);
37 $this->setId('shop_topics_tbl');
38 $this->addColumn('', 'checkbox', '1%');
39 $this->addColumn($this->lng->txt('title'), 'title' , '40%');
40 $this->addColumn($this->lng->txt('date'), 'date' , '22%');
41 $this->addColumn($this->lng->txt('pay_sorting_value'), 'sorting' , '22%');
42 $this->addColumn('', 'edit', '15%');
43
44 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
45 $this->setRowTemplate('tpl.shop_topics_list_row.html', 'Services/Payment');
46 $this->setDefaultOrderField('pt_topic_sort');
47 $this->setDefaultOrderDirection('asc');
48 }
49
57 public function fillRow($a_set)
58 {
59 $this->tpl->setVariable('VAL_ID', $a_set['id']);
60 $this->tpl->setVariable('VAL_TITLE', $a_set['title']);
61 $this->tpl->setVariable('VAL_DATE', ilFormat::formatDate(date('Y-m-d H:i:s', $a_set['date']), 'datetime', true));
62 $this->tpl->setVariable('VAL_SORTING_TEXTINPUT', ilUtil::formInput('sorting['.$a_set['id'].']', $a_set['sorting']));
63
64 $this->ctrl->setParameter($this->parent_obj, 'topic_id', $a_set['id']);
65 $this->tpl->setVariable('EDIT_LINK', $this->ctrl->getLinkTarget($this->parent_obj, 'showTopicForm'));
66 $this->tpl->setVariable('TXT_EDIT_RECORD', $this->lng->txt('edit'));
67 }
68
76 public function parseRecords($a_topics)
77 {
78 foreach($a_topics as $topic)
79 {
80 $tmp_arr['id'] = $topic->getId();
81 $tmp_arr['title'] = $topic->getTitle();
82 $tmp_arr['date'] = $topic->getCreateDate();
83 $tmp_arr['sorting'] = (int)$topic->getSorting();
84
85 $records_arr[] = $tmp_arr;
86 }
87
88 if (!count($a_topics))
89 {
90 $this->disable('header');
91 $this->disable('footer');
92
93 $this->setNoEntriesText($this->lng->txt('no_topics_yet'));
94 }
95 else
96 {
97 $this->addMultiCommand('confirmDeleteTopic', $this->lng->txt('delete'));
98 $this->setSelectAllCheckbox('topic_id');
99 }
100
101 $this->setData($records_arr ? $records_arr : array());
102 }
103}
104?>
formatDate($a_date, $a_mode="datetime", $a_omit_seconds=false, $a_relative=TRUE)
format a date according to the user language shortcut for Format::fmtDateTime @access public
Class ilShopTopicsTableGUI.
parseRecords($a_topics)
Parse records.
__construct($a_parent_obj, $a_parent_cmd='')
Constructor.
Class ilTable2GUI.
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.
setNoEntriesText($a_text)
Set text for an empty table.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
disable($a_module_name)
diesables particular modules of table
static formInput($varname, $value, $disabled=false)
create html input area
global $ilCtrl
Definition: ilias.php:18