ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjChatroomListGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Object/classes/class.ilObjectListGUI.php';
5 
13 {
17  private static $publicRoomObjId;
18 
22  private static $chat_enabled = null;
23 
27  public function __construct($a_context = self::CONTEXT_REPOSITORY)
28  {
29  parent::__construct($a_context);
30 
31  require_once 'Modules/Chatroom/classes/class.ilObjChatroom.php';
32 
33  self::$publicRoomObjId = ilObjChatroom::_getPublicObjId();
34  }
35 
39  public function init()
40  {
41  $this->delete_enabled = true;
42  $this->cut_enabled = true;
43  $this->copy_enabled = true;
44  $this->subscribe_enabled = true;
45  $this->link_enabled = true;
46  $this->info_screen_enabled = true;
47  $this->type = 'chtr';
48  $this->gui_class_name = 'ilobjchatroomgui';
49 
50  require_once 'Modules/Chatroom/classes/class.ilObjChatroomAccess.php';
51  $this->commands = ilObjChatroomAccess::_getCommands();
52  }
53 
57  public function getProperties()
58  {
59  global $DIC;
60 
61  $props = array();
62 
63  require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
64  $room = ilChatroom::byObjectId($this->obj_id);
65  if ($room) {
66  $props[] = array(
67  'alert' => false, 'property' => $DIC->language()->txt('chat_users_active'),
68  'value' => $room->countActiveUsers()
69  );
70 
71  if ($this->obj_id == self::$publicRoomObjId) {
72  $props[] = array('alert' => false, 'property' => $DIC->language()->txt('notice'), 'value' => $DIC->language()->txt('public_room'));
73  }
74 
75  if (self::$chat_enabled === null) {
76  $chatSetting = new ilSetting('chatroom');
77  self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
78  }
79 
80  if (!self::$chat_enabled) {
81  $props[] = array('alert' => true, 'property' => $DIC->language()->txt('chtr_server_status'), 'value' => $DIC->language()->txt('server_disabled'));
82  }
83 
84  if (!$room->getSetting('online_status')) {
85  $props[] = array('alert' => true, 'property' => $DIC->language()->txt('status'),
86  'value' => $DIC->language()->txt('offline'));
87  }
88  }
89 
90  return $props;
91  }
92 }
global $DIC
Definition: saml.php:7
Class ilObjChatlistListGUI.
__construct($a_context=self::CONTEXT_REPOSITORY)
{}
Class ilObjectListGUI.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.