1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
config.php
См. документацию.
1<?php
2
3namespace Bitrix\Conversion;
4
5use Bitrix\Currency\CurrencyManager;
6use Bitrix\Main\ModuleManager;
7use Bitrix\Main\Config\Option;
8use Bitrix\Main\Loader;
9
10final class Config
11{
12 static private $baseCurrency;
13
20 public static function getDefaultCurrency()
21 {
22 if (Loader::includeModule('currency'))
23 {
24 return CurrencyManager::getBaseCurrency();
25 }
26 return 'RUB';
27 }
28
29 static public function getBaseCurrency()
30 {
31 if (! $currency =& self::$baseCurrency)
32 {
33 $currency = Option::get('conversion', 'BASE_CURRENCY', self::getDefaultCurrency());
34 }
35
36 return $currency;
37 }
38
42 static public function setBaseCurrency($currency)
43 {
44 if (! $currency)
45 {
46 $currency = self::getDefaultCurrency();
47 }
48
49 self::$baseCurrency = $currency;
50
51 Option::set('conversion', 'BASE_CURRENCY', $currency);
52 }
53
54
55
57 static public function convertToBaseCurrency($value, $currency) // TODO remove from sale
58 {
60 }
61
63 static public function formatToBaseCurrency($value, $format = null) // TODO remove from sale
64 {
65 return Utils::formatToBaseCurrency($value, $format);
66 }
67
69 static public function getBaseCurrencyUnit() // TODO remove from sale
70 {
72 }
73
74
75
76 static private $modules = array();
77
78 static public function getModules()
79 {
80 if (! $modules =& self::$modules)
81 {
82 $default = array('ACTIVE' => ! ModuleManager::isModuleInstalled('sale'));
83
84 foreach (
85 array(
89 ) as $types)
90 {
91 foreach ($types as $type)
92 {
93 $modules[$type['MODULE']] = $default;
94 }
95 }
96
97 if ($modules['sale'])
98 {
99 $modules['sale']['ACTIVE'] = true;
100 }
101
102 $modules = unserialize(Option::get('conversion', 'MODULES', 'a:0:{}'), ['allowed_classes' => false]) + $modules;
103
104 // TODO all modules with attributes must be active
105 $modules['conversion'] = $modules['abtest'] = $modules['sender'] = $modules['seo'] = array('ACTIVE' => true);
106
107 ksort($modules);
108 }
109
110 return $modules;
111 }
112
114 static public function setModules(array $modules)
115 {
116 self::$modules = $modules;
117 Option::set('conversion', 'MODULES', serialize($modules));
118 }
119
120 static public function isModuleActive($name)
121 {
122 $modules = self::getModules();
123 $module = $modules[$name];
124 return $module && $module['ACTIVE'];
125 }
126}
$type
Определения options.php:106
static isModuleActive($name)
Определения config.php:120
static getBaseCurrencyUnit()
Определения config.php:69
static formatToBaseCurrency($value, $format=null)
Определения config.php:63
static setBaseCurrency($currency)
Определения config.php:42
static setModules(array $modules)
Определения config.php:114
static getDefaultCurrency()
Определения config.php:20
static convertToBaseCurrency($value, $currency)
Определения config.php:57
static getBaseCurrency()
Определения config.php:29
static getModules()
Определения config.php:78
static getBaseCurrencyUnit()
Определения utils.php:47
static formatToBaseCurrency($value, $format=null)
Определения utils.php:28
static convertToBaseCurrency($value, $currency)
Определения utils.php:10
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
static set($moduleId, $name, $value="", $siteId="")
Определения option.php:261
static includeModule($moduleName)
Определения loader.php:67
static isModuleInstalled($moduleName)
Определения modulemanager.php:125
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$modules
Определения bitrix.php:26
$name
Определения menu_edit.php:35
$currency
Определения template.php:266