Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ratio.php
1<?php
2
3
5
6
13
14final 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}
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])
Definition ratio.php:33