1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
sectionvalues.php
См. документацию.
1<?php
7namespace Bitrix\Iblock\InheritedProperty;
8
10{
11 protected $sectionId = 0;
13 protected $queue = null;
14
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();
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 {
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 {
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 }
190 }
191}
$connection
Определения actionsdefinitions.php:38
insertValues($tableName, $primaryFields, $rows)
Определения basevalues.php:207
static queue($iblockId, $id)
Определения basevalues.php:225
__construct($iblockId, $sectionId)
Определения sectionvalues.php:19
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
$rows
Определения options.php:264
$fields
Определения yandex_run.php:501