1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
basevalues.php
См. документацию.
1<?php
7namespace Bitrix\Iblock\InheritedProperty;
8
9abstract class BaseValues
10{
12 protected $iblockId = null;
13
15 protected $values = false;
16
18 protected $queue = null;
19
23 public function __construct($iblockId)
24 {
25 $this->iblockId = (int)$iblockId;
26 $this->queue = ValuesQueue::getInstance(get_called_class());
27 }
28
34 public function getIblockId()
35 {
36 return $this->iblockId;
37 }
38
44 public function getValueTableName()
45 {
46 return "";
47 }
48
54 abstract public function getType();
55
61 abstract public function getId();
62
68 abstract public function createTemplateEntity();
69
75 public function getParents()
76 {
77 return array();
78 }
79
86 public function getParent()
87 {
88 $parents = $this->getParents();
89 if (isset($parents[0]))
90 return $parents[0];
91 else
92 return null;
93 }
94
101 public function getValues()
102 {
103 if ($this->values === false)
104 $this->values = $this->queryValues();
105
106 $result = array();
107 foreach ($this->values as $CODE => $row)
108 {
110 $row['VALUE'],
111 ENT_COMPAT,
112 false
113 );
114 }
115 return $result;
116 }
117
125 public function getValue($propertyCode)
126 {
127 if ($this->values === false)
128 $this->values = $this->queryValues();
129
130 if (isset($this->values[$propertyCode]))
131 return htmlspecialcharsEx($this->values[$propertyCode]["VALUE"]);
132 else
133 return "";
134 }
135
143 public function queryValues()
144 {
145 $templateInstance = new BaseTemplate($this);
146 $templates = $templateInstance->findTemplates();
147 foreach ($templates as $CODE => $row)
148 {
149 $templates[$CODE]["VALUE"] = \Bitrix\Iblock\Template\Engine::process($this->createTemplateEntity(), $row["TEMPLATE"]);
150 }
151 return $templates;
152 }
153
159 public function hasTemplates()
160 {
161 $templateInstance = new BaseTemplate($this);
162 return $templateInstance->hasTemplates($this);
163 }
164
170 abstract function clearValues();
171
179 public function deleteValues($ipropertyId)
180 {
181 $ipropertyId = (int)$ipropertyId;
183 $connection->query("
184 DELETE FROM b_iblock_iblock_iprop
185 WHERE IPROP_ID = ".$ipropertyId."
186 ");
187 $connection->query("
188 DELETE FROM b_iblock_section_iprop
189 WHERE IPROP_ID = ".$ipropertyId."
190 ");
191 $connection->query("
192 DELETE FROM b_iblock_element_iprop
193 WHERE IPROP_ID = ".$ipropertyId."
194 ");
196 }
197
207 protected function insertValues($tableName, $primaryFields, $rows)
208 {
210 $sqlHelper = $connection->getSqlHelper();
211 foreach ($sqlHelper->prepareMergeMultiple($tableName, $primaryFields, $rows) as $dml)
212 {
213 $connection->query($dml);
214 }
215 }
216
225 public static function queue($iblockId, $id)
226 {
227 ValuesQueue::getInstance(get_called_class())->addElement($iblockId, $id);
228 }
229}
$connection
Определения actionsdefinitions.php:38
insertValues($tableName, $primaryFields, $rows)
Определения basevalues.php:207
deleteValues($ipropertyId)
Определения basevalues.php:179
getValue($propertyCode)
Определения basevalues.php:125
static queue($iblockId, $id)
Определения basevalues.php:225
static process(Entity\Base $entity, $template)
Определения engine.php:80
static getConnection($name="")
Определения application.php:638
static encode($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения htmlfilter.php:12
</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
htmlspecialcharsEx($str)
Определения tools.php:2685
$rows
Определения options.php:264