Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
section.php
1<?php
2
4
10
11Loc::loadMessages(__FILE__);
12
17class Section extends Base
18{
19 private const DEFAULT_DATA = [
20 'migration' => [
21 'CODE' => 'migration',
22 'SECTION_CODE' => 'migration',
23 'ACTIVE' => 'Y',
24 'ICON_CLASS' => 'ui-icon ui-icon-service-arrows',
25 'ICON_I_BG_COLOR' => '#2fc6f5',
26 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_MIGRATION',
27 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_MIGRATION',
28 ],
29 'external' => [
30 'CODE' => 'external',
31 'SECTION_CODE' => 'external',
32 'ACTIVE' => 'Y',
33 'ADMIN_ONLY' => 'Y',
34 'ICON_CLASS' => 'ui-icon ui-icon-service-wheel',
35 'ICON_I_BG_COLOR' => '#55d0e0',
36 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_EXTERNAL_SYSTEMS',
37 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_EXTERNAL_SYSTEMS',
38 ],
39 'auto-sales' => [
40 'CODE' => 'auto-sales',
41 'SECTION_CODE' => 'auto-sales',
42 'ACTIVE' => 'Y',
43 'ICON_CLASS' => 'ui-icon ui-icon-service-cart',
44 'ICON_I_BG_COLOR' => '#9dcf01',
45 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_AUTOMATE_SALES',
46 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_AUTOMATE_SALES',
47 ],
48 'auto-control' => [
49 'CODE' => 'auto-control',
50 'SECTION_CODE' => 'auto-control',
51 'ACTIVE' => 'Y',
52 'ICON_CLASS' => 'ui-icon ui-icon-service-play',
53 'ICON_I_BG_COLOR' => '#1eae43',
54 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_AUTOMATE_CONTROL',
55 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_AUTOMATE_CONTROL',
56 ],
57 'widget' => [
58 'CODE' => 'widget',
59 'SECTION_CODE' => 'widget',
60 'ACTIVE' => 'Y',
61 'ICON_CLASS' => 'ui-icon ui-icon-service-widget',
62 'ICON_I_BG_COLOR' => '#ffa901',
63 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_WIDGET',
64 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_WIDGET',
65 ],
66 'chat-bot' => [
67 'CODE' => 'chat-bot',
68 'SECTION_CODE' => 'chat-bot',
69 'ACTIVE' => 'Y',
70 'ICON_CLASS' => 'ui-icon ui-icon-service-chatbot',
71 'ICON_I_BG_COLOR' => '#ff5752',
72 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_CHAT_BOT',
73 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_CHAT_BOT',
74 ],
75 'standard' => [
76 'CODE' => 'standard',
77 'SECTION_CODE' => 'standard',
78 'ACTIVE' => 'Y',
79 'ICON_CLASS' => 'ui-icon ui-icon-service-other',
80 'ICON_I_BG_COLOR' => '#c374d1',
81 'TITLE.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_NAME_STANDARD',
82 'DESCRIPTION.MESSAGE_CODE' => 'REST_INTEGRATION_OPTION_SECTION_DESCRIPTION_STANDARD',
83 ],
84 ];
85 private const CACHE_DIR = '/rest/integration/section/';
86
91 public static function get() : array
92 {
93 $result = [];
94 $cache = Cache::createInstance();
95 if ($cache->initCache(static::CACHE_TIME, 'sectionsIndexPage' . LANGUAGE_ID, static::CACHE_DIR))
96 {
97 $result = $cache->getVars();
98 }
99 elseif ($cache->startDataCache())
100 {
101 $dictionary = new IntegrationSection();
102 foreach ($dictionary as $el)
103 {
104 if (!empty($el['option']))
105 {
106 $data = Json::decode(base64_decode($el['option']));
107 if (is_array($data))
108 {
109 $data = static::changeMessage($data);
110 $data['CODE'] = $data['SECTION_CODE'];
111 $result[$data['CODE']] = $data;
112 }
113 }
114 }
115
116 if (empty($result))
117 {
118 $result = static::changeMessage(static::DEFAULT_DATA);
119 }
120
121 $cache->endDataCache($result);
122 }
123
124 return $result;
125 }
126}
static loadMessages($file)
Definition loc.php:64