1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
template.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Preset;
9
10use Bitrix\Main\Localization\Loc;
11
12use Bitrix\Sender\Templates;
13use Bitrix\Sender\TemplateTable;
14
15Loc::loadMessages(__FILE__);
16
24{
30 public static function getListByType()
31 {
32 return Templates\Selector::create()->getCategorized();
33 }
34
40 public static function getTypeList()
41 {
43 }
44
52 public static function getById($type, $id)
53 {
55 ->withTypeId($type)
56 ->withId($id)
57 ->get();
58 }
59
66 public static function getList(array $parameters = array())
67 {
68 $selector = Templates\Selector::create();
69 if (isset($parameters[0]))
70 {
71 $selector->withTypeId($parameters[0]);
72 }
73 if (isset($parameters[1]))
74 {
75 $selector->withId($parameters[1]);
76 }
77 return $selector->withDefaultMessageCode()->getList();
78 }
79
87 public static function getTemplateListHtml($containerId = 'TEMPLATE_CONTAINER')
88 {
89 static $templateListByType;
90
91 if(!$templateListByType)
93
95
96 ob_start();
97 ?>
98 <script>
99 BX.ready(function(){
100 letterManager = new SenderLetterManager;
101 if(!letterManager.get('<?=$containerId?>'))
102 {
103 letterManager.add('<?=$containerId?>', {'container': BX('<?=$containerId?>')});
104 }
105 });
106 </script>
107 <div class="sender-template-cont">
108 <div>
109 <table style="width: 100%;">
110 <tr>
111 <td style="vertical-align: top;">
112 <div class="sender-template-type-selector">
113 <?
114 $firstTemplateType = null;
115 foreach($templateTypeList as $templateType => $templateTypeName):
116 if(!$firstTemplateType) $firstTemplateType = $templateType;
117 ?>
118 <div class="sender-template-type-selector-button sender-template-type-selector-button-type-<?=$templateType?>"
119 data-bx-sender-tmpl-type="<?=htmlspecialcharsbx($templateType)?>">
120 <?=$templateTypeName?>
121 </div>
122 <?endforeach;?>
123 </div>
124 </td>
125 <td style="vertical-align: top; width: 100%;">
126 <div class="sender-template-list-container">
127 <?foreach($templateTypeList as $templateType => $templateTypeName):?>
128 <div id="sender-template-list-type-container-<?=$templateType?>" class="sender-template-list-type-container sender-template-list-type-container-<?=$templateType?>" style="display: none;">
129 <?
130 if(isset($templateListByType[$templateType]))
131 foreach($templateListByType[$templateType] as $templateNum => $template):
132 $isContentForBlockEditor = TemplateTable::isContentForBlockEditor($template['HTML']);
133 ?>
134 <div class="sender-template-list-type-block">
135 <div class="sender-template-list-type-block-caption sender-template-list-block-selector"
136 data-bx-sender-tmpl-version="<?=($isContentForBlockEditor?'block':'visual')?>"
137 data-bx-sender-tmpl-name="<?=htmlspecialcharsbx($template['NAME'])?>"
138 data-bx-sender-tmpl-type="<?=htmlspecialcharsbx($template['TYPE'])?>"
139 data-bx-sender-tmpl-code="<?=htmlspecialcharsbx($template['ID'])?>"
140 data-bx-sender-tmpl-lang="<?=LANGUAGE_ID?>">
141 <a class="sender-link-email" href="javascript: void(0);">
142 <?=htmlspecialcharsbx($template['NAME'])?>
143 </a>
144 <?if(!$isContentForBlockEditor):?>
145 <br>
146 <span style="font-size: 10px;"><?=Loc::getMessage('SENDER_PRESET_TEMPLATE_OLD_EDITOR')?></span>
147 <?endif;?>
148 </div>
149 <div class="sender-template-list-type-block-img sender-template-list-block-selector"
150 data-bx-sender-tmpl-version="<?=($isContentForBlockEditor?'block':'visual')?>"
151 data-bx-sender-tmpl-name="<?=htmlspecialcharsbx($template['NAME'])?>"
152 data-bx-sender-tmpl-type="<?=htmlspecialcharsbx($template['TYPE'])?>"
153 data-bx-sender-tmpl-code="<?=htmlspecialcharsbx($template['ID'])?>"
154 data-bx-sender-tmpl-lang="<?=LANGUAGE_ID?>">
155 <?if(!empty($template['ICON'])):?>
156 <img src="<?=$template['ICON']?>">
157 <?endif;?>
158 </div>
159 <?if(!empty($template['HTML'])):?>
160 <div class="sender-template-message-preview-btn"
161 data-bx-sender-tmpl-name="<?=htmlspecialcharsbx($template['NAME'])?>"
162 data-bx-sender-tmpl-type="<?=htmlspecialcharsbx($template['TYPE'])?>"
163 data-bx-sender-tmpl-code="<?=htmlspecialcharsbx($template['ID'])?>"
164 data-bx-sender-tmpl-lang="<?=LANGUAGE_ID?>">
165 <a class="sender-link-email " href="javascript: void(0);"><?=Loc::getMessage('SENDER_PRESET_TEMPLATE_BTN_PREVIEW')?></a>
166 </div>
167 <?endif;?>
168 </div>
169 <?endforeach;?>
170 <?if(empty($templateListByType[$templateType])):?>
171 <div class="sender-template-list-type-blockempty">
172 <?=Loc::getMessage('SENDER_PRESET_TEMPLATE_NO_TMPL')?>
173 </div>
174 <?endif;?>
175 </div>
176 <?endforeach;?>
177 </div>
178 </td>
179 <td style="vertical-align: top;">
180 <span class="sender-template-btn-close" title="<?=Loc::getMessage('SENDER_PRESET_TEMPLATE_BTN_CLOSE')?>"></span>
181 </td>
182 </tr>
183 </table>
184 </div>
185 </div>
186 <?
187 return ob_get_clean();
188 }
189}
$type
Определения options.php:106
xml version
Определения yandex.php:67
static getTypeList()
Определения template.php:40
static getById($type, $id)
Определения template.php:52
static getList(array $parameters=array())
Определения template.php:66
static getListByType()
Определения template.php:30
static getTemplateListHtml($containerId='TEMPLATE_CONTAINER')
Определения template.php:87
static isContentForBlockEditor($content)
Определения template.php:273
static create()
Определения selector.php:47
$template
Определения file_edit.php:49
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
endif
Определения csv_new_setup.php:990
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
global_menu_<?echo $menu["menu_id"]?> adm main menu item icon adm main menu item text text adm main menu hover adm submenu menucontainer menu_id menu_id items_id items_id desktop menu_id block none adm global submenu<?=($subMenuDisplay=="block" ? " adm-global-submenu-active" :"")?> global_submenu_<?echo $menu["menu_id"]?> text MAIN_PR_ADMIN_FAV items adm submenu items wrap adm submenu items stretch wrap BX adminMenu itemsStretchScroll()"> <table class if (!empty( $menu["items"])) elseif ( $menu[ 'menu_id']=='desktop') if ( $menu[ 'menu_id']=='desktop') endforeach
Определения prolog_main_admin.php:255
<? endif;?> window document title
Определения prolog_main_admin.php:76
lang
Определения options.php:182
font style
Определения invoice.php:442