1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
template.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Entity;
9
10use Bitrix\Main\Error;
11use Bitrix\Main\Localization\Loc;
12use Bitrix\Sender\TemplateTable;
13
14Loc::loadMessages(__FILE__);
15
16class 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}
Определения error.php:15
static getEntity()
Определения datamanager.php:65
static getRowById($id, array $parameters=[])
Определения datamanager.php:380
loadData($id)
Определения template.php:37
static removeById($id)
Определения template.php:99
saveData($id, array $data)
Определения template.php:49
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$instance
Определения ps_b24_final.php:14