Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
method.php
1
<?php
8
namespace
Bitrix\Sender\Dispatch
;
9
10
use
Bitrix\Main\Localization\Loc
;
11
12
use
Bitrix\Main\Type\DateTime
;
13
use
Bitrix\Sender\Entity
;
14
15
Loc::loadMessages
(__FILE__);
16
21
class
Method
implements
iMethod
22
{
23
const
DEFERED
=
'defered'
;
24
const
TIME
=
'time'
;
25
const
SCHEDULE
=
'schedule'
;
26
28
private
$letter;
29
31
private
$method;
32
38
public
function
__construct
(
Entity
\
Letter
$letter)
39
{
40
$this->letter = $letter;
41
42
if
($letter->isReiterate())
43
{
44
$this->
set
(
new
MethodSchedule
($this->letter));
45
}
46
elseif($this->letter->get(
'AUTO_SEND_TIME'
))
47
{
48
$this->
time
($this->letter->get(
'AUTO_SEND_TIME'
));
49
}
50
else
51
{
52
$this->
defer
();
53
}
54
55
}
56
62
public
function
canChange
()
63
{
64
return
(
65
(
66
$this->letter->isReiterate()
67
||
68
!$this->letter->getState()->wasStartedSending()
69
)
70
&&
71
!$this->letter->getState()->isFinished()
72
);
73
}
74
80
public
function
getCode
()
81
{
82
return
$this->method->getCode();
83
}
84
90
public
function
defer
()
91
{
92
$this->
set
(
new
MethodDefered
($this->letter));
93
}
94
101
public
function
time
(
DateTime
$dateTime)
102
{
103
$method =
new
MethodTime
($this->letter);
104
$method->setDateTime($dateTime);
105
$this->
set
($method);
106
}
107
113
public
function
now
()
114
{
115
$this->
time
(
new
DateTime
);
116
}
117
123
public
function
set
(
iMethod
$method)
124
{
125
if
($this->method)
126
{
127
$this->
revoke
();
128
}
129
$this->method = $method;
130
}
131
137
public
function
get
()
138
{
139
return
$this->method;
140
}
141
147
public
function
apply
()
148
{
149
$this->method->apply();
150
}
151
157
public
function
revoke
()
158
{
159
$this->method->revoke();
160
}
161
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Sender\Dispatch\MethodDefered
Definition
methoddefered.php:21
Bitrix\Sender\Dispatch\Method
Definition
method.php:22
Bitrix\Sender\Dispatch\Method\defer
defer()
Definition
method.php:90
Bitrix\Sender\Dispatch\Method\TIME
const TIME
Definition
method.php:24
Bitrix\Sender\Dispatch\Method\canChange
canChange()
Definition
method.php:62
Bitrix\Sender\Dispatch\Method\revoke
revoke()
Definition
method.php:157
Bitrix\Sender\Dispatch\Method\apply
apply()
Definition
method.php:147
Bitrix\Sender\Dispatch\Method\now
now()
Definition
method.php:113
Bitrix\Sender\Dispatch\Method\__construct
__construct(Entity\Letter $letter)
Definition
method.php:38
Bitrix\Sender\Dispatch\Method\DEFERED
const DEFERED
Definition
method.php:23
Bitrix\Sender\Dispatch\Method\getCode
getCode()
Definition
method.php:80
Bitrix\Sender\Dispatch\Method\SCHEDULE
const SCHEDULE
Definition
method.php:25
Bitrix\Sender\Dispatch\Method\time
time(DateTime $dateTime)
Definition
method.php:101
Bitrix\Sender\Dispatch\MethodSchedule
Definition
methodschedule.php:19
Bitrix\Sender\Dispatch\MethodTime
Definition
methodtime.php:18
Bitrix\Sender\Entity\Letter
Definition
letter.php:34
Bitrix\Sender\Dispatch\iMethod
Definition
imethod.php:17
Bitrix\Sender\Dispatch
Definition
duration.php:8
Bitrix\Sender\Entity
Definition
ad.php:8
modules
sender
lib
dispatch
method.php
Создано системой
1.10.0