Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
culture.php
1
<?php
8
namespace
Bitrix\Main\Localization
;
9
10
use
Bitrix\Main\ORM
;
11
use
Bitrix\Main\ORM\Data
;
12
29
class
CultureTable
extends
Data\DataManager
30
{
31
const
LEFT_TO_RIGHT
=
'Y'
;
32
const
RIGHT_TO_LEFT
=
'N'
;
33
34
public
static
function
getTableName
()
35
{
36
return
'b_culture'
;
37
}
38
39
public
static
function
getObjectClass
()
40
{
41
return \Bitrix\Main\Context\Culture::class;
42
}
43
44
public
static
function
getMap
()
45
{
46
return
array(
47
'ID'
=> array(
48
'data_type'
=>
'integer'
,
49
'primary'
=>
true
,
50
'autocomplete'
=>
true
,
51
),
52
'CODE'
=> array(
53
'data_type'
=>
'string'
,
54
),
55
'NAME'
=> array(
56
'data_type'
=>
'string'
,
57
'required'
=>
true
,
58
'title'
=>
Loc::getMessage
(
"culture_entity_name"
),
59
),
60
'FORMAT_DATE'
=> array(
61
'data_type'
=>
'string'
,
62
'required'
=>
true
,
63
'default_value'
=>
"MM/DD/YYYY"
,
64
'title'
=>
Loc::getMessage
(
"culture_entity_date_format"
),
65
),
66
'FORMAT_DATETIME'
=> array(
67
'data_type'
=>
'string'
,
68
'required'
=>
true
,
69
'default_value'
=>
"MM/DD/YYYY HH:MI:SS"
,
70
'title'
=>
Loc::getMessage
(
"culture_entity_datetime_format"
),
71
),
72
'FORMAT_NAME'
=> array(
73
'data_type'
=>
'string'
,
74
'required'
=>
true
,
75
'default_value'
=>
"#NAME# #LAST_NAME#"
,
76
'title'
=>
Loc::getMessage
(
"culture_entity_name_format"
),
77
),
78
'WEEK_START'
=> array(
79
'data_type'
=>
'integer'
,
80
'default_value'
=> 0,
81
),
82
'CHARSET'
=> array(
83
'data_type'
=>
'string'
,
84
'required'
=>
true
,
85
'default_value'
=>
"UTF-8"
,
86
'title'
=>
Loc::getMessage
(
"culture_entity_charset"
),
87
),
88
'DIRECTION'
=> array(
89
'data_type'
=>
'boolean'
,
90
'values'
=> array(self::RIGHT_TO_LEFT, self::LEFT_TO_RIGHT),
91
'default_value'
=> self::LEFT_TO_RIGHT,
92
),
93
'SHORT_DATE_FORMAT'
=> array(
94
'data_type'
=>
'string'
,
95
'default_value'
=>
"n/j/Y"
,
96
),
97
'MEDIUM_DATE_FORMAT'
=> array(
98
'data_type'
=>
'string'
,
99
'default_value'
=>
"M j, Y"
,
100
),
101
'LONG_DATE_FORMAT'
=> array(
102
'data_type'
=>
'string'
,
103
'default_value'
=>
"F j, Y"
,
104
),
105
'FULL_DATE_FORMAT'
=> array(
106
'data_type'
=>
'string'
,
107
'default_value'
=>
"l, F j, Y"
,
108
),
109
'DAY_MONTH_FORMAT'
=> array(
110
'data_type'
=>
'string'
,
111
'default_value'
=>
"F j"
,
112
),
113
'DAY_SHORT_MONTH_FORMAT'
=> array(
114
'data_type'
=>
'string'
,
115
'default_value'
=>
"M j"
,
116
),
117
'DAY_OF_WEEK_MONTH_FORMAT'
=> array(
118
'data_type'
=>
'string'
,
119
'default_value'
=>
"l, F j"
,
120
),
121
'SHORT_DAY_OF_WEEK_MONTH_FORMAT'
=> array(
122
'data_type'
=>
'string'
,
123
'default_value'
=>
"D, F j"
,
124
),
125
'SHORT_DAY_OF_WEEK_SHORT_MONTH_FORMAT'
=> array(
126
'data_type'
=>
'string'
,
127
'default_value'
=>
"D, M j"
,
128
),
129
'SHORT_TIME_FORMAT'
=> array(
130
'data_type'
=>
'string'
,
131
'default_value'
=>
"g:i a"
,
132
),
133
'LONG_TIME_FORMAT'
=> array(
134
'data_type'
=>
'string'
,
135
'default_value'
=>
"g:i:s a"
,
136
),
137
'AM_VALUE'
=> array(
138
'data_type'
=>
'string'
,
139
'default_value'
=>
"am"
,
140
),
141
'PM_VALUE'
=> array(
142
'data_type'
=>
'string'
,
143
'default_value'
=>
"pm"
,
144
),
145
'NUMBER_THOUSANDS_SEPARATOR'
=> array(
146
'data_type'
=>
'string'
,
147
'default_value'
=>
","
,
148
),
149
'NUMBER_DECIMAL_SEPARATOR'
=> array(
150
'data_type'
=>
'string'
,
151
'default_value'
=>
"."
,
152
),
153
'NUMBER_DECIMALS'
=> array(
154
'data_type'
=>
'integer'
,
155
'default_value'
=> 2,
156
),
157
);
158
}
159
160
public
static
function
update
($primary, array $data)
161
{
162
$result = parent::update($primary, $data);
163
164
if
(CACHED_b_lang !==
false
&& $result->isSuccess())
165
{
166
$cache = \Bitrix\Main\Application::getInstance()->getManagedCache();
167
$cache->cleanDir(
"b_lang"
);
168
}
169
170
return
$result;
171
}
172
173
public
static
function
delete
($id)
174
{
175
//We know for sure that languages and sites can refer to the culture.
176
//Other entities should place CultureOnBeforeDelete event handler.
177
178
$result =
new
Data\DeleteResult
();
179
180
$res =
LanguageTable::getList
(array(
'filter'
=> array(
'=CULTURE_ID'
=> $id)));
181
while
(($language = $res->fetch()))
182
{
183
$result->addError(
new
ORM\
EntityError
(
Loc::getMessage
(
"culture_err_del_lang"
, array(
"#LID#"
=> $language[
"LID"
]))));
184
}
185
186
$res = \Bitrix\Main\SiteTable::getList(array(
'filter'
=> array(
'=CULTURE_ID'
=> $id)));
187
while
(($site = $res->fetch()))
188
{
189
$result->addError(
new
ORM\
EntityError
(
Loc::getMessage
(
"culture_err_del_site"
, array(
"#LID#"
=> $site[
"LID"
]))));
190
}
191
192
if
(!$result->isSuccess())
193
{
194
return
$result;
195
}
196
197
return
parent::delete($id);
198
}
199
}
Bitrix\Main\Localization\CultureTable
Definition
culture.php:30
Bitrix\Main\Localization\CultureTable\getMap
static getMap()
Definition
culture.php:44
Bitrix\Main\Localization\CultureTable\LEFT_TO_RIGHT
const LEFT_TO_RIGHT
Definition
culture.php:31
Bitrix\Main\Localization\CultureTable\RIGHT_TO_LEFT
const RIGHT_TO_LEFT
Definition
culture.php:32
Bitrix\Main\Localization\CultureTable\getObjectClass
static getObjectClass()
Definition
culture.php:39
Bitrix\Main\Localization\CultureTable\update
static update($primary, array $data)
Definition
culture.php:160
Bitrix\Main\Localization\CultureTable\getTableName
static getTableName()
Definition
culture.php:34
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Data\DeleteResult
Definition
deleteresult.php:12
Bitrix\Main\ORM\EntityError
Definition
entityerror.php:12
Bitrix\Main\Localization
Definition
culture.php:8
Bitrix\Main\ORM\Data
Definition
addresult.php:9
Bitrix\Main\ORM
modules
main
lib
localization
culture.php
Создано системой
1.10.0