1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
messagecall.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Sender\Integration\VoxImplant;
10
11
use Bitrix\Main\Localization\Loc;
12
use Bitrix\Main\Result;
13
use Bitrix\Sender\Message;
14
use Bitrix\Sender\Entity;
15
16
use Bitrix\Sender\Transport\TimeLimiter;
17
use Bitrix\Voximplant\Tts;
18
use Bitrix\Main\Config\Option;
19
20
Loc::loadMessages(__FILE__);
21
26
class
MessageCall
implements
Message\iBase
,
Message\iMailable
27
{
28
const
CODE
= self::CODE_CALL;
29
31
protected
$configuration
;
32
36
public
function
__construct
()
37
{
38
$this->configuration =
new
Message\Configuration
();
39
}
40
45
public
function
getName
()
46
{
47
return
Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_NAME'
);
48
}
49
55
public
function
getCode
()
56
{
57
return
static::CODE;
58
}
59
65
public
function
getSupportedTransports
()
66
{
67
return
array
(
TransportCall::CODE
);
68
}
69
74
protected
function
setConfigurationOptions
()
75
{
76
if
($this->configuration->hasOptions())
77
{
78
return
;
79
}
80
81
$this->configuration->setArrayOptions(
array
(
82
array
(
83
'type'
=>
'list'
,
84
'code'
=>
'OUTPUT_NUMBER'
,
85
'name'
=> Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_CONFIG_OUTPUT_NUMBER'
),
86
'items'
=> \CVoxImplantConfig::GetPortalNumbers(
false
),
87
'view'
=>
function
()
88
{
89
ob_start();
90
$GLOBALS
[
'APPLICATION'
]->includeComponent(
91
"bitrix:sender.call.number"
,
""
,
92
array
(
93
"INPUT_NAME"
=>
"%INPUT_NAME%"
,
94
"VALUE"
=>
"%INPUT_VALUE%"
,
95
"MESSAGE_TYPE"
=> $this->
getCode
()
96
)
97
);
98
return
ob_get_clean();
99
},
100
'required'
=>
true
,
101
'show_in_list'
=>
true
,
102
'readonly_view'
=>
function
($value)
103
{
104
return
Service::getFormattedOutputNumber
($value);
105
},
106
),
107
array
(
108
'type'
=>
'text'
,
109
'code'
=>
'MESSAGE_TEXT'
,
110
'name'
=> Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_CONFIG_MESSAGE_TEXT'
),
111
'required'
=>
true
,
112
),
113
array
(
114
'type'
=>
'list'
,
115
'code'
=>
'VOICE_LANGUAGE'
,
116
'name'
=> Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_CONFIG_VOICE_LANGUAGE'
),
117
'items'
=> Tts\Language::getList(),
118
'required'
=>
true
,
119
'group'
=>
Message
\
ConfigurationOption::GROUP_ADDITIONAL
,
120
),
121
array
(
122
'type'
=>
'list'
,
123
'code'
=>
'VOICE_SPEED'
,
124
'name'
=> Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_CONFIG_VOICE_SPEED'
),
125
'items'
=> Tts\Speed::getList(),
126
'required'
=>
true
,
127
'group'
=>
Message
\
ConfigurationOption::GROUP_ADDITIONAL
,
128
),
129
array
(
130
'type'
=>
'list'
,
131
'code'
=>
'VOICE_VOLUME'
,
132
'name'
=> Loc::getMessage(
'SENDER_INTEGRATION_CALL_MESSAGE_CONFIG_VOICE_VOLUME'
),
133
'items'
=> Tts\Volume::getList(),
134
'required'
=>
true
,
135
'group'
=>
Message
\
ConfigurationOption::GROUP_ADDITIONAL
,
136
),
137
));
138
139
TimeLimiter::prepareMessageConfiguration($this->configuration);
140
}
141
149
public
function
loadConfiguration
($id =
null
)
150
{
151
$this->
setConfigurationOptions
();
152
Entity\Message::create()
153
->setCode($this->
getCode
())
154
->loadConfiguration($id, $this->configuration);
155
156
$defaultValues
=
array
(
157
'VOICE_VOLUME'
=> Tts\Volume::getDefault(),
158
'VOICE_SPEED'
=> Tts\Speed::getDefault(),
159
'VOICE_LANGUAGE'
=> Tts\Language::getDefaultVoice(LANGUAGE_ID),
160
);
161
foreach
(
$defaultValues
as
$key
=> $value)
162
{
163
$option
= $this->configuration->getOption(
$key
);
164
if
(!
$option
||
$option
->hasValue())
165
{
166
continue
;
167
}
168
169
$option
->setValue($value);
170
}
171
172
$textOption = $this->configuration->getOption(
'MESSAGE_TEXT'
);
173
if
($textOption)
174
{
175
$speedOption = $this->configuration->getOption(
'VOICE_SPEED'
);
176
$textOption->setView(
177
function
() use ($speedOption)
178
{
179
ob_start();
180
$GLOBALS
[
'APPLICATION'
]->includeComponent(
181
"bitrix:sender.call.text.editor"
,
182
".default"
,
183
array
(
184
"INPUT_NAME"
=>
"%INPUT_NAME%"
,
185
"VALUE"
=>
"%INPUT_VALUE%"
,
186
"SPEED_INPUT_NAME"
=> $speedOption
187
?
188
"%INPUT_NAME_"
. $speedOption->getCode() .
"%"
189
:
190
''
191
)
192
);
193
194
return
ob_get_clean();
195
}
196
);
197
}
198
TimeLimiter::prepareMessageConfigurationView($this->configuration);
199
200
return
$this->configuration
;
201
}
202
210
public
function
saveConfiguration
(
Message
\
Configuration
$configuration
)
211
{
212
return
Entity\Message::create()
213
->setCode($this->
getCode
())
214
->saveConfiguration($this->configuration);
215
}
216
223
public
function
removeConfiguration
($id)
224
{
225
$result
=
Entity\Message::removeById
($id);
226
return
$result
->isSuccess();
227
}
228
235
public
function
copyConfiguration
($id)
236
{
237
return
Entity\Message::create()
238
->setCode($this->
getCode
())
239
->copyConfiguration($id);
240
}
241
}
Bitrix\Main\Config\Configuration
Определения
configuration.php:9
Bitrix\Sender\Entity\Message\removeById
static removeById($id)
Определения
message.php:146
Bitrix\Sender\Integration\VoxImplant\MessageCall
Определения
messagecall.php:27
Bitrix\Sender\Integration\VoxImplant\MessageCall\CODE
const CODE
Определения
messagecall.php:28
Bitrix\Sender\Integration\VoxImplant\MessageCall\__construct
__construct()
Определения
messagecall.php:36
Bitrix\Sender\Integration\VoxImplant\MessageCall\setConfigurationOptions
setConfigurationOptions()
Определения
messagecall.php:74
Bitrix\Sender\Integration\VoxImplant\MessageCall\getName
getName()
Определения
messagecall.php:45
Bitrix\Sender\Integration\VoxImplant\MessageCall\removeConfiguration
removeConfiguration($id)
Определения
messagecall.php:223
Bitrix\Sender\Integration\VoxImplant\MessageCall\loadConfiguration
loadConfiguration($id=null)
Определения
messagecall.php:149
Bitrix\Sender\Integration\VoxImplant\MessageCall\$configuration
$configuration
Определения
messagecall.php:31
Bitrix\Sender\Integration\VoxImplant\MessageCall\getCode
getCode()
Определения
messagecall.php:55
Bitrix\Sender\Integration\VoxImplant\MessageCall\copyConfiguration
copyConfiguration($id)
Определения
messagecall.php:235
Bitrix\Sender\Integration\VoxImplant\MessageCall\saveConfiguration
saveConfiguration(Message\Configuration $configuration)
Определения
messagecall.php:210
Bitrix\Sender\Integration\VoxImplant\MessageCall\getSupportedTransports
getSupportedTransports()
Определения
messagecall.php:65
Bitrix\Sender\Integration\VoxImplant\Service\getFormattedOutputNumber
static getFormattedOutputNumber($value)
Определения
service.php:125
Bitrix\Sender\Integration\VoxImplant\TransportCall\CODE
const CODE
Определения
transportcall.php:26
Bitrix\Sender\Message\ConfigurationOption\GROUP_ADDITIONAL
const GROUP_ADDITIONAL
Определения
configurationoption.php:35
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$defaultValues
$defaultValues
Определения
iblock_catalog_edit.php:124
Bitrix\Sender\Message\iBase
Определения
ibase.php:16
Bitrix\Sender\Message\iMailable
Определения
imailable.php:16
Bitrix\Main\$GLOBALS
$GLOBALS['____1690880296']
Определения
license.php:1
Bitrix\Sender\Message
Определения
adapter.php:9
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
$option
$option
Определения
options.php:1711
bitrix
modules
sender
lib
integration
voximplant
messagecall.php
Создано системой
1.14.0