50 $resultList = array();
51 if($templateType && $templateType !==
'USER')
56 $localPathOfIcon = static::LOCAL_DIR_IMG .
'my.png';
63 $filter[
'ID'] = $templateId;
67 $filter[
'ACTIVE'] =
'Y';
70 $templateDb = static::getList(array(
'filter' => $filter,
'order' => array(
'ID' =>
'DESC')));
71 while($template = $templateDb->fetch())
73 $resultList[] = array(
75 'ID' => $template[
'ID'],
76 'NAME' => $template[
'NAME'],
82 'ON_DEMAND' => static::isContentForBlockEditor($template[
'CONTENT'])
86 'VALUE' => $template[
'NAME'],
219 $result =
new ORM\EventResult;
220 $data = $event->getParameters();
221 $chainListDb = MailingChainTable::getList(array(
222 'select' => array(
'ID',
'SUBJECT',
'MAILING_ID',
'MAILING_NAME' =>
'TITLE'),
223 'filter' => array(
'TEMPLATE_TYPE' =>
'USER',
'TEMPLATE_ID' => $data[
'primary'][
'ID']),
224 'order' => array(
'MAILING_NAME' =>
'ASC',
'ID')
227 if($chainListDb->getSelectedRowsCount() > 0)
229 $template = static::getRowById($data[
'primary'][
'ID']);
230 $messageList = array();
231 while($chain = $chainListDb->fetch())
233 $messageList[$chain[
'MAILING_NAME']] =
'[' . $chain[
'ID'] .
'] ' . htmlspecialcharsbx($chain[
'SUBJECT']) .
"\n";
236 $message =
Loc::getMessage(
'SENDER_ENTITY_TEMPLATE_DELETE_ERROR_TEMPLATE', array(
'#NAME#' => $template[
'NAME'])) .
"\n";
237 foreach($messageList as $mailingName => $messageItem)
239 $message .=
Loc::getMessage(
'SENDER_ENTITY_TEMPLATE_DELETE_ERROR_MAILING', array(
'#NAME#' => $mailingName)) .
"\n" . $messageItem .
"\n";
245 if (!$result->getErrors())
247 \Bitrix\Sender\FileTable::syncFiles($data[
'primary'][
'ID'], 1,
'');
272 $fieldName = $params[
'FIELD_NAME'];
273 $fieldValue = $params[
'FIELD_VALUE'];
274 $isUserHavePhpAccess = $params[
'HAVE_USER_ACCESS'];
275 $showSaveTemplate = isset($params[
'SHOW_SAVE_TEMPLATE']) ? $params[
'SHOW_SAVE_TEMPLATE'] :
true;
276 $site = isset($params[
'SITE']) ? $params[
'SITE'] :
'';
277 $charset = isset($params[
'CHARSET']) ? $params[
'CHARSET'] :
'';
278 $contentUrl = isset($params[
'CONTENT_URL']) ? $params[
'CONTENT_URL'] :
'';
279 $templateTypeInput = isset($params[
'TEMPLATE_TYPE_INPUT']) ? $params[
'TEMPLATE_TYPE_INPUT'] :
'TEMPLATE_TYPE';
280 $templateIdInput = isset($params[
'TEMPLATE_ID_INPUT']) ? $params[
'TEMPLATE_ID_INPUT'] :
'TEMPLATE_ID';
281 $templateType = isset($params[
'TEMPLATE_TYPE']) ? $params[
'TEMPLATE_TYPE'] :
'';
282 $templateId = isset($params[
'TEMPLATE_ID']) ? $params[
'TEMPLATE_ID'] :
'';
283 $isTemplateMode = isset($params[
'IS_TEMPLATE_MODE']) ? (bool) $params[
'IS_TEMPLATE_MODE'] :
true;
284 if(!empty($params[
'PERSONALIZE_LIST']) && is_array($params[
'PERSONALIZE_LIST']))
291 $isDisplayBlockEditor = ($templateType && $templateId) || static::isContentForBlockEditor($fieldValue);
293 $editorHeight =
'650px';
294 $editorWidth =
'100%';
296 Loader::includeModule(
'fileman');
298 \CJSCore::RegisterExt(
"sender_editor", Array(
299 "js" => array(
"/bitrix/js/sender/editor/htmleditor.js"),
302 \CJSCore::Init(array(
"sender_editor"));
306 <div
id=
"bx-sender-visual-editor-<?=$fieldName?>" style=
"<?if($isDisplayBlockEditor):?>display: none;<?endif;?>">
309 <?
if(!$isInit): $isInit =
true;?>
310 var letterManager =
new SenderLetterManager;
316 "BXEdPlaceHolderSelectorTitle" :
"<?=Loc::getMessage('SENDER_TEMPLATE_EDITOR_PLACEHOLDER')?>"
319 <textarea
id=
"bxed_<?=htmlspecialcharsbx($fieldName)?>"
320 name=
"<?=htmlspecialcharsbx($fieldName)?>"
321 style=
"height: <?=htmlspecialcharsbx($editorHeight)?>; width: <?=htmlspecialcharsbx($editorWidth)?>;"
323 ><?=htmlspecialcharsbx($fieldValue)?></textarea>
327 <div
id=
"bx-sender-block-editor-<?=htmlspecialcharsbx($fieldName)?>" style=
"<?if(!$isDisplayBlockEditor):?>display: none;<?endif;?>">
329 <input type=
"hidden" name=
"<?=htmlspecialcharsbx($templateTypeInput)?>" value=
"<?=htmlspecialcharsbx($templateType)?>" />
330 <input type=
"hidden" name=
"<?=htmlspecialcharsbx($templateIdInput)?>" value=
"<?=htmlspecialcharsbx($templateId)?>" />
333 if($isDisplayBlockEditor)
335 if($templateType && $templateId)
337 $url =
'/bitrix/admin/sender_template_admin.php?';
338 $url .=
'action=get_template&template_type=' . $templateType .
'&template_id=' . $templateId;
339 $url .=
'&lang=' . LANGUAGE_ID .
'&' . bitrix_sessid_get();
348 'charset' => $charset,
350 'own_result_id' =>
'bxed_' . $fieldName,
352 'templateType' => $templateType,
353 'templateId' => $templateId,
354 'isTemplateMode' => $isTemplateMode,
355 'isUserHavePhpAccess' => $isUserHavePhpAccess,
361 if($showSaveTemplate):
364 function ToggleTemplateSaveDialog()
366 BX(
'TEMPLATE_ACTION_SAVE_NAME_CONT').value =
'';
368 var currentDisplay =
BX(
'TEMPLATE_ACTION_SAVE_NAME_CONT').style.display;
369 BX(
'TEMPLATE_ACTION_SAVE_NAME_CONT').style.display =
BX.toggle(currentDisplay, [
'inline',
'none']);
372 <div
class=
"adm-detail-content-item-block-save">
374 <input type=
"checkbox" value=
"Y" name=
"TEMPLATE_ACTION_SAVE" id=
"TEMPLATE_ACTION_SAVE" onclick=
"ToggleTemplateSaveDialog();">
375 <label
for=
"TEMPLATE_ACTION_SAVE"><?=
Loc::getMessage(
'SENDER_TEMPLATE_EDITOR_SAVE')?></label>
377 <span
id=
"TEMPLATE_ACTION_SAVE_NAME_CONT" style=
"display: none;"> <?=
Loc::getMessage(
'SENDER_TEMPLATE_EDITOR_SAVE_NAME')?> <input type=
"text" name=
"TEMPLATE_ACTION_SAVE_NAME"></span>
382 return ob_get_clean();