ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4require_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 = [];
62
63 $DIC->language()->loadLanguageModule('chatroom');
64
65 $room = ilChatroom::byObjectId($this->obj_id);
66 if ($room) {
67 $props[] = [
68 'alert' => false, 'property' => $DIC->language()->txt('chat_users_active'),
69 'value' => $room->countActiveUsers()
70 ];
71
72 if ($this->obj_id == self::$publicRoomObjId) {
73 $props[] = [
74 'alert' => false,
75 'property' => $DIC->language()->txt('notice'),
76 'value' => $DIC->language()->txt('public_room')
77 ];
78 }
79
80 if (self::$chat_enabled === null) {
81 $chatSetting = new ilSetting('chatroom');
82 self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
83 }
84
85 if (!self::$chat_enabled) {
86 $props[] = [
87 'alert' => true,
88 'property' => $DIC->language()->txt('chtr_server_status'),
89 'value' => $DIC->language()->txt('server_disabled')
90 ];
91 }
92
93 if (!$room->getSetting('online_status')) {
94 $props[] = [
95 'alert' => true, 'property' => $DIC->language()->txt('status'),
96 'value' => $DIC->language()->txt('offline')
97 ];
98 }
99 }
100
101 return $props;
102 }
103}
An exception for terminatinating execution or to throw for unit testing.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static _getCommands()
{get commandsthis method returns an array of all possible commands/permission combinationsexample: $c...
Class ilObjChatlistListGUI.
init()
{initialisationthis method should be overwritten by derived classes}
getProperties()
{Get item properties.Overwrite this method to add properties at the bottom of the item htmlarray arra...
__construct($a_context=self::CONTEXT_REPOSITORY)
{constructor}
Class ilObjectListGUI.
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc