ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjChatroomListGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
28{
29 private static int $publicRoomObjId;
30 private static ?bool $chat_enabled = null;
31
32 public function __construct(int $a_context = self::CONTEXT_REPOSITORY)
33 {
34 parent::__construct($a_context);
35 self::$publicRoomObjId = ilObjChatroom::_getPublicObjId();
36 }
37
38 public function init(): void
39 {
40 $this->delete_enabled = true;
41 $this->cut_enabled = true;
42 $this->copy_enabled = true;
43 $this->subscribe_enabled = true;
44 $this->link_enabled = true;
45 $this->info_screen_enabled = true;
46 $this->type = 'chtr';
47 $this->gui_class_name = 'ilobjchatroomgui';
48
49 $this->commands = ilObjChatroomAccess::_getCommands();
50 }
51
52 public function getProperties(): array
53 {
54 $props = [];
55
56 $this->lng->loadLanguageModule('chatroom');
57
58 $room = ilChatroom::byObjectId($this->obj_id);
59 if ($room) {
60 $props[] = [
61 'alert' => false,
62 'property' => $this->lng->txt('chat_users_active'),
63 'value' => $room->countActiveUsers()
64 ];
65
66 if ($this->obj_id === self::$publicRoomObjId) {
67 $props[] = [
68 'alert' => false,
69 'property' => $this->lng->txt('notice'),
70 'value' => $this->lng->txt('public_room')
71 ];
72 }
73
74 if (self::$chat_enabled === null) {
75 $chatSetting = new ilSetting('chatroom');
76 self::$chat_enabled = (bool) $chatSetting->get('chat_enabled', '0');
77 }
78
79 if (!self::$chat_enabled) {
80 $props[] = [
81 'alert' => true,
82 'property' => $this->lng->txt('chtr_server_status'),
83 'value' => $this->lng->txt('server_disabled')
84 ];
85 }
86
87 if (ilObject::lookupOfflineStatus($this->obj_id)) {
88 $props[] = [
89 'alert' => true,
90 'property' => $this->lng->txt('status'),
91 'value' => $this->lng->txt('offline')
92 ];
93 }
94 }
95
96 return $props;
97 }
98}
static byObjectId(int $object_id)
static _getCommands()
get commands
Class ilObjChatlistListGUI.
getProperties()
Get item properties.
__construct(int $a_context=self::CONTEXT_REPOSITORY)
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc