1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
dataloader.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Source;
3
4
use Bitrix\Main;
5
6
abstract
class
DataLoader
7
{
8
protected
$config
= [
9
'select'
=> [],
10
'filter'
=> [],
11
'order'
=> [],
12
'limit'
=> 0,
13
'internal_filter'
=> []
14
];
15
16
protected
$options
= [];
17
19
protected
$seo
=
null
;
20
21
public
function
__construct
()
22
{
23
$this->seo =
new
Seo
();
24
}
25
30
public
function
setConfig
(
array
$config
)
31
{
32
if
(empty(
$config
))
33
{
34
return
;
35
}
36
$this->config = array_merge($this->config,
$config
);
37
}
38
43
public
function
setOptions
(
array
$options
)
44
{
45
if
(empty(
$options
))
46
{
47
return
;
48
}
49
$this->options = array_merge($this->options,
$options
);
50
}
51
55
abstract
public
function
getElementListData
();
56
61
abstract
public
function
getElementData
($element);
62
67
public
function
normalizeFilter
(
$filter
)
68
{
69
if
(!is_array(
$filter
))
70
{
71
return
[];
72
}
73
if
(empty(
$filter
))
74
{
75
return
$filter
;
76
}
77
78
$result
= [];
79
foreach
(
$filter
as $row)
80
{
81
if
(empty($row) || !is_array($row))
82
{
83
continue
;
84
}
85
if
(empty($row[
'key'
]) || empty($row[
'value'
]) || !is_array($row[
'value'
]))
86
{
87
continue
;
88
}
89
$result
[] = $row;
90
}
91
unset($row);
92
93
if
(!empty(
$result
))
94
{
95
Main\Type\Collection::sortByColumn
(
$result
, [
'key'
=> SORT_ASC]);
96
}
97
return
$result
;
98
}
99
104
public
function
calculateFilterHash
(
$filter
)
105
{
106
if
(!is_array(
$filter
))
107
{
108
$filter
= [];
109
}
110
return
md5(serialize(
$filter
));
111
}
112
117
public
function
getFilterHash
(
$filter
)
118
{
119
return
$this->
calculateFilterHash
($this->
normalizeFilter
(
$filter
));
120
}
121
127
protected
function
getSelectFields
()
128
{
129
return
$this->
getSettingsValue
(
'select'
);
130
}
131
137
protected
function
getPreparedSelectFields
()
138
{
139
$result
= [];
140
$fields
= $this->
getSelectFields
();
141
if
(!empty(
$fields
) && is_array(
$fields
))
142
{
143
foreach
(
$fields
as $row)
144
{
145
if
(empty($row) || !is_array($row) || empty($row[
'id'
]))
146
{
147
continue
;
148
}
149
$result
[] = $row[
'id'
];
150
}
151
unset($row);
152
}
153
return
$result
;
154
}
155
161
protected
function
getFilter
()
162
{
163
return
$this->
getSettingsValue
(
'filter'
);
164
}
165
172
protected
function
getPreparedFilter
(
array
$fields
)
173
{
174
$result
= [];
175
$filter
= $this->
getFilter
();
176
if
(!empty(
$filter
) && is_array(
$filter
))
177
{
178
$dataFilter =
new
DataFilter
();
179
$dataFilter->setFields(
$fields
);
180
$result
= $dataFilter->create(
$filter
);
181
unset($dataFilter);
182
}
183
return
$result
;
184
}
185
191
protected
function
getOrder
()
192
{
193
return
$this->
getSettingsValue
(
'order'
);
194
}
195
201
protected
function
getLimit
()
202
{
203
return
(
int
)$this->
getSettingsValue
(
'limit'
);
204
}
205
211
protected
function
getInternalFilter
()
212
{
213
return
$this->
getSettingsValue
(
'internal_filter'
);
214
}
215
222
protected
function
getSettingsValue
($index)
223
{
224
$index = trim((
string
)$index);
225
if
($index ===
''
)
226
{
227
return
null
;
228
}
229
if
(!empty($this->config[$index]))
230
{
231
return
$this->config[$index];
232
}
233
return
null
;
234
}
235
242
protected
function
getOptionsValue
($index)
243
{
244
$index = trim((
string
)$index);
245
if
($index ===
''
)
246
{
247
return
null
;
248
}
249
if
(!empty($this->options[$index]))
250
{
251
return
$this->options[$index];
252
}
253
return
null
;
254
}
255
259
public
function
getSeo
()
260
{
261
return
$this->seo;
262
}
263
268
public
function
getSeoProperty
(
$name
)
269
{
270
return
$this->seo->getProperty(
$name
);
271
}
272
276
public
function
getSeoTitle
()
277
{
278
return
$this->
getSeoProperty
(
Seo::TITLE
);
279
}
280
}
Bitrix\Landing\Landing\Seo
Определения
seo.php:7
Bitrix\Landing\Source\DataFilter
Определения
datafilter.php:5
Bitrix\Landing\Source\DataLoader\$options
$options
Определения
dataloader.php:16
Bitrix\Landing\Source\DataLoader\__construct
__construct()
Определения
dataloader.php:21
Bitrix\Landing\Source\DataLoader\getSeoProperty
getSeoProperty($name)
Определения
dataloader.php:268
Bitrix\Landing\Source\DataLoader\setConfig
setConfig(array $config)
Определения
dataloader.php:30
Bitrix\Landing\Source\DataLoader\calculateFilterHash
calculateFilterHash($filter)
Определения
dataloader.php:104
Bitrix\Landing\Source\DataLoader\getSeoTitle
getSeoTitle()
Определения
dataloader.php:276
Bitrix\Landing\Source\DataLoader\getFilter
getFilter()
Определения
dataloader.php:161
Bitrix\Landing\Source\DataLoader\getPreparedSelectFields
getPreparedSelectFields()
Определения
dataloader.php:137
Bitrix\Landing\Source\DataLoader\normalizeFilter
normalizeFilter($filter)
Определения
dataloader.php:67
Bitrix\Landing\Source\DataLoader\$config
$config
Определения
dataloader.php:8
Bitrix\Landing\Source\DataLoader\getElementData
getElementData($element)
Bitrix\Landing\Source\DataLoader\getOrder
getOrder()
Определения
dataloader.php:191
Bitrix\Landing\Source\DataLoader\getOptionsValue
getOptionsValue($index)
Определения
dataloader.php:242
Bitrix\Landing\Source\DataLoader\setOptions
setOptions(array $options)
Определения
dataloader.php:43
Bitrix\Landing\Source\DataLoader\getSettingsValue
getSettingsValue($index)
Определения
dataloader.php:222
Bitrix\Landing\Source\DataLoader\$seo
$seo
Определения
dataloader.php:19
Bitrix\Landing\Source\DataLoader\getSelectFields
getSelectFields()
Определения
dataloader.php:127
Bitrix\Landing\Source\DataLoader\getInternalFilter
getInternalFilter()
Определения
dataloader.php:211
Bitrix\Landing\Source\DataLoader\getPreparedFilter
getPreparedFilter(array $fields)
Определения
dataloader.php:172
Bitrix\Landing\Source\DataLoader\getFilterHash
getFilterHash($filter)
Определения
dataloader.php:117
Bitrix\Landing\Source\DataLoader\getLimit
getLimit()
Определения
dataloader.php:201
Bitrix\Landing\Source\DataLoader\getSeo
getSeo()
Определения
dataloader.php:259
Bitrix\Landing\Source\DataLoader\getElementListData
getElementListData()
Bitrix\Landing\Source\Seo\TITLE
const TITLE
Определения
seo.php:6
Bitrix\Main\Type\Collection\sortByColumn
static sortByColumn(array &$array, $columns, $callbacks='', $defaultValueIfNotSetValue=null, $preserveKeys=false)
Определения
collection.php:24
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$filter
$filter
Определения
iblock_catalog_list.php:54
$name
$name
Определения
menu_edit.php:35
Bitrix\Landing\DataLoader
Определения
chat.php:2
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
landing
lib
source
dataloader.php
Создано системой
1.14.0