Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
service.php
1
<?php
9
namespace
Bitrix\Sender\Integration\Im
;
10
11
use
Bitrix\Main\Loader
;
12
use Bitrix\ImOpenLines;
13
use Bitrix\ImConnector;
14
19
class
Service
20
{
26
public
static
function
canUse
()
27
{
28
if
(!
Loader::includeModule
(
'im'
) || !
Loader::includeModule
(
'imopenlines'
) || !
Loader::includeModule
(
'imconnector'
))
29
{
30
return
false
;
31
}
32
else
33
{
34
return
true
;
35
}
36
}
37
43
public
static
function
getExcludedChannelCodes
()
44
{
45
if
(!static::canUse())
46
{
47
return
array();
48
}
49
50
static
$codes =
null
;
51
if
($codes ===
null
)
52
{
53
$codes = ImConnector\Connector::getListConnectorNotNewsletter();
54
}
55
56
return
$codes;
57
}
58
66
public
static
function
send
($to, $text)
67
{
68
if
(!static::canUse())
69
{
70
return
false
;
71
}
72
73
$result = ImOpenLines\Im::addMessagesNewsletter(array(
74
$to => array(
'MESSAGE'
=> $text,
'SYSTEM'
=>
'Y'
)
75
));
76
77
return
isset($result[$to]) ? (bool) $result[$to] :
false
;
78
}
79
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Sender\Integration\Bitrix24\Service
Definition
service.php:30
Bitrix\Sender\Integration\Im\Service\canUse
static canUse()
Definition
service.php:26
Bitrix\Sender\Integration\Im\Service\send
static send($to, $text)
Definition
service.php:66
Bitrix\Sender\Integration\Im\Service\getExcludedChannelCodes
static getExcludedChannelCodes()
Definition
service.php:43
Bitrix\Sender\Integration\Im
Definition
messageim.php:9
modules
sender
lib
integration
im
service.php
Создано системой
1.10.0