Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
service.php
1<?php
10
12use Bitrix\ImOpenLines;
13use Bitrix\ImConnector;
14
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}
static includeModule($moduleName)
Definition loader.php:69