8namespace Bitrix\Sender\Preset;
10use Bitrix\Main\Application;
11use Bitrix\Main\Loader;
12use Bitrix\Main\IO\File;
13use Bitrix\Main\Localization\Loc;
14use Bitrix\Fileman\Block\Editor as BlockEditor;
16use Bitrix\Sender\Integration;
18Loc::loadMessages(__FILE__);
40 $resultList =
array();
42 $templateList = static::getListName();
45 foreach ($templateList as $templateName)
52 $template = static::getById($templateName);
56 if(
$template[
'TYPE'] === $templateType || !$templateType)
76 $resultList =
array();
83 if($templateType && $templateType !==
'SITE_TMPL')
97 Loader::includeModule(
'fileman');
98 $replaceAttr = BlockEditor::BLOCK_PLACE_ATTR .
'="' . BlockEditor::BLOCK_PLACE_ATTR_DEF_VALUE .
'"';
99 $replaceText =
'<div style="padding: 20px; border: 2px dashed #868686;"><span style="color: #868686; font-size: 20px;">' . Loc::getMessage(
'PRESET_TEMPLATE_LIST_SITE_DEF_TEXT') .
'</span></div>';
107 $replaceTo = $replaceText;
110 $html = preg_replace(
'/<\?[\w\w].*?B_PROLOG_INCLUDED[^>].*?\?>/is',
'', $html);
111 if(mb_stripos($html, $replaceAttr) ===
false)
113 $replaceTo =
'<div id="bxStylistBody" ' . $replaceAttr .
'>' . $replaceText .
'</div>';
122 $resultList[] =
array(
123 'TYPE' =>
'SITE_TMPL',
138 $templateNameList =
array(
153 return $templateNameList;
164 $localPathOfIcon = static::LOCAL_DIR_IMG .
bx_basename($templateName) .
'.png';
165 $fullPathOfIcon = Loader::getLocal($localPathOfIcon);
167 $fullPathOfFile = Loader::getLocal(static::LOCAL_DIR_TMPL .
bx_basename($templateName) .
'.php');
168 if ($fullPathOfFile && File::isFileExists($fullPathOfFile))
179 Loader::includeModule(
'fileman');
186 array(
'%TEXT_UNSUB_TEXT%',
'%TEXT_UNSUB_LINK%'),
188 Loc::getMessage(
'PRESET_MAILBLOCK_unsub_TEXT_UNSUB_TEXT'),
189 Loc::getMessage(
'PRESET_MAILBLOCK_unsub_TEXT_UNSUB_LINK')
196 'ID' => $templateName,
197 'NAME' => Loc::getMessage(
'PRESET_TEMPLATE_' . $templateName),
211 $phone =
'8 495 212-85-06';
212 $phonePath = Application::getDocumentRoot() .
'/include/telephone.php';
213 $logoHeader =
'/include/logo.png';
214 $logoFooter =
'/include/logo_mobile.png';
215 if(!File::isFileExists(Application::getDocumentRoot() . $logoHeader))
217 $logoHeader =
'/bitrix/images/sender/preset/blocked1/logo.png';
219 if(!File::isFileExists(Application::getDocumentRoot() . $logoFooter))
221 $logoFooter =
'/bitrix/images/sender/preset/blocked1/logo_m.png';;
224 if(File::isFileExists($phonePath))
226 $phone = File::getFileContents($phonePath);
229 $themeContent = File::getFileContents(Loader::getLocal(static::LOCAL_DIR_TMPL .
'theme.php'));
232 '%TEMPLATE_CONTENT%',
'%LOGO_PATH_HEADER%',
'%LOGO_PATH_FOOTER%',
'%PHONE%',
233 '%UNSUB_LINK%',
'%MENU_CONTACTS%',
234 '%MENU_HOWTO%',
'%MENU_DELIVERY%',
235 '%MENU_ABOUT%',
'%MENU_GUARANTEE%',
236 '%SCHEDULE_NAME%',
'%SCHEDULE_DETAIL%',
238 '%BUTTON%',
'%HEADER%',
239 '%TEXT1%',
'%TEXT2%',
240 '%TEXT3%',
'%TEXT4%',
241 '%TEXT5%',
'%TEXT6%',
244 $template, $logoHeader, $logoFooter, $phone,
245 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_UNSUB_LINK'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_MENU_CONTACTS'),
246 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_MENU_HOWTO'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_MENU_DELIVERY'),
247 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_MENU_ABOUT'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_MENU_GUARANTEE'),
248 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_SCHEDULE_NAME'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_SCHEDULE_DETAIL'),
250 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_BUTTON'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_HEADER'),
251 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT1'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT2'),
252 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT3'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT4'),
253 Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT5'), Loc::getMessage(
'PRESET_TEMPLATE_LIST_BLANK_TEXT6'),
264 public static function update($templateName, $html)
267 $fullPathOfFile = Loader::getLocal(static::LOCAL_DIR_TMPL .
bx_basename($templateName) .
'.php');
269 $result = File::putFileContents($fullPathOfFile, $html);
static replaceTemplateByDefaultData($template)
static onPresetTemplateList($templateType=null, $templateId=null)
static update($templateName, $html)
static onPresetTemplateListSite($templateType=null, $templateId=null)
static getById($templateName)
static GetList($arOrder=array(), $arFilter=array(), $arSelect=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
bx_basename($path, $ext="")