Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
config.php
1<?php
2
3namespace Bitrix\Conversion;
4
7
8final class Config
9{
10 static private $baseCurrency;
11
12 static public function getBaseCurrency()
13 {
14 if (! $currency =& self::$baseCurrency)
15 {
16 $currency = Option::get('conversion', 'BASE_CURRENCY', 'RUB');
17 }
18
19 return $currency;
20 }
21
25 static public function setBaseCurrency($currency)
26 {
27 if (! $currency)
28 {
29 $currency = 'RUB';
30 }
31
32 self::$baseCurrency = $currency;
33
34 Option::set('conversion', 'BASE_CURRENCY', $currency);
35 }
36
37
38
40 static public function convertToBaseCurrency($value, $currency) // TODO remove from sale
41 {
42 return Utils::convertToBaseCurrency($value, $currency);
43 }
44
46 static public function formatToBaseCurrency($value, $format = null) // TODO remove from sale
47 {
48 return Utils::formatToBaseCurrency($value, $format);
49 }
50
52 static public function getBaseCurrencyUnit() // TODO remove from sale
53 {
54 return Utils::getBaseCurrencyUnit();
55 }
56
57
58
59 static private $modules = array();
60
61 static public function getModules()
62 {
63 if (! $modules =& self::$modules)
64 {
65 $default = array('ACTIVE' => ! ModuleManager::isModuleInstalled('sale'));
66
67 foreach (
68 array(
69 AttributeManager::getTypesInternal(),
70 CounterManager::getTypesInternal(),
71 RateManager::getTypesInternal(),
72 ) as $types)
73 {
74 foreach ($types as $type)
75 {
76 $modules[$type['MODULE']] = $default;
77 }
78 }
79
80 if ($modules['sale'])
81 {
82 $modules['sale']['ACTIVE'] = true;
83 }
84
85 $modules = unserialize(Option::get('conversion', 'MODULES', 'a:0:{}')) + $modules;
86
87 // TODO all modules with attributes must be active
88 $modules['conversion'] = $modules['abtest'] = $modules['sender'] = $modules['seo'] = array('ACTIVE' => true);
89
90 ksort($modules);
91 }
92
93 return $modules;
94 }
95
97 static public function setModules(array $modules)
98 {
99 self::$modules = $modules;
100 Option::set('conversion', 'MODULES', serialize($modules));
101 }
102
103 static public function isModuleActive($name)
104 {
105 $modules = self::getModules();
106 $module = $modules[$name];
107 return $module && $module['ACTIVE'];
108 }
109}
static isModuleActive($name)
Definition config.php:103
static getBaseCurrencyUnit()
Definition config.php:52
static formatToBaseCurrency($value, $format=null)
Definition config.php:46
static setBaseCurrency($currency)
Definition config.php:25
static setModules(array $modules)
Definition config.php:97
static convertToBaseCurrency($value, $currency)
Definition config.php:40
static get($moduleId, $name, $default="", $siteId=false)
Definition option.php:30
static set($moduleId, $name, $value="", $siteId="")
Definition option.php:253
static isModuleInstalled($moduleName)