1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
conversionhandler.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Internals;
9
10
use Bitrix\Main\Localization\Loc;
11
use Bitrix\Conversion\DayContext;
12
use Bitrix\Main\Context;
13
use Bitrix\Sender\MailingChainTable;
14
use Bitrix\Sender\PostingRecipientTable;
15
16
Loc::loadMessages(__FILE__);
17
18
class
ConversionHandler
19
{
20
const
CLICK_PARAM_NAME
=
'BITRIX_SENDER_TO_CONVERSION_CLICK_ID'
;
21
22
public
static
function
onAfterRecipientClick
(
$data
)
23
{
24
if
(isset(
$data
[
'RECIPIENT'
]) && isset(
$data
[
'RECIPIENT'
][
'ID'
]))
25
{
26
$_SESSION[self::CLICK_PARAM_NAME] =
$data
[
'RECIPIENT'
][
'ID'
];
27
}
28
29
return
$data
;
30
}
31
32
public
static
function
onBeforeProlog
()
33
{
34
$id = Context::getCurrent()->getRequest()->getQuery(
'bx_sender_conversion_id'
);
35
if
(is_numeric($id) && $id > 0)
36
{
37
$_SESSION[self::CLICK_PARAM_NAME] = $id;
38
}
39
}
40
41
public
static
function
onSetDayContextAttributes
(
DayContext
$context
)
42
{
43
$id =
null
;
44
if
(isset($_SESSION[self::CLICK_PARAM_NAME]))
45
$id = $_SESSION[self::CLICK_PARAM_NAME];
46
47
if
(!is_numeric($id) || $id <= 0)
48
return
;
49
50
$recipientDb =
PostingRecipientTable::getList
(
array
(
51
'select'
=>
array
(
'MAILING_CHAIN_ID'
=>
'POSTING.MAILING_CHAIN_ID'
),
52
'filter'
=>
array
(
53
'ID'
=> $id
54
)
55
));
56
if
($recipient = $recipientDb->fetch())
57
{
58
$context
->setAttribute(
'sender_chain_source'
, $recipient[
'MAILING_CHAIN_ID'
]);
59
}
60
}
61
62
public
static
function
onGetAttributeTypes
()
63
{
64
return
array
(
65
'sender_chain_source'
=>
array
(
66
'MODULE'
=>
'sender'
,
67
'GROUP'
=>
'source'
,
68
'NAME'
=> Loc::getMessage(
'sender_conversion_chain_source'
),
69
'SORT'
=> 5100,
70
'SPLIT_BY'
=>
'sender_chain_source'
,
71
'BG_COLOR'
=>
'#cf4343'
,
72
'GET_VALUES'
=>
function
(
array
$list)
73
{
74
$itemList =
array
();
75
$filter
=
array
();
76
if
($list)
77
{
78
$filter
[
'=ID'
] = $list;
79
80
$itemDb =
MailingChainTable::getList
(
array
(
81
'select'
=>
array
(
82
'ID'
,
83
'TITLE'
,
84
),
85
'filter'
=>
$filter
,
86
));
87
88
while
($item = $itemDb->fetch())
89
{
90
if
($item[
'ID'
] ==
''
)
91
{
92
continue
;
93
}
94
95
$itemList[$item[
'ID'
]] =
array
(
96
'NAME'
=> $item[
'TITLE'
]
97
);
98
}
99
}
100
101
return
$itemList;
102
}
103
)
104
);
105
}
106
}
Bitrix\Conversion\DayContext
Определения
daycontext.php:16
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Sender\Internals\ConversionHandler
Определения
conversionhandler.php:19
Bitrix\Sender\Internals\ConversionHandler\onSetDayContextAttributes
static onSetDayContextAttributes(DayContext $context)
Определения
conversionhandler.php:41
Bitrix\Sender\Internals\ConversionHandler\CLICK_PARAM_NAME
const CLICK_PARAM_NAME
Определения
conversionhandler.php:20
Bitrix\Sender\Internals\ConversionHandler\onGetAttributeTypes
static onGetAttributeTypes()
Определения
conversionhandler.php:62
Bitrix\Sender\Internals\ConversionHandler\onAfterRecipientClick
static onAfterRecipientClick($data)
Определения
conversionhandler.php:22
Bitrix\Sender\Internals\ConversionHandler\onBeforeProlog
static onBeforeProlog()
Определения
conversionhandler.php:32
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$filter
$filter
Определения
iblock_catalog_list.php:54
$context
$context
Определения
csv_new_setup.php:223
bitrix
modules
sender
lib
internals
conversionhandler.php
Создано системой
1.14.0