Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
profilevalue.php
1<?php
2
3
5
6
12
13Loc::loadMessages(__FILE__);
14
16{
17 //region Actions
18 public function getFieldsAction()
19 {
20 $view = $this->getViewManager()
21 ->getView($this);
22
23 return ['PROFILE_VALUE'=>$view->prepareFieldInfos(
24 $view->getFields()
25 )];
26 }
27
28 public function listAction(PageNavigation $pageNavigation, array $select = [], array $filter = [], array $order = [])
29 {
30 $result = [];
31
32 $select = empty($select)? ['*']:$select;
33 $order = empty($order)? ['ID'=>'ASC']:$order;
34
35 $r = \CSaleOrderUserPropsValue::GetList($order, $filter, false, self::getNavData($pageNavigation->getOffset()), $select);
36 while ($l = $r->fetch())
37 $result[] = $l;
38
39 return new Page('PROFILE_VALUES', $result, function() use ($filter)
40 {
41 return (int)\CSaleOrderUserPropsValue::GetList([], $filter, []);
42 });
43 }
44
45 public function getAction($id)
46 {
47 $r = $this->exists($id);
48 if($r->isSuccess())
49 {
50 return ['PROFILE_VALUE'=>$this->get($id)];
51 }
52 else
53 {
54 $this->addErrors($r->getErrors());
55 return null;
56 }
57 }
58 //endregion
59
60 protected function exists($id)
61 {
62 $r = new Result();
63 if(isset($this->get($id)['ID']) == false)
64 $r->addError(new Error('ProfileValue is not exists'));
65
66 return $r;
67 }
68
69 protected function get($id)
70 {
71 return \CSaleOrderUserPropsValue::GetByID($id);
72 }
73
74 protected function checkReadPermissionEntity()
75 {
76 $r = new Result();
77
78 if (self::getApplication()->GetGroupRight("sale") == "D")
79 {
80 $r->addError(new Error('Buyer access denied'));
81 }
82
83 return $r;
84 }
85}
static loadMessages($file)
Definition loc.php:64
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])