Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
relationtype.php
1<?php
3
5
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:
45 case self::DELIVERY:
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 {
64 return self::PAYSYSTEM;
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);
90 return isset($all[$typeId]) ? $all[$typeId] : '';
91 }
92}
static loadMessages($file)
Definition loc.php:64