1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Messenger.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Socialnetwork\Collab\Integration\IM;
6
7
use Bitrix\Im\V2\Chat\CollabChat;
8
use Bitrix\Im\V2\Chat\Update\UpdateFields;
9
use Bitrix\Im\V2\Chat\Update\UpdateService;
10
use Bitrix\Main\Loader;
11
use Bitrix\Socialnetwork\Integration\Im\Chat\Workgroup;
12
13
class
Messenger
14
{
15
public
static
function
getInstance
(): ?\
Bitrix
\
Im
\
V2
\
Service
\
Messenger
16
{
17
if
(!
Loader::includeModule
(
'im'
))
18
{
19
return
null
;
20
}
21
22
return \Bitrix\Im\V2\Service\Messenger::getInstance();
23
}
24
25
public
static
function
getUpdateService
(
int
$chatId,
array
$fields
= [],
bool
$collabChatOnly =
false
): ?
UpdateService
26
{
27
if
(!
Loader::includeModule
(
'im'
))
28
{
29
return
null
;
30
}
31
32
$chat = static::getInstance()?->getChat($chatId);
33
34
if
($collabChatOnly && !$chat instanceof
CollabChat
)
35
{
36
return
null
;
37
}
38
39
$updateFields = UpdateFields::create(
$fields
);
40
41
42
return
new
UpdateService
($chat, $updateFields);
43
}
44
45
public
static
function
setManagers
(
int
$collabId,
array
$managers): void
46
{
47
if
(!
Loader::includeModule
(
'im'
))
48
{
49
return
;
50
}
51
52
Workgroup::setChatManagers(
53
[
54
'group_id'
=> $collabId,
55
'user_id'
=> $managers,
56
'set'
=>
true
,
57
]
58
);
59
}
60
61
public
static
function
unsetManagers
(
int
$collabId,
array
$users): void
62
{
63
if
(!
Loader::includeModule
(
'im'
))
64
{
65
return
;
66
}
67
68
Workgroup::setChatManagers(
69
[
70
'group_id'
=> $collabId,
71
'user_id'
=> $users,
72
'set'
=>
false
,
73
]
74
);
75
}
76
77
public
static
function
synchronizeCollabChat
(
int
$chatId,
array
$fields
): void
78
{
79
if
(!
Loader::includeModule
(
'im'
))
80
{
81
return
;
82
}
83
84
static::getUpdateService($chatId,
$fields
,
true
)?->updateChat();
85
}
86
}
Bitrix\Im\V2\Chat\CollabChat
Определения
CollabChat.php:22
Bitrix\Im\V2\Chat\Update\UpdateService
Определения
UpdateService.php:17
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Socialnetwork\Collab\Integration\IM\Messenger\unsetManagers
static unsetManagers(int $collabId, array $users)
Определения
Messenger.php:61
Bitrix\Socialnetwork\Collab\Integration\IM\Messenger\getInstance
static getInstance()
Определения
Messenger.php:15
Bitrix\Socialnetwork\Collab\Integration\IM\Messenger\setManagers
static setManagers(int $collabId, array $managers)
Определения
Messenger.php:45
Bitrix\Socialnetwork\Collab\Integration\IM\Messenger\getUpdateService
static getUpdateService(int $chatId, array $fields=[], bool $collabChatOnly=false)
Определения
Messenger.php:25
Bitrix\Socialnetwork\Collab\Integration\IM\Messenger\synchronizeCollabChat
static synchronizeCollabChat(int $chatId, array $fields)
Определения
Messenger.php:77
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Im\V2
Определения
ActionUuid.php:3
Bitrix\Im
Bitrix\Main\Messenger
Bitrix\Main\Service
Bitrix
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
socialnetwork
lib
Collab
Integration
IM
Messenger.php
Создано системой
1.14.0