Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
statisticsprovider.php
1<?php
2
3
5
6
8
11{
12
13 static public function getProxy()
14 {
16 }
17
23 static public function add(array $fields)
24 {
25 $proxy = static::getProxy();
26 $r = $proxy->add($fields);
27 if($r->isSuccess())
28 {
29 $result = $r->getData()['DATA']['result'];
30 }
31 else
32 {
33 throw new Integration\Exception\CommandLineException(implode(',', $r->getErrorMessages()));
34 }
35
36 return $result;
37 }
38
39 static public function getList($filter)
40 {
41 $proxy = static::getProxy();
42 $r = $proxy->getList([], $filter);
43 if($r->isSuccess())
44 {
45 $result = $r->getData()['DATA']['result'];
46 }
47 else
48 {
49 $result['error'] = $r->getErrorMessages();
50 }
51 return $result;
52 }
53
54// static public function register(array $params)
55// {
56// $result = static::getList(['xmlId'=>$params['fields']['xmlId']]);
57//
58// if($result['statisticProviders'][0])
59// {
60// $providerId = $result['statisticProviders'][0]['id'];
61// }
62// else
63// {
64// $providerId = static::add($params['fields'])['statisticProvider']['id'];
65// }
66//
67// return $providerId > 0;
68// }
69
70}