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