ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilChatRoomsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
6 include_once('Services/Table/classes/class.ilTable2GUI.php');
7 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
8 
10 
11  private $objectRef;
12  private $hasWritePerm = false;
13  private $serverActive = false;
14 
15  public function __construct($a_ref, $hasWritePerm = false, $active, $title="") {
16  global $lng, $ilCtrl, $rbacsystem, $ilSetting;
17 
18  $this->serverActive = $active;
19  $this->objectRef = $a_ref;
20  $this->hasWritePerm = $hasWritePerm;
21  parent::__construct($a_ref, $title);
22  $this->setTitle($lng->txt('chat_rooms'));
23  $this->setId('cht_room_table_' . $a_ref->object->getId());
24  $this->addColumn('', 'checkbox', '1%', true);
25  $this->addColumn($lng->txt('chat_rooms'), 'room' , '79%');
26  $this->addColumn($lng->txt("actions"), '' , '20%');
27 
28  $this->setFormAction($ilCtrl->getFormAction($a_ref));
29  $this->setRowTemplate('tpl.chat_room_list_row.html', 'Modules/Chat');
30  $this->setSelectAllCheckbox('del_id');
31 
32  if
33  (
34  $ilSetting->get('chat_export_status') == 0 ||
35  (
36  $ilSetting->get('chat_export_status') == 1 &&
37  $rbacsystem->checkAccess("moderate", $this->objectRef->ref_id)
38  )
39  )
40  {
41  $this->addMultiCommand("exportRoom", $lng->txt("chat_html_export"));
42  }
43 
44  if ($hasWritePerm)
45  {
46  $this->addMultiCommand("refreshRoom", $lng->txt("chat_refresh"));
47  }
48 
49  $this->addMultiCommand("deleteRoom", $lng->txt("delete"));
50  }
51 
52  public function fillRow($a_set)
53  {
54  global $ilCtrl, $lng, $ilSetting, $rbacsystem;
55 
56  $this->tpl->setVariable('VAL_ROOM_ID', $a_set['room_id']);
57  $this->tpl->setVariable('VAL_ROOM_TITLE', $a_set['title']);
58  $this->tpl->setVariable('VAL_TXT_USERS', $this->lng->txt('chat_users_active'));
59  $this->tpl->setVariable('VAL_USERS', $a_set['usercount']);
60 
61  $current_selection_list = new ilAdvancedSelectionListGUI();
62  $current_selection_list->setListTitle($lng->txt("actions"));
63  $current_selection_list->setId("act_".$a_set['room_id']);
64 
65  if ($this->serverActive)
66  {
67  $current_selection_list->addItem($this->lng->txt("show"), '', './ilias.php?baseClass=ilChatPresentationGUI&ref_id='.$this->objectRef->ref_id.'&room_id='.$a_set['room_id'], '', '', 'CHAT');
68 
69  //$this->tpl->setVariable('VAL_TXT_SHOW', $lng->txt('show'));
70  $this->tpl->setVariable('VAL_LINK_SHOW', './ilias.php?baseClass=ilChatPresentationGUI&ref_id='.$this->objectRef->ref_id.'&room_id='.$a_set['room_id']);
71  $this->tpl->setVariable('VAL_SHOW_TARGET', 'CHAT');
72  }
73 
74  if ($this->hasWritePerm && $a_set['room_id'])
75  {
76  $ilCtrl->setParameter($this->objectRef, 'room_id', $a_set['room_id']);
77  $current_selection_list->addItem($this->lng->txt("rename"), '', $ilCtrl->getLinkTarget($this->objectRef, 'rename'));
78  $ilCtrl->clearParameters($this->objectRef);
79 
80  $ilCtrl->setParameter($this->objectRef, 'del_id', $a_set['room_id']);
81  $current_selection_list->addItem($this->lng->txt("delete"), '', $ilCtrl->getLinkTarget($this->objectRef, 'deleteRoom'));
82  $current_selection_list->addItem($this->lng->txt("chat_refresh"), '', $ilCtrl->getLinkTarget($this->objectRef, 'refreshRoom'));
83  $ilCtrl->clearParameters($this->objectRef);
84  }
85 
86  if
87  (
88  $ilSetting->get('chat_export_status') == 0 ||
89  (
90  $ilSetting->get('chat_export_status') == 1 &&
91  $rbacsystem->checkAccess("moderate", $this->objectRef->ref_id)
92  )
93  )
94  {
95  $ilCtrl->setParameter($this->objectRef, 'del_id', $a_set['room_id']);
96  $current_selection_list->addItem($this->lng->txt("chat_html_export"), '', $ilCtrl->getLinkTarget($this->objectRef, 'exportRoom'));
97  $ilCtrl->clearParameters($this->objectRef);
98  }
99 
100  $this->tpl->setVariable('ACTION_LIST', $current_selection_list->getHTML());
101  }
102 
103 }