Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
relationtype.php
1
<?php
2
namespace
Bitrix\Sale\Rest\Entity
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
6
class
RelationType
7
{
8
const
UNDEFINED
= 0;
9
const
PAYSYSTEM
= 1;
10
const
DELIVERY
= 2;
11
12
const
PAYSYSTEM_NAME
=
'P'
;
13
const
DELIVERY_NAME
=
'D'
;
14
15
static
private
$descriptions = [];
16
17
public
static
function
isDefined
($typeID)
18
{
19
if
(!is_numeric($typeID))
20
{
21
return
false
;
22
}
23
24
$typeID = intval($typeID);
25
return
$typeID >= self::PAYSYSTEM && $typeID <=
self::DELIVERY
;
26
}
27
28
public
static
function
resolveName
($typeID)
29
{
30
if
(!is_numeric($typeID))
31
{
32
return
''
;
33
}
34
35
$typeID = intval($typeID);
36
if
($typeID <= 0)
37
{
38
return
''
;
39
}
40
41
switch
($typeID)
42
{
43
case
self::PAYSYSTEM
:
44
return
self::PAYSYSTEM_NAME
;
45
case
self::DELIVERY
:
46
return
self::DELIVERY_NAME
;
47
case
self::UNDEFINED
:
48
default
:
49
return
''
;
50
}
51
}
52
53
public
static
function
resolveID
($name)
54
{
55
$name = mb_strtoupper(trim($name));
56
if
($name ==
''
)
57
{
58
return
self::UNDEFINED
;
59
}
60
61
switch
($name)
62
{
63
case
self::PAYSYSTEM_NAME
:
64
return
self::PAYSYSTEM
;
65
case
self::DELIVERY_NAME
:
66
return
self::DELIVERY
;
67
default
:
68
return
self::UNDEFINED
;
69
}
70
}
71
72
public
static
function
getAllDescriptions
()
73
{
74
if
(!self::$descriptions[LANGUAGE_ID])
75
{
76
Loc::loadMessages
($_SERVER[
"DOCUMENT_ROOT"
].
'/bitrix/modules/sale/admin/order_props_edit.php'
);
77
self::$descriptions[LANGUAGE_ID] = [
78
self::PAYSYSTEM => GetMessage(
'SALE_PROPERTY_PAYSYSTEM'
),
79
self::DELIVERY => GetMessage(
'SALE_PROPERTY_DELIVERY'
),
80
];
81
}
82
83
return
self::$descriptions[LANGUAGE_ID];
84
}
85
86
public
static
function
getDescription
($typeId)
87
{
88
$typeId = intval($typeId);
89
$all =
self::getAllDescriptions
();
90
return
isset($all[$typeId]) ? $all[$typeId] :
''
;
91
}
92
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Sale\Rest\Entity\RelationType
Definition
relationtype.php:7
Bitrix\Sale\Rest\Entity\RelationType\DELIVERY_NAME
const DELIVERY_NAME
Definition
relationtype.php:13
Bitrix\Sale\Rest\Entity\RelationType\PAYSYSTEM
const PAYSYSTEM
Definition
relationtype.php:9
Bitrix\Sale\Rest\Entity\RelationType\PAYSYSTEM_NAME
const PAYSYSTEM_NAME
Definition
relationtype.php:12
Bitrix\Sale\Rest\Entity\RelationType\getDescription
static getDescription($typeId)
Definition
relationtype.php:86
Bitrix\Sale\Rest\Entity\RelationType\resolveID
static resolveID($name)
Definition
relationtype.php:53
Bitrix\Sale\Rest\Entity\RelationType\isDefined
static isDefined($typeID)
Definition
relationtype.php:17
Bitrix\Sale\Rest\Entity\RelationType\resolveName
static resolveName($typeID)
Definition
relationtype.php:28
Bitrix\Sale\Rest\Entity\RelationType\UNDEFINED
const UNDEFINED
Definition
relationtype.php:8
Bitrix\Sale\Rest\Entity\RelationType\DELIVERY
const DELIVERY
Definition
relationtype.php:10
Bitrix\Sale\Rest\Entity\RelationType\getAllDescriptions
static getAllDescriptions()
Definition
relationtype.php:72
Bitrix\Sale\Rest\Entity
Definition
base.php:4
modules
sale
lib
rest
entity
relationtype.php
Создано системой
1.10.0