1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
pathindex.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Translate\Index\Internals;
4
5
use Bitrix\Main;
6
use Bitrix\Main\ORM;
7
use Bitrix\Main\ORM\Data\DataManager;
8
use Bitrix\Translate;
9
use Bitrix\Translate\Index;
10
45
46
class
PathIndexTable
extends
DataManager
47
{
48
use
Index\Internals\BulkOperation
;
49
55
public
static
function
getTableName
(): string
56
{
57
return
'b_translate_path'
;
58
}
59
65
public
static
function
getObjectClass
(): string
66
{
67
return
Index\PathIndex::class;
68
}
69
75
public
static
function
getCollectionClass
(): string
76
{
77
return
Index\PathIndexCollection::class;
78
}
79
85
public
static
function
getMap
():
array
86
{
87
return
array
(
88
'ID'
=> [
89
'data_type'
=>
'integer'
,
90
'primary'
=>
true
,
91
'autocomplete'
=>
true
,
92
],
93
'PARENT_ID'
=> [
94
'data_type'
=>
'integer'
,
95
],
96
'PATH'
=> [
97
'data_type'
=>
'string'
,
98
],
99
'NAME'
=> [
100
'data_type'
=>
'string'
,
101
],
102
'MODULE_ID'
=> [
103
'data_type'
=>
'string'
,
104
],
105
'ASSIGNMENT'
=> [
106
'data_type'
=>
'enum'
,
107
'values'
=>
Translate
\
ASSIGNMENT_TYPES
,
108
],
109
'DEPTH_LEVEL'
=> [
110
'data_type'
=>
'integer'
,
111
'default_value'
=> 0,
112
],
113
'SORT'
=> [
114
'data_type'
=>
'integer'
,
115
'default_value'
=> 0,
116
],
117
'IS_LANG'
=> [
118
'data_type'
=>
'boolean'
,
119
'values'
=> [
'N'
,
'Y'
],
120
'default_value'
=>
'N'
,
121
],
122
'IS_DIR'
=> [
123
'data_type'
=>
'boolean'
,
124
'values'
=> [
'N'
,
'Y'
],
125
'default_value'
=>
'N'
,
126
],
127
'OBLIGATORY_LANGS'
=> [
128
'data_type'
=>
'string'
,
129
],
130
'INDEXED'
=> [
131
'data_type'
=>
'boolean'
,
132
'values'
=> [
'N'
,
'Y'
],
133
'default_value'
=>
'N'
,
134
],
135
'INDEXED_TIME'
=> [
136
'data_type'
=>
'datetime'
,
137
],
138
'FILE'
=> [
139
'data_type'
=>
Index
\
Internals
\FileIndexTable::class,
140
'reference'
=> [
141
'=this.ID'
=>
'ref.PATH_ID'
142
],
143
'join_type'
=>
'LEFT'
,
144
],
145
'ANCESTORS'
=> [
146
'data_type'
=>
Index
\
Internals
\PathTreeTable::class,
147
'reference'
=> [
148
'=this.ID'
=>
'ref.PARENT_ID'
,
149
],
150
'join_type'
=>
'INNER'
,
151
],
152
'DESCENDANTS'
=> [
153
'data_type'
=>
Index
\
Internals
\PathTreeTable::class,
154
'reference'
=> [
155
'=this.ID'
=>
'ref.PATH_ID'
,
156
],
157
'join_type'
=>
'INNER'
,
158
],
159
);
160
}
161
162
163
169
public
static
function
onAfterAdd
(
ORM
\
Event
$event
):
ORM
\
EventResult
170
{
171
$result
=
new
ORM\EventResult
();
172
$primary =
$event
->getParameter(
'primary'
);
173
$data
=
$event
->getParameter(
'fields'
);
174
175
if
(isset($primary[
'ID'
],
$data
[
'PARENT_ID'
]))
176
{
177
$nodeId = $primary[
'ID'
];
178
$parentId =
$data
[
'PARENT_ID'
];
179
$tableName =
PathTreeTable::getTableName
();
180
$connection
=
Main\Application::getConnection
();
181
$connection
->query(
"
182
INSERT INTO {$tableName} (PARENT_ID, PATH_ID, DEPTH_LEVEL)
183
SELECT PARENT_ID, '{$nodeId}', DEPTH_LEVEL + 1 FROM {$tableName} WHERE PATH_ID = '{$parentId}'
184
UNION ALL
185
SELECT '{$nodeId}', '{$nodeId}', 0
186
"
);
187
}
188
189
return
$result
;
190
}
191
197
public
static
function
onAfterDelete
(
ORM
\
Event
$event
):
ORM
\
EventResult
198
{
199
$result
=
new
ORM\EventResult
();
200
$primary =
$event
->getParameter(
'primary'
);
201
202
if
(isset($primary[
'ID'
]))
203
{
204
$nodeId = $primary[
'ID'
];
205
$tableName =
PathTreeTable::getTableName
();
206
$connection
=
Main\Application::getConnection
();
207
$connection
->query(
"DELETE FROM {$tableName} WHERE PATH_ID = '{$nodeId}'"
);
208
}
209
210
return
$result
;
211
}
212
220
public
static
function
purge
(?
Translate
\
Filter
$filter
=
null
): void
221
{
222
$recursively =
true
;
223
if
(isset(
$filter
,
$filter
->recursively))
224
{
225
$recursively =
$filter
->recursively;
226
}
227
228
if
($recursively)
229
{
230
if
(!isset(
$filter
,
$filter
->langId))
231
{
232
Index\Internals\PathTreeTable::purge
(
$filter
);
233
}
234
Index\Internals\FileIndexTable::purge
(
$filter
);
235
}
236
237
if
(!isset(
$filter
,
$filter
->langId))
238
{
239
$filterOut = static::processFilter(
$filter
);
240
static::bulkDelete($filterOut);
241
}
242
}
243
251
public
static
function
processFilter
(?
Translate
\
Filter
$filter
=
null
):
array
252
{
253
$filterOut = [];
254
255
if
(
$filter
!==
null
)
256
{
257
foreach
(
$filter
as
$key
=> $value)
258
{
259
if
(empty($value) && $value !==
'0'
)
260
{
261
continue
;
262
}
263
264
if
(
$key
===
'path'
)
265
{
266
$filterOut[
'=%PATH'
] = $value.
'%'
;
267
}
268
elseif
(
$key
===
'pathId'
)
269
{
270
$filterOut[
'=ID'
] = $value;
271
}
272
elseif
(
$key
===
'indexedTime'
)
273
{
274
$filterOut[
'<INDEXED_TIME'
] = $value;
275
}
276
else
277
{
278
if
(static::getEntity()->hasField(trim(
$key
,
'<>!=@~%*'
)))
279
{
280
$filterOut[
$key
] = $value;
281
}
282
}
283
}
284
}
285
286
return
$filterOut;
287
}
288
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\Event
Определения
event.php:5
Bitrix\Main\EventResult
Определения
eventresult.php:5
Bitrix\Main\ORM\Data\DataManager
Определения
datamanager.php:35
Bitrix\Translate\Index\Internals\FileIndexTable\purge
static purge(?Translate\Filter $filter=null)
Определения
fileindex.php:123
Bitrix\Translate\Index\Internals\PathIndexTable
Определения
pathindex.php:47
Bitrix\Translate\Index\Internals\PathIndexTable\getMap
static getMap()
Определения
pathindex.php:85
Bitrix\Translate\Index\Internals\PathIndexTable\processFilter
static processFilter(?Translate\Filter $filter=null)
Определения
pathindex.php:251
Bitrix\Translate\Index\Internals\PathIndexTable\onAfterDelete
static onAfterDelete(ORM\Event $event)
Определения
pathindex.php:197
Bitrix\Translate\Index\Internals\PathIndexTable\onAfterAdd
static onAfterAdd(ORM\Event $event)
Определения
pathindex.php:169
Bitrix\Translate\Index\Internals\PathIndexTable\purge
static purge(?Translate\Filter $filter=null)
Определения
pathindex.php:220
Bitrix\Translate\Index\Internals\PathIndexTable\getObjectClass
static getObjectClass()
Определения
pathindex.php:65
Bitrix\Translate\Index\Internals\PathIndexTable\getTableName
static getTableName()
Определения
pathindex.php:55
Bitrix\Translate\Index\Internals\PathIndexTable\getCollectionClass
static getCollectionClass()
Определения
pathindex.php:75
Bitrix\Translate\Index\Internals\PathTreeTable\purge
static purge(?Translate\Filter $filter=null)
Определения
pathtree.php:90
Bitrix\Translate\Index\Internals\PathTreeTable\getTableName
static getTableName()
Определения
pathtree.php:44
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
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
Bitrix\Main\Filter
Bitrix\Main\ORM
Bitrix\Translate\Index\Internals
Определения
bulkoperation.php:3
Bitrix\Translate\Index\Internals\BulkOperation
trait BulkOperation
Определения
bulkoperation.php:9
Bitrix\Translate\Index
Определения
aggregate.php:3
Bitrix\Translate
Определения
autoload.php:3
Bitrix\Translate\ASSIGNMENT_TYPES
const ASSIGNMENT_TYPES
Определения
autoload.php:89
$event
$event
Определения
prolog_after.php:141
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
bitrix
modules
translate
lib
index
internals
pathindex.php
Создано системой
1.14.0