Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
statustype.php
1<?php
2
3
5
6
8
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 {
44 return self::SUCCESS;
46 return self::FAULTY;
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);
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}
static loadLanguageFile($file, $language=null, $normalize=true)
Definition loc.php:224
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29