handler.php
1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?
$eventId = 'NEW_CALLBACK';
$arFields = array(
'NAME' => 'Заказать звонок',
'USERNAME' => $_REQUEST['name'],
'PHONE' => $_REQUEST['phone'],
'MESSAGE' => $_REQUEST['message'],
'EMAIL' => '',
'DETAIL_TEXT' => \SH\Geolocation::toString()
);
$arFieldsGlobal = array(
'ACTIVE' => 'N',
'ACTIVE_FROM' => FormatDate('FULL', time()),
'IBLOCK_ID' => IBLOCK_REQUEST,
);
$arFields['PROPERTY_VALUES'] = $arFields;
$arFields = array_merge($arFields, $arFieldsGlobal);
$el = new CIBlockElement();
$arFields['ID'] = $el->Add($arFields);
if($el->LAST_ERROR) throw new Exception($el->LAST_ERROR);
$request = \Cpeople\Classes\Block\Getter::instance()
->setFilter(array('IBLOCK_ID' => IBLOCK_REQUEST))
->setNavStartParams(array('nTopCount' => 1))
->getById($arFields['ID']);
$arFields['TEXT'] = getRequestText($request);
$arFields['HIDDEN_TEXT'] = getRequestHiddenText($request);
CEvent::Send($eventId, SITE_ID, $arFields);
sendRequestToZendesk();