Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ratio.php
1
<?php
2
3
4
namespace
Bitrix\Catalog\Controller
;
5
6
7
use
Bitrix\Catalog\Access\ActionDictionary
;
8
use
Bitrix\Catalog\MeasureRatioTable
;
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
Ratio
extends
Controller
15
{
16
//region Actions
17
public
function
getFieldsAction
(): array
18
{
19
return
[
'RATIO'
=> $this->
getViewFields
()];
20
}
21
33
public
function
listAction
(
PageNavigation
$pageNavigation, array $select = [], array $filter = [], array $order = []):
Page
34
{
35
return
new
Page
(
36
'RATIOS'
,
37
$this->getList($select, $filter, $order, $pageNavigation),
38
$this->count($filter)
39
);
40
}
41
42
public
function
getAction
($id)
43
{
44
$r = $this->
exists
($id);
45
if
($r->isSuccess())
46
{
47
return
[
'RATIO'
=>$this->
get
($id)];
48
}
49
else
50
{
51
$this->addErrors($r->getErrors());
52
return
null
;
53
}
54
}
55
//endregion
56
57
protected
function
getEntityTable
()
58
{
59
return
new
MeasureRatioTable
();
60
}
61
62
protected
function
exists
($id)
63
{
64
$r =
new
Result
();
65
if
(isset($this->
get
($id)[
'ID'
]) ==
false
)
66
$r->addError(
new
Error
(
'Ratio is not exists'
));
67
68
return
$r;
69
}
70
71
protected
function
checkModifyPermissionEntity
()
72
{
73
$r =
new
Result
();
74
75
if
(!$this->accessController->check(ActionDictionary::ACTION_PRICE_GROUP_EDIT))
76
{
77
$r->addError(
new
Error
(
'Access Denied'
, 200040300020));
78
}
79
80
return
$r;
81
}
82
83
protected
function
checkReadPermissionEntity
()
84
{
85
$r =
new
Result
();
86
87
if
(
88
!(
89
$this->accessController->check(ActionDictionary::ACTION_CATALOG_READ)
90
|| $this->accessController->check(ActionDictionary::ACTION_PRICE_GROUP_EDIT)
91
)
92
)
93
{
94
$r->addError(
new
Error
(
'Access Denied'
, 200040300010));
95
}
96
return
$r;
97
}
98
}
Bitrix\Catalog\Access\ActionDictionary
Definition
ActionDictionary.php:17
Bitrix\Catalog\Controller\Controller\getViewFields
getViewFields()
Definition
controller.php:95
Bitrix\Catalog\Controller\Ratio
Definition
ratio.php:15
Bitrix\Catalog\Controller\Ratio\checkModifyPermissionEntity
checkModifyPermissionEntity()
Definition
ratio.php:71
Bitrix\Catalog\Controller\Ratio\checkReadPermissionEntity
checkReadPermissionEntity()
Definition
ratio.php:83
Bitrix\Catalog\Controller\Ratio\exists
exists($id)
Definition
ratio.php:62
Bitrix\Catalog\Controller\Ratio\getEntityTable
getEntityTable()
Definition
ratio.php:57
Bitrix\Catalog\Controller\Ratio\getFieldsAction
getFieldsAction()
Definition
ratio.php:17
Bitrix\Catalog\Controller\Ratio\listAction
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])
Definition
ratio.php:33
Bitrix\Catalog\Controller\Ratio\getAction
getAction($id)
Definition
ratio.php:42
Bitrix\Catalog\MeasureRatioTable
Definition
measureratio.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
ratio.php
Создано системой
1.10.0