Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
messageim.php
1
<?php
9
namespace
Bitrix\Sender\Integration\Im
;
10
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\Result
;
13
use
Bitrix\Sender\Message
;
14
use
Bitrix\Sender\Entity
;
15
use
Bitrix\Sender\Transport\TimeLimiter
;
16
17
Loc::loadMessages
(__FILE__);
18
23
class
MessageIm
implements
Message\iBase
,
Message\iMailable
24
{
25
const
CODE
=
self::CODE_IM
;
26
28
protected
$configuration
;
29
33
public
function
__construct
()
34
{
35
$this->configuration =
new
Message\Configuration
();
36
}
37
42
public
function
getName
()
43
{
44
return
Loc::getMessage
(
'SENDER_INTEGRATION_IM_MESSAGE_NAME'
);
45
}
46
47
public
function
getCode
()
48
{
49
return
static::CODE;
50
}
51
52
public
function
getSupportedTransports
()
53
{
54
return
array(
TransportIm::CODE
);
55
}
56
57
protected
function
setConfigurationOptions
()
58
{
59
$this->configuration->setArrayOptions(array(
60
array(
61
'type'
=>
'text'
,
62
'code'
=>
'MESSAGE_TEXT'
,
63
'name'
=>
Loc::getMessage
(
'SENDER_INTEGRATION_IM_MESSAGE_CONFIG_MESSAGE_TEXT'
),
64
'required'
=>
true
,
65
),
66
));
67
68
TimeLimiter::prepareMessageConfiguration($this->configuration);
69
}
70
78
public
function
loadConfiguration
($id =
null
)
79
{
80
if
(!$this->configuration->hasOptions())
81
{
82
$this->
setConfigurationOptions
();
83
}
84
85
$configuration
=
$this->configuration
;
86
$this->configuration->setView(
87
function
() use (
$configuration
)
88
{
89
ob_start();
90
$GLOBALS
[
'APPLICATION'
]->IncludeComponent(
91
'bitrix:sender.im.message'
,
92
''
,
93
array(
94
'INPUT_NAME'
=>
'%INPUT_NAME_MESSAGE_TEXT%'
,
95
'VALUE'
=>
$configuration
->get(
'MESSAGE_TEXT'
),
96
)
97
);
98
99
return
ob_get_clean();
100
}
101
);
102
103
Entity\Message::create()
104
->setCode($this->
getCode
())
105
->loadConfiguration($id, $this->configuration);
106
107
TimeLimiter::prepareMessageConfigurationView($this->configuration);
108
109
return
$this->configuration
;
110
}
111
119
public
function
saveConfiguration
(
Message
\
Configuration
$configuration
)
120
{
121
return
Entity\Message::create()
122
->setCode($this->
getCode
())
123
->saveConfiguration($this->configuration);
124
}
125
132
public
function
removeConfiguration
($id)
133
{
134
$result = Entity\Message::removeById($id);
135
return
$result->isSuccess();
136
}
137
144
public
function
copyConfiguration
($id)
145
{
146
return
Entity\Message::create()
147
->setCode($this->
getCode
())
148
->copyConfiguration($id);
149
}
150
}
Bitrix\Main\Config\Configuration
Definition
configuration.php:7
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Sender\Entity\Message
Definition
message.php:27
Bitrix\Sender\Integration\Im\MessageIm
Definition
messageim.php:24
Bitrix\Sender\Integration\Im\MessageIm\CODE
const CODE
Definition
messageim.php:25
Bitrix\Sender\Integration\Im\MessageIm\__construct
__construct()
Definition
messageim.php:33
Bitrix\Sender\Integration\Im\MessageIm\setConfigurationOptions
setConfigurationOptions()
Definition
messageim.php:57
Bitrix\Sender\Integration\Im\MessageIm\getName
getName()
Definition
messageim.php:42
Bitrix\Sender\Integration\Im\MessageIm\removeConfiguration
removeConfiguration($id)
Definition
messageim.php:132
Bitrix\Sender\Integration\Im\MessageIm\loadConfiguration
loadConfiguration($id=null)
Definition
messageim.php:78
Bitrix\Sender\Integration\Im\MessageIm\$configuration
$configuration
Definition
messageim.php:28
Bitrix\Sender\Integration\Im\MessageIm\getCode
getCode()
Definition
messageim.php:47
Bitrix\Sender\Integration\Im\MessageIm\copyConfiguration
copyConfiguration($id)
Definition
messageim.php:144
Bitrix\Sender\Integration\Im\MessageIm\saveConfiguration
saveConfiguration(Message\Configuration $configuration)
Definition
messageim.php:119
Bitrix\Sender\Integration\Im\MessageIm\getSupportedTransports
getSupportedTransports()
Definition
messageim.php:52
Bitrix\Sender\Integration\Im\TransportIm\CODE
const CODE
Definition
transportim.php:21
Bitrix\Sender\Transport\TimeLimiter
Definition
timelimiter.php:16
Bitrix\Sender\Message\iBase
Definition
ibase.php:16
Bitrix\Sender\Message\iBase\CODE_IM
const CODE_IM
Definition
ibase.php:21
Bitrix\Sender\Message\iMailable
Definition
imailable.php:16
Bitrix\Main\$GLOBALS
$GLOBALS['____1444769544']
Definition
license.php:1
Bitrix\Sender\Entity
Definition
ad.php:8
Bitrix\Sender\Integration\Im
Definition
messageim.php:9
Bitrix\Sender\Message
Definition
adapter.php:9
modules
sender
lib
integration
im
messageim.php
Создано системой
1.10.0