1C-Bitrix
25.700.0
Toggle main menu visibility
Титульная страница
Пространства имен
Пространства имен
Члены пространств имен
Указатель
$
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Функции
_
a
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Переменные
$
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
v
w
Перечисления
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
v
w
Элементы перечислений
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Структуры данных
Структуры данных
Алфавитный указатель структур данных
Иерархия классов
Поля структур
Указатель
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Функции
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Перечисления
Элементы перечислений
Файлы
Файлы
Список членов всех файлов
Указатель
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
б
в
к
л
о
п
с
т
ю
Функции
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
б
в
к
л
о
п
с
т
ю
Блог
Хостинг
•
Указатель
Структуры данных
Пространства имен
Файлы
Функции
Переменные
Перечисления
Элементы перечислений
Страницы
Загрузка...
Поиск...
Не найдено
productpropertybase.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Catalog\Controller;
4
5
use Bitrix\Catalog\Access\ActionDictionary;
6
use Bitrix\Catalog\CatalogIblockTable;
7
use Bitrix\Iblock\PropertyTable;
8
use Bitrix\Main\Error;
9
use Bitrix\Main\Result;
10
11
abstract
class
ProductPropertyBase
extends
Controller
12
{
16
protected
function
getCatalogIds
():
array
17
{
18
$catalogIds = [];
19
$iterator
=
CatalogIblockTable::getList
([
20
'select'
=> [
21
'IBLOCK_ID'
22
],
23
'cache'
=> [
24
'ttl'
=> 86400,
25
],
26
]);
27
while
($row =
$iterator
->fetch())
28
{
29
$catalogIds[] = (int)$row[
'IBLOCK_ID'
];
30
}
31
unset($row,
$iterator
);
32
33
return
$catalogIds;
34
}
16
protected
function
getCatalogIds
():
array
{
…
}
35
40
protected
function
isIblockCatalog
(
int
$iblockId
): bool
41
{
42
return
in_array(
$iblockId
, $this->
getCatalogIds
(),
true
);
43
}
40
protected
function
isIblockCatalog
(
int
$iblockId
): bool {
…
}
44
49
protected
function
checkIblockModifyPermission
(
int
$iblockId
):
Result
50
{
51
$result
=
new
Result
();
52
53
if
(!\CIBlockRights::UserHasRightTo(
$iblockId
,
$iblockId
, self::IBLOCK_EDIT))
54
{
55
$result
->addError(
new
Error
(
'Access Denied'
));
56
}
57
58
return
$result
;
59
}
49
protected
function
checkIblockModifyPermission
(
int
$iblockId
):
Result
{
…
}
60
65
protected
function
checkProperty
(
int
$propertyId):
Result
66
{
67
$result
=
new
Result
();
68
$property = $this->
getPropertyById
($propertyId);
69
if
(!$property)
70
{
71
$result
->addError($this->
getErrorEntityNotExists
());
72
73
return
$result
;
74
}
75
76
if
(!$this->
isIblockCatalog
((
int
)$property[
'IBLOCK_ID'
]))
77
{
78
$result
->addError($this->
getErrorPropertyIblockIsNotCatalog
());
79
80
return
$result
;
81
}
82
83
return
$result
;
84
}
65
protected
function
checkProperty
(
int
$propertyId):
Result
{
…
}
85
90
protected
function
checkFieldsBeforeModify
(
array
$fields
):
Result
91
{
92
$result
=
new
Result
();
93
94
$newPropertyId = (int)
$fields
[
'PROPERTY_ID'
];
95
$checkPropertyResult = $this->
checkProperty
($newPropertyId);
96
if
(!$checkPropertyResult->isSuccess())
97
{
98
$result
->addErrors($checkPropertyResult->getErrors());
99
100
return
$result
;
101
}
102
103
$newProperty = $this->
getPropertyById
($newPropertyId);
104
if
(!$newProperty)
105
{
106
$result
->addError($this->
getErrorEntityNotExists
());
107
108
return
$result
;
109
}
110
111
$iblockPermissionsCheckResult = $this->
checkIblockModifyPermission
($newProperty[
'IBLOCK_ID'
]);
112
if
(!$iblockPermissionsCheckResult->isSuccess())
113
{
114
$result
->addErrors($iblockPermissionsCheckResult->getErrors());
115
116
return
$result
;
117
}
118
119
return
$result
;
120
}
90
protected
function
checkFieldsBeforeModify
(
array
$fields
):
Result
{
…
}
121
125
protected
function
checkReadPermissionEntity
()
126
{
127
$result
=
new
Result
();
128
129
if
(!($this->accessController->check(ActionDictionary::ACTION_CATALOG_READ)))
130
{
131
$result
->addError(
new
Error
(
'Access Denied'
));
132
}
133
134
return
$result
;
135
}
125
protected
function
checkReadPermissionEntity
() {
…
}
136
140
protected
function
checkModifyPermissionEntity
()
141
{
142
return
$this->
checkReadPermissionEntity
();
143
}
140
protected
function
checkModifyPermissionEntity
() {
…
}
144
149
protected
function
getPropertyById
(
int
$id): ?
array
150
{
151
if
($id <= 0)
152
{
153
return
null
;
154
}
155
156
return
PropertyTable::getRow([
157
'select'
=> [
'*'
],
158
'filter'
=> [
159
'=ID'
=> $id,
160
],
161
'cache'
=> [
162
'ttl'
=> 86400,
163
],
164
]);
165
}
149
protected
function
getPropertyById
(
int
$id): ?
array
{
…
}
166
167
protected
function
getErrorPropertyIblockIsNotCatalog
():
Error
168
{
169
return
new
Error
(
'The specified property does not belong to a product catalog'
);
170
}
167
protected
function
getErrorPropertyIblockIsNotCatalog
():
Error
{
…
}
171
172
protected
function
getErrorPropertyInvalidType
():
Error
173
{
174
return
new
Error
(
'Invalid property type specified'
);
175
}
172
protected
function
getErrorPropertyInvalidType
():
Error
{
…
}
176
177
protected
function
getErrorBadPropertyFieldValues
():
Error
178
{
179
return
new
Error
(
'Invalid property field values'
);
180
}
177
protected
function
getErrorBadPropertyFieldValues
():
Error
{
…
}
181
}
11
abstract
class
ProductPropertyBase
extends
Controller
{
…
};
Bitrix\Catalog\Controller\Controller\getErrorEntityNotExists
getErrorEntityNotExists()
Определения
controller.php:163
Bitrix\Catalog\Controller\ProductPropertyBase
Определения
productpropertybase.php:12
Bitrix\Catalog\Controller\ProductPropertyBase\checkModifyPermissionEntity
checkModifyPermissionEntity()
Определения
productpropertybase.php:140
Bitrix\Catalog\Controller\ProductPropertyBase\checkReadPermissionEntity
checkReadPermissionEntity()
Определения
productpropertybase.php:125
Bitrix\Catalog\Controller\ProductPropertyBase\checkIblockModifyPermission
checkIblockModifyPermission(int $iblockId)
Определения
productpropertybase.php:49
Bitrix\Catalog\Controller\ProductPropertyBase\checkProperty
checkProperty(int $propertyId)
Определения
productpropertybase.php:65
Bitrix\Catalog\Controller\ProductPropertyBase\checkFieldsBeforeModify
checkFieldsBeforeModify(array $fields)
Определения
productpropertybase.php:90
Bitrix\Catalog\Controller\ProductPropertyBase\getErrorPropertyInvalidType
getErrorPropertyInvalidType()
Определения
productpropertybase.php:172
Bitrix\Catalog\Controller\ProductPropertyBase\getPropertyById
getPropertyById(int $id)
Определения
productpropertybase.php:149
Bitrix\Catalog\Controller\ProductPropertyBase\isIblockCatalog
isIblockCatalog(int $iblockId)
Определения
productpropertybase.php:40
Bitrix\Catalog\Controller\ProductPropertyBase\getErrorBadPropertyFieldValues
getErrorBadPropertyFieldValues()
Определения
productpropertybase.php:177
Bitrix\Catalog\Controller\ProductPropertyBase\getErrorPropertyIblockIsNotCatalog
getErrorPropertyIblockIsNotCatalog()
Определения
productpropertybase.php:167
Bitrix\Catalog\Controller\ProductPropertyBase\getCatalogIds
getCatalogIds()
Определения
productpropertybase.php:16
Bitrix\Main\Error
Определения
error.php:15
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
$iblockId
$iblockId
Определения
iblock_catalog_edit.php:30
Bitrix\Catalog\Controller
Bitrix\Sale\Discount\Result
Определения
compatibleformat.php:2
$iterator
$iterator
Определения
yandex_run.php:610
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
catalog
lib
controller
productpropertybase.php
Создано системой
1.14.0