1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
sectionvalues.php
См. документацию.
1
<?php
7
namespace
Bitrix\Iblock\InheritedProperty;
8
9
class
SectionValues
extends
BaseValues
10
{
11
protected
$sectionId
= 0;
13
protected
$queue
=
null
;
14
19
public
function
__construct
(
$iblockId
,
$sectionId
)
20
{
21
parent::__construct(
$iblockId
);
22
$this->sectionId = (int)
$sectionId
;
23
$this->
queue
->addElement($this->iblockId, $this->sectionId);
24
}
25
31
public
function
getValueTableName
()
32
{
33
return
"b_iblock_section_iprop"
;
34
}
35
41
public
function
getType
()
42
{
43
return
"S"
;
44
}
45
51
public
function
getId
()
52
{
53
return
$this->sectionId
;
54
}
55
61
public
function
createTemplateEntity
()
62
{
63
return
new \Bitrix\Iblock\Template\Entity\Section($this->sectionId);
64
}
65
72
public
function
getParents
()
73
{
74
$parents =
array
();
75
$sectionList =
\Bitrix\Iblock\SectionTable::getList
(
array
(
76
"select"
=>
array
(
"IBLOCK_SECTION_ID"
),
77
"filter"
=>
array
(
"=ID"
=> $this->sectionId),
78
));
79
$section = $sectionList->fetch();
80
if
($section && $section[
"IBLOCK_SECTION_ID"
] > 0)
81
$parents[] =
new
SectionValues
($this->iblockId, $section[
"IBLOCK_SECTION_ID"
]);
82
else
83
$parents[] =
new
IblockValues
($this->iblockId);
84
return
$parents;
85
}
86
93
public
function
queryValues
()
94
{
95
$connection
=
\Bitrix\Main\Application::getConnection
();
96
$result
=
array
();
97
if
($this->
hasTemplates
())
98
{
99
if
($this->
queue
->getElement($this->iblockId, $this->sectionId) ===
false
)
100
{
101
$ids = $this->
queue
->get($this->iblockId);
102
$query
=
$connection
->query(
"
103
SELECT
104
P.ID
105
,P.CODE
106
,P.TEMPLATE
107
,P.ENTITY_TYPE
108
,P.ENTITY_ID
109
,IP.VALUE
110
,IP.SECTION_ID
111
FROM
112
b_iblock_section_iprop IP
113
INNER JOIN b_iblock_iproperty P ON P.ID = IP.IPROP_ID
114
WHERE
115
IP.IBLOCK_ID = "
.$this->iblockId.
"
116
AND IP.SECTION_ID in ("
.implode(
", "
, $ids).
")
117
"
);
118
$result
=
array
();
119
while
($row =
$query
->fetch())
120
{
121
$result
[$row[
"SECTION_ID"
]][$row[
"CODE"
]] = $row;
122
}
123
$this->
queue
->set($this->iblockId,
$result
);
124
}
125
$result
= $this->
queue
->getElement($this->iblockId, $this->sectionId);
126
127
if
(empty(
$result
))
128
{
129
$fields
=
array
(
130
"SECTION_ID"
,
131
"IPROP_ID"
,
132
);
133
$rows
=
array
();
134
$result
= parent::queryValues();
135
foreach
(
$result
as $row)
136
{
137
$rows
[] =
array
(
138
'IBLOCK_ID'
=> $this->iblockId,
139
'SECTION_ID'
=> $this->sectionId,
140
'IPROP_ID'
=> $row[
"ID"
],
141
'VALUE'
=> $row[
"VALUE"
],
142
);
143
}
144
$this->
insertValues
(
"b_iblock_section_iprop"
,
$fields
,
$rows
);
145
}
146
}
147
return
$result
;
148
}
149
155
function
clearValues
()
156
{
157
$connection
=
\Bitrix\Main\Application::getConnection
();
158
$sectionList =
\Bitrix\Iblock\SectionTable::getList
(
array
(
159
"select"
=>
array
(
"LEFT_MARGIN"
,
"RIGHT_MARGIN"
),
160
"filter"
=>
array
(
"=ID"
=> $this->sectionId),
161
));
162
$section = $sectionList->fetch();
163
if
($section)
164
{
165
$connection
->query(
"
166
DELETE FROM b_iblock_element_iprop
167
WHERE IBLOCK_ID = "
.$this->iblockId.
"
168
AND ELEMENT_ID in (
169
SELECT BSE.IBLOCK_ELEMENT_ID
170
FROM b_iblock_section_element BSE
171
INNER JOIN b_iblock_section BS ON BSE.IBLOCK_SECTION_ID = BS.ID AND BSE.ADDITIONAL_PROPERTY_ID IS NULL
172
WHERE BS.IBLOCK_ID = "
.$this->iblockId.
"
173
AND BS.LEFT_MARGIN <= "
.$section[
"RIGHT_MARGIN"
].
"
174
AND BS.RIGHT_MARGIN >= "
.$section[
"LEFT_MARGIN"
].
"
175
)
176
"
);
177
$connection
->query(
"
178
DELETE FROM b_iblock_section_iprop
179
WHERE IBLOCK_ID = "
.$this->iblockId.
"
180
AND SECTION_ID in (
181
SELECT BS.ID
182
FROM b_iblock_section BS
183
WHERE BS.IBLOCK_ID = "
.$this->iblockId.
"
184
AND BS.LEFT_MARGIN <= "
.$section[
"RIGHT_MARGIN"
].
"
185
AND BS.RIGHT_MARGIN >= "
.$section[
"LEFT_MARGIN"
].
"
186
)
187
"
);
188
}
189
ValuesQueue::deleteAll
();
190
}
191
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Iblock\InheritedProperty\BaseValues
Определения
basevalues.php:10
Bitrix\Iblock\InheritedProperty\BaseValues\$iblockId
$iblockId
Определения
basevalues.php:12
Bitrix\Iblock\InheritedProperty\BaseValues\hasTemplates
hasTemplates()
Определения
basevalues.php:159
Bitrix\Iblock\InheritedProperty\BaseValues\insertValues
insertValues($tableName, $primaryFields, $rows)
Определения
basevalues.php:207
Bitrix\Iblock\InheritedProperty\BaseValues\queue
static queue($iblockId, $id)
Определения
basevalues.php:225
Bitrix\Iblock\InheritedProperty\IblockValues
Определения
iblockvalues.php:10
Bitrix\Iblock\InheritedProperty\SectionValues
Определения
sectionvalues.php:10
Bitrix\Iblock\InheritedProperty\SectionValues\getId
getId()
Определения
sectionvalues.php:51
Bitrix\Iblock\InheritedProperty\SectionValues\getValueTableName
getValueTableName()
Определения
sectionvalues.php:31
Bitrix\Iblock\InheritedProperty\SectionValues\getParents
getParents()
Определения
sectionvalues.php:72
Bitrix\Iblock\InheritedProperty\SectionValues\$queue
$queue
Определения
sectionvalues.php:13
Bitrix\Iblock\InheritedProperty\SectionValues\clearValues
clearValues()
Определения
sectionvalues.php:155
Bitrix\Iblock\InheritedProperty\SectionValues\getType
getType()
Определения
sectionvalues.php:41
Bitrix\Iblock\InheritedProperty\SectionValues\__construct
__construct($iblockId, $sectionId)
Определения
sectionvalues.php:19
Bitrix\Iblock\InheritedProperty\SectionValues\createTemplateEntity
createTemplateEntity()
Определения
sectionvalues.php:61
Bitrix\Iblock\InheritedProperty\SectionValues\$sectionId
$sectionId
Определения
sectionvalues.php:11
Bitrix\Iblock\InheritedProperty\SectionValues\queryValues
queryValues()
Определения
sectionvalues.php:93
Bitrix\Iblock\InheritedProperty\ValuesQueue\deleteAll
static deleteAll()
Определения
valuesqueue.php:37
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
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
$query
$query
Определения
get_search.php:11
$rows
$rows
Определения
options.php:264
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
iblock
lib
inheritedproperty
sectionvalues.php
Создано системой
1.14.0