Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
statustype.php
1
<?php
2
3
4
namespace
Bitrix\Sale\Exchange\Integration\Entity
;
5
6
7
use
Bitrix\Main\Localization\Loc
;
8
9
class
StatusType
10
{
11
const
UNDEFINED
= 0;
12
const
SUCCESS
= 1;
13
const
PROCESS
= 2;
14
const
FAULTY
= 3;
15
16
const
SUCCESS_NAME
=
'S'
;
17
const
PROCESS_NAME
=
'P'
;
18
const
FAULTY_NAME
=
'F'
;
19
20
private
static
$ALL_DESCRIPTIONS = array();
21
22
public
static
function
isDefined
($typeId)
23
{
24
if
(!is_int($typeId))
25
{
26
$typeId = (int)$typeId;
27
}
28
29
return
($typeId == static::SUCCESS
30
|| $typeId == static::FAULTY
31
|| $typeId == static::PROCESS);
32
}
33
34
public
static
function
resolveId
($name)
35
{
36
if
($name ==
''
)
37
{
38
return
self::UNDEFINED
;
39
}
40
41
switch
($name)
42
{
43
case
self::SUCCESS_NAME
:
44
return
self::SUCCESS
;
45
case
self::FAULTY_NAME
:
46
return
self::FAULTY
;
47
case
self::PROCESS_NAME
:
48
return
self::PROCESS
;
49
50
default
:
51
return
self::UNDEFINED
;
52
}
53
}
54
55
public
static
function
resolveName
($typeId)
56
{
57
if
(!is_numeric($typeId))
58
{
59
return
''
;
60
}
61
62
$typeId = intval($typeId);
63
if
($typeId <= 0)
64
{
65
return
''
;
66
}
67
68
switch
($typeId)
69
{
70
case
self::SUCCESS
:
71
return
self::SUCCESS_NAME
;
72
case
self::FAULTY
:
73
return
self::FAULTY_NAME
;
74
case
self::PROCESS
:
75
return
self::PROCESS_NAME
;
76
77
case
self::UNDEFINED
:
78
default
:
79
return
''
;
80
}
81
}
82
83
public
static
function
getDescription
($typeId)
84
{
85
$typeId = intval($typeId);
86
$all =
self::getAllDescriptions
();
87
return
isset($all[$typeId]) ? $all[$typeId] :
''
;
88
}
89
90
public
static
function
getAllDescriptions
()
91
{
92
if
(!self::$ALL_DESCRIPTIONS[LANGUAGE_ID])
93
{
94
Loc::loadLanguageFile
(__FILE__);
95
96
self::$ALL_DESCRIPTIONS[LANGUAGE_ID] = array(
97
self::SUCCESS =>
Loc::getMessage
(
'SALE_INTEGRATION_STATUS_SUCCESS'
),
98
self::FAULTY =>
Loc::getMessage
(
'SALE_INTEGRATION_STATUS_FAULTY'
),
99
self::PROCESS =>
Loc::getMessage
(
'SALE_INTEGRATION_STATUS_PROCESS'
),
100
);
101
}
102
103
return
self::$ALL_DESCRIPTIONS[LANGUAGE_ID];
104
}
105
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadLanguageFile
static loadLanguageFile($file, $language=null, $normalize=true)
Definition
loc.php:224
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\Exchange\Integration\Entity\StatusType
Definition
statustype.php:10
Bitrix\Sale\Exchange\Integration\Entity\StatusType\SUCCESS_NAME
const SUCCESS_NAME
Definition
statustype.php:16
Bitrix\Sale\Exchange\Integration\Entity\StatusType\PROCESS_NAME
const PROCESS_NAME
Definition
statustype.php:17
Bitrix\Sale\Exchange\Integration\Entity\StatusType\isDefined
static isDefined($typeId)
Definition
statustype.php:22
Bitrix\Sale\Exchange\Integration\Entity\StatusType\SUCCESS
const SUCCESS
Definition
statustype.php:12
Bitrix\Sale\Exchange\Integration\Entity\StatusType\FAULTY
const FAULTY
Definition
statustype.php:14
Bitrix\Sale\Exchange\Integration\Entity\StatusType\getDescription
static getDescription($typeId)
Definition
statustype.php:83
Bitrix\Sale\Exchange\Integration\Entity\StatusType\resolveName
static resolveName($typeId)
Definition
statustype.php:55
Bitrix\Sale\Exchange\Integration\Entity\StatusType\PROCESS
const PROCESS
Definition
statustype.php:13
Bitrix\Sale\Exchange\Integration\Entity\StatusType\resolveId
static resolveId($name)
Definition
statustype.php:34
Bitrix\Sale\Exchange\Integration\Entity\StatusType\UNDEFINED
const UNDEFINED
Definition
statustype.php:11
Bitrix\Sale\Exchange\Integration\Entity\StatusType\FAULTY_NAME
const FAULTY_NAME
Definition
statustype.php:18
Bitrix\Sale\Exchange\Integration\Entity\StatusType\getAllDescriptions
static getAllDescriptions()
Definition
statustype.php:90
Bitrix\Sale\Exchange\Integration\Entity
Definition
accesscode.php:4
modules
sale
lib
exchange
integration
entity
statustype.php
Создано системой
1.10.0