1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
template.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Entity;
9
10
use Bitrix\Main\Error;
11
use Bitrix\Main\Localization\Loc;
12
use Bitrix\Sender\TemplateTable;
13
14
Loc::loadMessages(__FILE__);
15
16
class
Template
extends
Base
17
{
23
protected
function
getDefaultData
()
24
{
25
return
array
(
26
'NAME'
=>
''
,
27
'CONTENT'
=>
''
,
28
);
29
}
30
37
protected
function
loadData
($id)
38
{
39
return
TemplateTable::getRowById
($id);
40
}
41
49
protected
function
saveData
($id,
array
$data
)
50
{
51
$sizeInBytes = mb_strlen(
$data
[
'CONTENT'
] ??
""
);
52
$sizeInKilobytes = $sizeInBytes / 1024;
53
$limitInKilobytes = 2.4 * 1024;
54
55
if
($sizeInKilobytes > $limitInKilobytes)
56
{
57
$this->addError(
new
Error
(Loc::getMessage(
'SENDER_INTEGRATION_MAIL_BODY_LIMIT'
)));
58
59
return
null
;
60
}
61
62
63
return
$this->saveByEntity(
TemplateTable::getEntity
(), $id,
$data
);
64
}
65
71
public
function
remove
()
72
{
73
return
$this->removeByEntity(
TemplateTable::getEntity
(), $this->
getId
());
74
}
75
81
public
function
copy
()
82
{
83
$data
= [
84
'ACTIVE'
=> $this->data[
'ACTIVE'
],
85
'NAME'
=> $this->data[
'NAME'
],
86
'CONTENT'
=> $this->data[
'CONTENT'
],
87
];
88
$instance
= static::create()->mergeData(
$data
);
89
return
$instance
->save();
90
}
91
92
99
public
static
function
removeById
($id)
100
{
101
return
static::create()->removeByEntity(
TemplateTable::getEntity
(), $id);
102
}
103
}
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\ORM\Data\DataManager\getEntity
static getEntity()
Определения
datamanager.php:65
Bitrix\Main\ORM\Data\DataManager\getRowById
static getRowById($id, array $parameters=[])
Определения
datamanager.php:380
Bitrix\Sender\Connector\Base
Определения
base.php:13
Bitrix\Sender\Connector\Base\getId
getId()
Определения
base.php:206
Bitrix\Sender\Entity\Template
Определения
template.php:17
Bitrix\Sender\Entity\Template\loadData
loadData($id)
Определения
template.php:37
Bitrix\Sender\Entity\Template\getDefaultData
getDefaultData()
Определения
template.php:23
Bitrix\Sender\Entity\Template\removeById
static removeById($id)
Определения
template.php:99
Bitrix\Sender\Entity\Template\copy
copy()
Определения
template.php:81
Bitrix\Sender\Entity\Template\saveData
saveData($id, array $data)
Определения
template.php:49
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$instance
$instance
Определения
ps_b24_final.php:14
bitrix
modules
sender
lib
entity
template.php
Создано системой
1.14.0