ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
14 include_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 ?>