Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
type.php
1
<?php
8
namespace
Bitrix\Sender\Recipient
;
9
10
use
Bitrix\Main\Localization\Loc
;
11
use
Bitrix\Sender\Internals\ClassConstant
;
12
13
Loc::loadMessages
(__FILE__);
14
19
class
Type
extends
ClassConstant
20
{
21
const
EMAIL
= 1;
22
const
PHONE
= 2;
23
const
IM
= 3;
24
const
CRM_COMPANY_ID
= 4;
25
const
CRM_CONTACT_ID
= 5;
26
const
CRM_LEAD_ID
= 10;
27
const
CRM_DEAL_PRODUCT_CONTACT_ID
= 6;
28
const
CRM_ORDER_PRODUCT_CONTACT_ID
= 7;
29
const
CRM_DEAL_PRODUCT_COMPANY_ID
= 8;
30
const
CRM_ORDER_PRODUCT_COMPANY_ID
= 9;
31
39
public
static
function
detect
($recipientCode, $isNormalized =
false
)
40
{
41
$list = self::getNamedList();
42
unset($list[self::PHONE]);
43
$list = array_keys($list);
44
$list[] = self::PHONE;
45
46
foreach
($list as $id)
47
{
48
if
($isNormalized)
49
{
50
$normalizedCode = $recipientCode;
51
}
52
else
53
{
54
$normalizedCode = Normalizer::normalize($recipientCode, $id);
55
}
56
57
if
(!Validator::validate($normalizedCode, $id))
58
{
59
continue
;
60
}
61
62
return
$id;
63
}
64
65
return
null
;
66
}
67
74
public
static
function
getName
($id)
75
{
76
$code = self::getCode($id);
77
$name =
Loc::getMessage
(
'SENDER_TYPE_CAPTION_'
. $code) ?: $code;
78
return
$name;
79
}
80
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sender\Internals\ClassConstant
Definition
classconstant.php:20
Bitrix\Sender\Recipient\Type\EMAIL
const EMAIL
Definition
type.php:21
Bitrix\Sender\Recipient\Type\CRM_ORDER_PRODUCT_CONTACT_ID
const CRM_ORDER_PRODUCT_CONTACT_ID
Definition
type.php:28
Bitrix\Sender\Recipient\Type\CRM_COMPANY_ID
const CRM_COMPANY_ID
Definition
type.php:24
Bitrix\Sender\Recipient\Type\CRM_LEAD_ID
const CRM_LEAD_ID
Definition
type.php:26
Bitrix\Sender\Recipient\Type\CRM_CONTACT_ID
const CRM_CONTACT_ID
Definition
type.php:25
Bitrix\Sender\Recipient\Type\getName
static getName($id)
Definition
type.php:74
Bitrix\Sender\Recipient\Type\CRM_DEAL_PRODUCT_CONTACT_ID
const CRM_DEAL_PRODUCT_CONTACT_ID
Definition
type.php:27
Bitrix\Sender\Recipient\Type\IM
const IM
Definition
type.php:23
Bitrix\Sender\Recipient\Type\CRM_DEAL_PRODUCT_COMPANY_ID
const CRM_DEAL_PRODUCT_COMPANY_ID
Definition
type.php:29
Bitrix\Sender\Recipient\Type\PHONE
const PHONE
Definition
type.php:22
Bitrix\Sender\Recipient\Type\CRM_ORDER_PRODUCT_COMPANY_ID
const CRM_ORDER_PRODUCT_COMPANY_ID
Definition
type.php:30
Bitrix\Sender\Recipient\Type\detect
static detect($recipientCode, $isNormalized=false)
Definition
type.php:39
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Sender\Recipient
Definition
agent.php:8
modules
sender
lib
recipient
type.php
Создано системой
1.10.0