Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
config.php
1
<?php
2
3
namespace
Bitrix\Conversion
;
4
5
use
Bitrix\Main\ModuleManager
;
6
use
Bitrix\Main\Config\Option
;
7
8
final
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
}
Bitrix\Conversion\Config\isModuleActive
static isModuleActive($name)
Definition
config.php:103
Bitrix\Conversion\Config\getBaseCurrencyUnit
static getBaseCurrencyUnit()
Definition
config.php:52
Bitrix\Conversion\Config\formatToBaseCurrency
static formatToBaseCurrency($value, $format=null)
Definition
config.php:46
Bitrix\Conversion\Config\setBaseCurrency
static setBaseCurrency($currency)
Definition
config.php:25
Bitrix\Conversion\Config\setModules
static setModules(array $modules)
Definition
config.php:97
Bitrix\Conversion\Config\convertToBaseCurrency
static convertToBaseCurrency($value, $currency)
Definition
config.php:40
Bitrix\Conversion\Config\getBaseCurrency
static getBaseCurrency()
Definition
config.php:12
Bitrix\Conversion\Config\getModules
static getModules()
Definition
config.php:61
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Config\Option\get
static get($moduleId, $name, $default="", $siteId=false)
Definition
option.php:30
Bitrix\Main\Config\Option\set
static set($moduleId, $name, $value="", $siteId="")
Definition
option.php:253
Bitrix\Main\ModuleManager
Definition
modulemanager.php:5
Bitrix\Main\ModuleManager\isModuleInstalled
static isModuleInstalled($moduleName)
Definition
modulemanager.php:67
Bitrix\Conversion
Definition
attributegroupmanager.php:3
Bitrix\Main\Config
Definition
configuration.php:2
modules
conversion
lib
config.php
Создано системой
1.10.0