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