Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
extra.php
1
<?php
2
3
4
namespace
Bitrix\Catalog\Controller
;
5
6
7
use
Bitrix\Catalog\Access\ActionDictionary
;
8
use
Bitrix\Catalog\ExtraTable
;
9
use
Bitrix\Main\Engine\Response\DataType\Page
;
10
use
Bitrix\Main\Error
;
11
use
Bitrix\Main\Result
;
12
use
Bitrix\Main\UI\PageNavigation
;
13
14
final
class
Extra
extends
Controller
15
{
16
//region Actions
17
public
function
getFieldsAction
(): array
18
{
19
return
[
'EXTRA'
=> $this->
getViewFields
()];
20
}
21
22
public
function
listAction
(
PageNavigation
$pageNavigation, array $select = [], array $filter = [], array $order = []):
Page
23
{
24
return
new
Page
(
25
'EXTRAS'
,
26
$this->getList($select, $filter, $order, $pageNavigation),
27
$this->count($filter)
28
);
29
}
30
31
public
function
getAction
($id)
32
{
33
$r = $this->
exists
($id);
34
if
($r->isSuccess())
35
{
36
return
[
'EXTRA'
=>$this->
get
($id)];
37
}
38
else
39
{
40
$this->addErrors($r->getErrors());
41
return
null
;
42
}
43
}
44
//endregion
45
46
protected
function
getEntityTable
()
47
{
48
return
new
ExtraTable
();
49
}
50
51
protected
function
exists
($id)
52
{
53
$r =
new
Result
();
54
if
(isset($this->
get
($id)[
'ID'
]) ==
false
)
55
$r->addError(
new
Error
(
'Extra is not exists'
));
56
57
return
$r;
58
}
59
60
protected
function
checkModifyPermissionEntity
()
61
{
62
$r =
new
Result
();
63
64
if
(!$this->accessController->check(ActionDictionary::ACTION_PRODUCT_PRICE_EXTRA_EDIT))
65
{
66
$r->addError(
new
Error
(
'Access Denied'
, 200040300020));
67
}
68
69
return
$r;
70
}
71
72
protected
function
checkReadPermissionEntity
()
73
{
74
$r =
new
Result
();
75
76
if
(
77
!(
78
$this->accessController->check(ActionDictionary::ACTION_CATALOG_READ)
79
|| $this->accessController->check(ActionDictionary::ACTION_PRICE_EDIT)
80
|| $this->accessController->check(ActionDictionary::ACTION_PRODUCT_PRICE_EXTRA_EDIT)
81
)
82
)
83
{
84
$r->addError(
new
Error
(
'Access Denied'
, 200040300010));
85
}
86
return
$r;
87
}
88
}
Bitrix\Catalog\Access\ActionDictionary
Definition
ActionDictionary.php:17
Bitrix\Catalog\Controller\Controller\getViewFields
getViewFields()
Definition
controller.php:95
Bitrix\Catalog\Controller\Extra
Definition
extra.php:15
Bitrix\Catalog\Controller\Extra\checkModifyPermissionEntity
checkModifyPermissionEntity()
Definition
extra.php:60
Bitrix\Catalog\Controller\Extra\checkReadPermissionEntity
checkReadPermissionEntity()
Definition
extra.php:72
Bitrix\Catalog\Controller\Extra\exists
exists($id)
Definition
extra.php:51
Bitrix\Catalog\Controller\Extra\getEntityTable
getEntityTable()
Definition
extra.php:46
Bitrix\Catalog\Controller\Extra\getFieldsAction
getFieldsAction()
Definition
extra.php:17
Bitrix\Catalog\Controller\Extra\listAction
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])
Definition
extra.php:22
Bitrix\Catalog\Controller\Extra\getAction
getAction($id)
Definition
extra.php:31
Bitrix\Catalog\ExtraTable
Definition
extra.php:36
Bitrix\Main\DB\Result
Definition
result.php:19
Bitrix\Main\Engine\Response\DataType\Page
Definition
page.php:8
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\UI\PageNavigation
Definition
pagenavigation.php:27
Bitrix\Catalog\Controller
Bitrix\Sender\Internals\QueryController
Definition
action.php:8
modules
catalog
lib
controller
extra.php
Создано системой
1.10.0