1C-Bitrix
25.700.0
Toggle main menu visibility
Титульная страница
Пространства имен
Пространства имен
Члены пространств имен
Указатель
$
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Функции
_
a
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Переменные
$
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
v
w
Перечисления
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
v
w
Элементы перечислений
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Структуры данных
Структуры данных
Алфавитный указатель структур данных
Иерархия классов
Поля структур
Указатель
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Функции
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Перечисления
Элементы перечислений
Файлы
Файлы
Список членов всех файлов
Указатель
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
б
в
к
л
о
п
с
т
ю
Функции
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
б
в
к
л
о
п
с
т
ю
Блог
Хостинг
1C-Bitrix
Пространства имен
Структуры данных
Файлы
Файлы
bitrix
modules
abtest
advertising
b24connector
bitrixcloud
bizproc
bizprocdesigner
blog
calendar
catalog
clouds
cluster
conversion
currency
eshopapp
fileman
form
forum
highloadblock
iblock
idea
im
classes
handlers
lib
access
bot
call
Configuration
controller
disk
integration
internals
Message
model
services
update
V2
Analytics
Anchor
Application
Async
Bot
Call
Chat
Common
Controller
Entity
Import
Integration
Link
Calendar
Favorite
File
Pin
Reminder
Task
Url
BaseLinkCollection.php
BaseLinkItem.php
LinkFacade.php
LinkItem.php
LinkRestConvertible.php
Push.php
Marketplace
Message
Notification
Permission
Promotion
Pull
Recent
Relation
Rest
Service
Settings
Sync
TariffLimit
ActionUuid.php
ActiveRecord.php
ActiveRecordCollection.php
Application.php
Chat.php
Collection.php
Entity.php
Error.php
Link.php
Logger.php
Mail.php
Message.php
MessageCollection.php
Permission.php
Registry.php
RegistryEntry.php
Relation.php
RelationCollection.php
Result.php
UpdateState.php
alias.php
app.php
basicerror.php
bot.php
chat.php
color.php
command.php
common.php
counter.php
department.php
dialog.php
helper.php
lastsearch.php
limit.php
log.php
notify.php
promotion.php
recent.php
revision.php
settings.php
text.php
user.php
meta
.settings.php
ajax_hit.php
default_option.php
include.php
options.php
landing
ldap
learning
lists
location
mail
main
messageservice
mobileapp
perfmon
photogallery
pull
report
rest
sale
scale
search
security
sender
seo
socialnetwork
socialservices
statistic
storeassist
subscribe
support
translate
ui
vote
webservice
wiki
workflow
Список членов всех файлов
Примеры
•
Указатель
Структуры данных
Пространства имен
Файлы
Функции
Переменные
Перечисления
Элементы перечислений
Страницы
Загрузка...
Поиск...
Не найдено
Push.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Link;
4
5
use Bitrix\Im\V2\Chat;
6
use Bitrix\Im\V2\Common\ContextCustomer;
7
use Bitrix\Im\V2\Rest\RestAdapter;
8
use Bitrix\Main\Application;
9
10
class
Push
11
{
12
use ContextCustomer;
13
14
protected
const
MODULE_ID
=
'im'
;
15
16
protected
array
$events
;
17
private
static
Push
$instance;
18
private
bool
$isJobPlanned =
false
;
19
20
private
function
__construct()
21
{
22
}
23
24
public
static
function
getInstance
(): self
25
{
26
if
(!isset(self::$instance))
27
{
28
self::$instance =
new
self
();
29
}
30
31
return
self::$instance;
32
}
24
public
static
function
getInstance
(): self {
…
}
33
34
public
function
sendFull
(
LinkRestConvertible
$link,
string
$eventName,
array
$endpoint): void
35
{
36
$this->
send
((
new
RestAdapter
($link))->toRestFormat(), $eventName, $endpoint);
37
}
34
public
function
sendFull
(
LinkRestConvertible
$link,
string
$eventName,
array
$endpoint): void {
…
}
38
39
public
function
sendIdOnly
(
LinkRestConvertible
$link,
string
$eventName,
array
$endpoint): void
40
{
41
$this->
send
($link->
toRestFormatIdOnly
(), $eventName, $endpoint);
42
}
39
public
function
sendIdOnly
(
LinkRestConvertible
$link,
string
$eventName,
array
$endpoint): void {
…
}
43
44
protected
function
send
(
array
$params
,
string
$eventName,
array
$endpoint): void
45
{
46
$pull = [
47
'module_id'
=> self::MODULE_ID,
48
'command'
=> $eventName,
49
'params'
=>
$params
,
50
'extra'
=>
\Bitrix\Im\Common::getPullExtra
(),
51
];
52
$event
= [
'params'
=> $pull];
53
if
(isset($endpoint[
'CHAT_ID'
]))
54
{
55
$chat =
Chat::getInstance
((
int
)$endpoint[
'CHAT_ID'
]);
56
if
($chat->getType() === Chat::IM_TYPE_COMMENT)
57
{
58
$event
[
'tag'
] =
'IM_PUBLIC_COMMENT_'
. $chat->getParentChatId();
59
}
60
else
61
{
62
$event
[
'recipient'
] = $chat->getRelations()->getUserIds();
63
}
64
}
65
elseif
(isset($endpoint[
'RECIPIENT'
]))
66
{
67
$event
[
'recipient'
] = $endpoint[
'RECIPIENT'
];
68
}
69
else
70
{
71
return
;
72
}
73
74
$this->events[] =
$event
;
75
76
$this->
deferRun
();
77
}
44
protected
function
send
(
array
$params
,
string
$eventName,
array
$endpoint): void {
…
}
78
79
protected
function
push
(): void
80
{
81
if
(!\
Bitrix
\
Main
\Loader::includeModule(
'pull'
))
82
{
83
return
;
84
}
85
foreach
($this->events as
$event
)
86
{
87
if
(isset(
$event
[
'recipient'
]))
88
{
89
\Bitrix\Pull\Event::add
(
$event
[
'recipient'
],
$event
[
'params'
]);
90
}
91
if
(isset(
$event
[
'tag'
]))
92
{
93
\CPullWatch::AddToStack(
$event
[
'tag'
],
$event
[
'params'
]);
94
}
95
}
96
$this->isJobPlanned =
false
;
97
$this->events = [];
98
}
79
protected
function
push
(): void {
…
}
99
100
protected
function
deferRun
(): void
101
{
102
if
(!$this->isJobPlanned)
103
{
104
Application::getInstance
()->addBackgroundJob(
function
() {
105
$this->
push
();
106
});
107
$this->isJobPlanned =
true
;
108
}
109
}
100
protected
function
deferRun
(): void {
…
}
110
}
10
class
Push
{
…
};
Bitrix\Im\Common\getPullExtra
static getPullExtra()
Определения
common.php:127
Bitrix\Im\V2\Link\Push
Определения
Push.php:11
Bitrix\Im\V2\Link\Push\sendFull
sendFull(LinkRestConvertible $link, string $eventName, array $endpoint)
Определения
Push.php:34
Bitrix\Im\V2\Link\Push\send
send(array $params, string $eventName, array $endpoint)
Определения
Push.php:44
Bitrix\Im\V2\Link\Push\MODULE_ID
const MODULE_ID
Определения
Push.php:14
Bitrix\Im\V2\Link\Push\$events
array $events
Определения
Push.php:16
Bitrix\Im\V2\Link\Push\deferRun
deferRun()
Определения
Push.php:100
Bitrix\Im\V2\Link\Push\sendIdOnly
sendIdOnly(LinkRestConvertible $link, string $eventName, array $endpoint)
Определения
Push.php:39
Bitrix\Im\V2\Link\Push\push
push()
Определения
Push.php:79
Bitrix\Im\V2\Link\Push\getInstance
static getInstance()
Определения
Push.php:24
Bitrix\Im\V2\Rest\RestAdapter
Определения
RestAdapter.php:10
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Main\DI\ServiceLocator\getInstance
static getInstance()
Определения
servicelocator.php:33
Bitrix\Pull\Event\add
static add($recipient, array $parameters, $channelType=\CPullChannel::TYPE_PRIVATE)
Определения
event.php:22
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\Link\LinkRestConvertible
Определения
LinkRestConvertible.php:10
Bitrix\Im\V2\Link\LinkRestConvertible\toRestFormatIdOnly
toRestFormatIdOnly()
Bitrix\Main
Bitrix
$event
$event
Определения
prolog_after.php:141
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
im
lib
V2
Link
Push.php
Создано системой
1.14.0