Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
durationdatebased.php
1<?php
9
11
14
15Loc::loadMessages(__FILE__);
16
22{
24 private $letter;
25
31 public function __construct(Entity\Letter $letter)
32 {
33 $this->letter = $letter;
34 }
35
42 public function getInterval($count)
43 {
44 $sent = $this->letter->getCounter()->getSent();
45 if (!$sent)
46 {
47 return 0;
48 }
49
50 return ceil(($this->getElapsedInterval() / $sent) * $count);
51 }
52
58 private function getElapsedInterval()
59 {
61 $start = $this->letter->get('DATE_SEND');
62 if (!$start)
63 {
64 return 0;
65 }
66
67 $now = new DateTime;
68 return $now->getTimestamp() - $start->getTimestamp();
69 }
70}
static loadMessages($file)
Definition loc.php:64