1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
plaintemplate.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\Integration\Bizproc\Message;
4
5use Bitrix\Bizproc\FieldType;
6use Bitrix\Main\Error;
7use Bitrix\Main\Localization\Loc;
8
9Loc::loadMessages(__FILE__);
10
12{
13 protected string $messageText = '';
14
16 {
17 $messageFields['MESSAGE'] = $this->buildMessageText();
18
19 return $messageFields;
20 }
21
22 protected function buildMessageText(): string
23 {
25
26 if ($this->asRobotMessage)
27 {
28 $text .= PHP_EOL . $this->buildRobotText();
29 }
30
31 return $text;
32 }
33
34 protected function buildDescriptionText(): string
35 {
36 $text = mb_substr(\CTextParser::clearAllTags($this->getTextContents()), 0, 200);
37 if (mb_strlen($text) === 200)
38 {
39 $text .= '...';
40 }
41
42 return $text;
43 }
44
45 protected function getTextContents(): string
46 {
47 return $this->messageText;
48 }
49
54 protected function buildRobotText()
55 {
56 return '[size=10][i]'. Loc::getMessage('IM_BIZPROC_MESSAGE_PLAIN_TEMPLATE_SENT_BY_ROBOT') .'[/i][/size]';
57 }
58
59 protected function validate(): void
60 {
61 if ($this->messageText === '')
62 {
63 $fieldsMap = static::getFieldsMap();
64
65 $this->errors->setError(
66 new Error(
67 Loc::getMessage(
68 'IM_BIZPROC_MESSAGE_PLAIN_TEMPLATE_ERROR_EMPTY_FIELD',
69 ['#FIELD_NAME#' => $fieldsMap['MessageText']['Name']]
70 ),
71 )
72 );
73 }
74 }
75
76 public function setFields(array $fields): self
77 {
78 if (!empty($fields['MessageText']))
79 {
80 $this->messageText = trim(\CBPHelper::stringify($fields['MessageText']));
81 }
82
83 return $this;
84 }
85
86 public static function getFieldsMap(): array
87 {
88 return [
89 'MessageText' => [
90 'Name' => Loc::getMessage('IM_BIZPROC_MESSAGE_PLAIN_TEMPLATE_FIELD_NAME_MESSAGE_TEXT'),
91 'FieldName' => 'template_message_text',
92 'Type' => FieldType::TEXT,
93 'Required' => true,
94 'Multiple' => false,
95 ],
96 ];
97 }
98}
$messageFields
Определения callback_ednaru.php:22
buildMessage(array $messageFields)
Определения plaintemplate.php:15
Определения error.php:15
static clearAllTags($text)
Определения textparser.php:2358
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$text
Определения template_pdf.php:79
$fields
Определения yandex_run.php:501