Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messageim.php
1<?php
10
16
17Loc::loadMessages(__FILE__);
18
24{
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 {
83 }
84
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
110 }
111
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
saveConfiguration(Message\Configuration $configuration)
$GLOBALS['____1444769544']
Definition license.php:1