Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
calllog.php
1<?php
9
13
14Loc::loadMessages(__FILE__);
15
33class CallLogTable extends Entity\DataManager
34{
40 public static function getRecipientIdByCallId($callId)
41 {
42 $row = static::getRowById(array('CALL_ID' => $callId));
43 return $row ? $row['RECIPIENT_ID'] : null;
44 }
45
51 public static function getActualCallCount()
52 {
53 return static::getCount(
54 array('>DATE_INSERT' => static::getFilterCurrentDate()),
55 array('ttl' => 900)
56 );
57 }
58
59 protected static function getFilterCurrentDate()
60 {
61 $dateTime = new Type\DateTime();
62 return $dateTime->add('-15 minutes');
63 }
64
71 public static function removeByCallId($callId = null)
72 {
73 $list = static::getList(array(
74 'select' => array('CALL_ID', 'RECIPIENT_ID'),
75 'filter' => array(
76 'LOGIC' => 'OR',
77 '=CALL_ID' => $callId,
78 '<DATE_INSERT' => static::getFilterCurrentDate(),
79 )
80 ));
81 foreach ($list as $item)
82 {
83 static::delete($item);
84 }
85 }
86
92 public static function getTableName()
93 {
94 return 'b_sender_call_log';
95 }
96
102 public static function getMap()
103 {
104 return array(
105 'CALL_ID' => array(
106 'data_type' => 'string',
107 'primary' => true,
108 ),
109 'RECIPIENT_ID' => array(
110 'data_type' => 'integer',
111 'primary' => true,
112 ),
113 'DATE_INSERT' => array(
114 'data_type' => 'datetime',
115 'required' => true,
116 'default_value' => new Type\DateTime(),
117 ),
118 );
119 }
120}
static loadMessages($file)
Definition loc.php:64