1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
elementvalues.php
См. документацию.
1<?php
7namespace Bitrix\Iblock\InheritedProperty;
8
10{
11 protected $sectionId = 0;
12 protected $elementId = 0;
13
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 {
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 {
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 {
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 {
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
Определения actionsdefinitions.php:38
insertValues($tableName, $primaryFields, $rows)
Определения basevalues.php:207
static queue($iblockId, $id)
Определения basevalues.php:225
__construct($iblockId, $elementId)
Определения elementvalues.php:18
static getConnection($name="")
Определения application.php:638
static getList(array $parameters=array())
Определения datamanager.php:431
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$query
Определения get_search.php:11
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$rows
Определения options.php:264
$fields
Определения yandex_run.php:501