1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
immessageconnector.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Vote\Attachment;
4
5
use Bitrix\Vote\Attach;
6
use Bitrix\Im\V2\Message;
7
use Bitrix\Main\Loader;
8
use Bitrix\Vote\Integration\Im\ImVoteStopEventHandler;
9
10
final
class
ImMessageConnector
extends
Connector
11
{
12
13
public
function
canRead
(
$userId
): bool
14
{
15
$userId
= (int)
$userId
;
16
if
(
$userId
<= 0)
17
{
18
return
false
;
19
}
20
21
if
($this->entityId ===
null
)
22
{
23
return
true
;
24
}
25
26
if
(!
Loader::includeModule
(
'im'
))
27
{
28
return
false
;
29
}
30
31
$message
=
new
Message
($this->entityId);
32
33
return
$message
34
->getChat()
35
->checkAccess(
$userId
)
36
->isSuccess()
37
;
38
}
39
40
public
function
canEdit
(
$userId
): bool
41
{
42
$userId
= (int)
$userId
;
43
if
(
$userId
<= 0)
44
{
45
return
false
;
46
}
47
48
if
($this->entityId ===
null
)
49
{
50
return
true
;
51
}
52
53
if
(!
Loader::includeModule
(
'im'
))
54
{
55
return
false
;
56
}
57
58
$message
=
new
Message
($this->entityId);
59
60
return
$message
->getAuthorId() ===
$userId
61
&&
$message
62
->getChat()
63
->checkAccess(
$userId
)
64
->isSuccess()
65
;
66
}
67
68
public
function
onVoteStop
(
Attach
$attach): void
69
{
70
$handler =
new
ImVoteStopEventHandler
((
int
)$attach->
getVoteId
(), (
int
)$attach->
getEntityId
());
71
$handler->handle();
72
}
73
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Vote\Attach\getEntityId
getEntityId()
Определения
attach.php:587
Bitrix\Vote\Attach\getVoteId
getVoteId()
Определения
attach.php:563
Bitrix\Vote\Attachment\Connector
Определения
connector.php:12
Bitrix\Vote\Attachment\ImMessageConnector
Определения
immessageconnector.php:11
Bitrix\Vote\Attachment\ImMessageConnector\canEdit
canEdit($userId)
Определения
immessageconnector.php:40
Bitrix\Vote\Attachment\ImMessageConnector\canRead
canRead($userId)
Определения
immessageconnector.php:13
Bitrix\Vote\Attachment\ImMessageConnector\onVoteStop
onVoteStop(Attach $attach)
Определения
immessageconnector.php:68
Bitrix\Vote\Integration\Im\ImVoteStopEventHandler
Определения
ImVoteStopEventHandler.php:15
Bitrix\Im\Message
Определения
Uuid.php:3
Bitrix\Im\V2\Message\Attach
Определения
AttachService.php:3
$message
$message
Определения
payment.php:8
bitrix
modules
vote
lib
attachment
immessageconnector.php
Создано системой
1.14.0