Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
sectionproperty.php
1<?php
8
9class SectionProperty extends Base
10{
11 protected $iblockId = 0;
12
16 public function __construct($id)
17 {
18 parent::__construct($id);
19 }
20
28 public function setIblockId($iblockId)
29 {
30 $this->iblockId = intval($iblockId);
31 }
32
40 public function setFields(array $fields)
41 {
42 parent::setFields($fields);
43 if (
44 is_array($this->fields)
45 && $this->iblockId > 0
46 )
47 {
48 foreach ($this->fields as $id => $value)
49 {
50 if (mb_substr($id, 0, 3) === "UF_")
51 {
52 $propertyCode = $id;
53 $fieldCode = mb_strtolower(mb_substr($id, 3));
54 $this->fieldMap[$fieldCode] = $propertyCode;
55 }
56 }
57 }
58 }
59
66 protected function loadFromDatabase()
67 {
69 global $USER_FIELD_MANAGER;
70
71 if (!isset($this->fields) && $this->iblockId > 0)
72 {
73 $userFields = $USER_FIELD_MANAGER->getUserFields(
74 "IBLOCK_".$this->iblockId."_SECTION",
75 $this->id
76 );
77 foreach ($userFields as $id => $uf)
78 {
79 $this->addField(mb_substr($id, 3), $id, $uf["VALUE"]);
80 }
81 }
82 return is_array($this->fields);
83 }
84}