ILIAS  release_7 Revision v7.30-3-g800a261c036
ChatMainBarProvider.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
7
14{
18 public function getStaticTopItems() : array
19 {
20 return [];
21 }
22
26 public function getStaticSubItems() : array
27 {
29
30 $publicChatRefId = (int) \ilObjChatroom::_getPublicRefId();
31 $publicChatObjId = (int) $dic['ilObjDataCache']->lookupObjId($publicChatRefId);
32
33 $icon = $this->dic->ui()->factory()
34 ->symbol()
35 ->icon()
36 ->standard(Standard::CHTA, $this->dic->language()->txt('public_room'))->withIsOutlined(true);
37
38 return [
39 $this->mainmenu->link($this->if->identifier('mm_public_chat'))
40 ->withTitle($this->dic->language()->txt('public_room'))
41 ->withAction('ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . $publicChatRefId)
42 ->withParent(StandardTopItemsProvider::getInstance()->getCommunicationIdentification())
43 ->withPosition(10)
44 ->withSymbol($icon)
45 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
46 ->withAvailableCallable(
47 function () use ($publicChatObjId) : bool {
48 return $publicChatObjId > 0;
49 }
50 )
51 ->withVisibilityCallable(
52 function () use ($dic, $publicChatRefId) : bool {
53 if (0 === (int) $dic->user()->getId() || $dic->user()->isAnonymous()) {
54 return false;
55 }
56
57 $hasPublicChatRoomAccess = $dic
58 ->rbac()
59 ->system()
60 ->checkAccessOfUser($dic->user()->getId(), 'read', $publicChatRefId);
61
62 return (
63 (new \ilSetting('chatroom'))->get('chat_enabled') &&
64 $hasPublicChatRoomAccess
65 );
66 }
67 ),
68 ];
69 }
70}
An exception for terminatinating execution or to throw for unit testing.
ILIAS Setting Class.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:11
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...