1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
elementvalues.php
См. документацию.
1
<?php
7
namespace
Bitrix\Iblock\InheritedProperty;
8
9
class
ElementValues
extends
BaseValues
10
{
11
protected
$sectionId
= 0;
12
protected
$elementId
= 0;
13
18
public
function
__construct
(
$iblockId
,
$elementId
)
19
{
20
parent::__construct(
$iblockId
);
21
$this->elementId = (int)
$elementId
;
22
$this->
queue
->addElement($this->iblockId, $this->elementId);
23
}
24
30
public
function
getValueTableName
(): string
31
{
32
return
'b_iblock_element_iprop'
;
33
}
34
40
public
function
getType
()
41
{
42
return
"E"
;
43
}
44
50
public
function
getId
()
51
{
52
return
$this->elementId
;
53
}
54
60
public
function
createTemplateEntity
()
61
{
62
return
new \Bitrix\Iblock\Template\Entity\Element($this->elementId);
63
}
64
72
public
function
setParents
(
$sectionId
)
73
{
74
if
(is_array(
$sectionId
))
75
{
76
if
(!empty(
$sectionId
))
77
{
78
$sectionId
= array_map(
"intval"
,
$sectionId
);
79
$this->sectionId = min(
$sectionId
);
80
}
81
}
82
else
83
{
84
$this->sectionId = (int)
$sectionId
;
85
}
86
}
87
94
public
function
getParents
()
95
{
96
$parents =
array
();
97
if
($this->elementId > 0)
98
{
99
$elementList =
\Bitrix\Iblock\ElementTable::getList
(
array
(
100
"select"
=>
array
(
"IBLOCK_SECTION_ID"
),
101
"filter"
=>
array
(
"=ID"
=> $this->elementId),
102
));
103
$element = $elementList->fetch();
104
if
($element && $element[
"IBLOCK_SECTION_ID"
] > 0)
105
$parents[] =
new
SectionValues
($this->iblockId, $element[
"IBLOCK_SECTION_ID"
]);
106
else
107
$parents[] =
new
IblockValues
($this->iblockId);
108
}
109
elseif
($this->sectionId > 0)
110
{
111
$parents[] =
new
SectionValues
($this->iblockId, $this->sectionId);
112
}
113
else
114
{
115
$parents[] =
new
IblockValues
($this->iblockId);
116
}
117
return
$parents;
118
}
119
126
public
function
queryValues
()
127
{
128
$connection
=
\Bitrix\Main\Application::getConnection
();
129
$result
=
array
();
130
if
($this->
hasTemplates
())
131
{
132
if
($this->
queue
->getElement($this->iblockId, $this->elementId) ===
false
)
133
{
134
$ids = $this->
queue
->get($this->iblockId);
135
$query
=
$connection
->query(
"
136
SELECT
137
P.ID
138
,P.CODE
139
,P.TEMPLATE
140
,P.ENTITY_TYPE
141
,P.ENTITY_ID
142
,IP.VALUE
143
,IP.ELEMENT_ID
144
FROM
145
b_iblock_element_iprop IP
146
INNER JOIN b_iblock_iproperty P ON P.ID = IP.IPROP_ID
147
WHERE
148
IP.IBLOCK_ID = "
.$this->iblockId.
"
149
AND IP.ELEMENT_ID in ("
.implode(
", "
, $ids).
")
150
"
);
151
$result
=
array
();
152
while
($row =
$query
->fetch())
153
{
154
$result
[$row[
"ELEMENT_ID"
]][$row[
"CODE"
]] = $row;
155
}
156
$this->
queue
->set($this->iblockId,
$result
);
157
}
158
$result
= $this->
queue
->getElement($this->iblockId, $this->elementId);
159
160
if
(empty(
$result
))
161
{
162
$result
= parent::queryValues();
163
if
(!empty(
$result
))
164
{
165
$elementList =
\Bitrix\Iblock\ElementTable::getList
(
array
(
166
"select"
=>
array
(
"IBLOCK_SECTION_ID"
),
167
"filter"
=>
array
(
"=ID"
=> $this->elementId),
168
));
169
$element = $elementList->fetch();
170
$element[
'IBLOCK_SECTION_ID'
] = (int)$element[
'IBLOCK_SECTION_ID'
];
171
172
$fields
=
array
(
173
"ELEMENT_ID"
,
174
"IPROP_ID"
,
175
);
176
$rows
=
array
();
177
foreach
(
$result
as $CODE => $row)
178
{
179
$rows
[] =
array
(
180
'IBLOCK_ID'
=> $this->iblockId,
181
'SECTION_ID'
=> $element[
"IBLOCK_SECTION_ID"
],
182
'ELEMENT_ID'
=> $this->elementId,
183
'IPROP_ID'
=> $row[
"ID"
],
184
'VALUE'
=> $row[
"VALUE"
],
185
);
186
}
187
$this->
insertValues
(
"b_iblock_element_iprop"
,
$fields
,
$rows
);
188
}
189
}
190
}
191
return
$result
;
192
}
193
199
function
clearValues
()
200
{
201
$connection
=
\Bitrix\Main\Application::getConnection
();
202
$connection
->query(
"
203
DELETE FROM b_iblock_element_iprop
204
WHERE IBLOCK_ID = "
.$this->iblockId.
"
205
AND ELEMENT_ID = "
.$this->elementId.
"
206
"
);
207
$this->
queue
->deleteElement($this->iblockId, $this->elementId);
208
}
209
}
$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\ElementValues
Определения
elementvalues.php:10
Bitrix\Iblock\InheritedProperty\ElementValues\setParents
setParents($sectionId)
Определения
elementvalues.php:72
Bitrix\Iblock\InheritedProperty\ElementValues\getId
getId()
Определения
elementvalues.php:50
Bitrix\Iblock\InheritedProperty\ElementValues\getValueTableName
getValueTableName()
Определения
elementvalues.php:30
Bitrix\Iblock\InheritedProperty\ElementValues\getParents
getParents()
Определения
elementvalues.php:94
Bitrix\Iblock\InheritedProperty\ElementValues\clearValues
clearValues()
Определения
elementvalues.php:199
Bitrix\Iblock\InheritedProperty\ElementValues\getType
getType()
Определения
elementvalues.php:40
Bitrix\Iblock\InheritedProperty\ElementValues\__construct
__construct($iblockId, $elementId)
Определения
elementvalues.php:18
Bitrix\Iblock\InheritedProperty\ElementValues\$elementId
$elementId
Определения
elementvalues.php:12
Bitrix\Iblock\InheritedProperty\ElementValues\createTemplateEntity
createTemplateEntity()
Определения
elementvalues.php:60
Bitrix\Iblock\InheritedProperty\ElementValues\$sectionId
$sectionId
Определения
elementvalues.php:11
Bitrix\Iblock\InheritedProperty\ElementValues\queryValues
queryValues()
Определения
elementvalues.php:126
Bitrix\Iblock\InheritedProperty\IblockValues
Определения
iblockvalues.php:10
Bitrix\Iblock\InheritedProperty\SectionValues
Определения
sectionvalues.php:10
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
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$rows
$rows
Определения
options.php:264
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
iblock
lib
inheritedproperty
elementvalues.php
Создано системой
1.14.0