Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
exchange.php
1<?php
2
3
5
6
9
11{
12 protected $providerType = null;
13
19 public function __construct($providerType)
20 {
21 if($providerType == '')
22 {
23 throw new ArgumentException('Options providerType must be specified', 'providerType');
24 }
25
26 $this->providerType = $providerType;
27 }
28
34 public function add(array $params)
35 {
36 $params['PROVIDER'] = $this->providerType;
37 return ExchangeLogTable::add($params);
38 }
39
47 public function getList(array $params)
48 {
49 $params['filter'] = isset($params['filter']) ? $params['filter']:[];
50
51 $params['filter']['PROVIDER'] = $this->providerType;
52 return ExchangeLogTable::getList($params);
53 }
54
64 public function getEffectedRows($timeUpdate, $entityTypeId, $direction)
65 {
66 $result = array();
67
68 if($timeUpdate <> '')
69 {
70 $r = ExchangeLogTable::getList(array(
71 'select' => array(
72 'ENTITY_ID',
73 'ENTITY_DATE_UPDATE'
74 ),
75 'filter' => array(
76 'ENTITY_TYPE_ID'=>$entityTypeId,
77 '=ENTITY_DATE_UPDATE'=>$timeUpdate,
78 '=DIRECTION'=>$direction,
79 '=PROVIDER'=>$this->providerType,
80 ),
81 'order'=>array('ID'=>'ASC'),
82
83 ));
84 while ($order = $r->fetch())
85 $result[$order['ENTITY_DATE_UPDATE']->toString()][]=$order['ENTITY_ID'];
86 }
87 return $result;
88 }
89
90 public function isEffected($list, array $logs)
91 {
92 $dateUpdate = $list["DATE_UPDATE"]->toString();
93
94 $result = (isset($logs[$dateUpdate]) &&
95 in_array($list['ID'], $logs[$dateUpdate]));
96
97 return $result;
98 }
99
103 public function deleteOldRecords($direction, $interval)
104 {
105 ExchangeLogTable::deleteOldRecords($direction, $this->providerType, $interval);
106 }
107}
static deleteOldRecords($direction, $provider, $interval)
getEffectedRows($timeUpdate, $entityTypeId, $direction)
Definition exchange.php:64
deleteOldRecords($direction, $interval)
Definition exchange.php:103