1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
recent.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Templates;
9
10use Bitrix\Main\Application;
11use Bitrix\Main\Localization\Loc;
12use Bitrix\Main\Entity\ExpressionField;
13
14use Bitrix\Sender\Entity;
15use Bitrix\Sender\Security;
16
17Loc::loadMessages(__FILE__);
18
23class Recent
24{
25 private static $maxCount = 4;
26 private static $cacheTtl = 3600;
27
36 public static function onPresetTemplateList($templateType = null, $templateId = null, $messageCode = null)
37 {
38 if($templateType)
39 {
40 return array();
41 }
42
43 if (!$templateId)
44 {
45 $templateId = null;
46 }
47
48 return self::getTemplates($messageCode);
49 }
50
51 private static function getTemplates($messageCode = null)
52 {
53 static $result = null;
54 if ($result !== null)
55 {
56 return $result;
57 }
58 $result = array();
59
60 $filter = array(
61 '!=TEMPLATE_TYPE' => null,
62 '!=TEMPLATE_ID' => null,
63 );
65 if ($userId)
66 {
67 $filter['=CREATED_BY'] = $userId;
68 }
69 if ($messageCode)
70 {
71 $filter['=MESSAGE_CODE'] = $messageCode;
72 }
73
74 $chains = Entity\Letter::getList(array(
75 'select' => array('TEMPLATE_TYPE', 'TEMPLATE_ID'),
76 'filter' => $filter,
77 'runtime' => array(new ExpressionField('MAX_ID', 'MAX(%s)', 'ID')),
78 'limit' => self::$maxCount + 1,
79 'cache' => array('ttl' => self::$cacheTtl),
80 'group' => array('TEMPLATE_TYPE', 'TEMPLATE_ID'),
81 'order' => array('MAX_ID' => 'DESC'),
82 ));
83 foreach ($chains as $chain)
84 {
86 ->withTypeId($chain['TEMPLATE_TYPE'])
87 ->withId($chain['TEMPLATE_ID'])
88 ->get();
89
90 if (!$template)
91 {
92 continue;
93 }
94
95 if ($template['TYPE'] === Type::getCode(Type::BASE) && $template['ID'] === 'empty')
96 {
97 continue;
98 }
99
101 $result[] = $template;
102
103 if (count($result) >= self::$maxCount)
104 {
105 break;
106 }
107 }
108
109 return $result;
110 }
111}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
getCode()
Определения error.php:54
static current()
Определения user.php:47
static onPresetTemplateList($templateType=null, $templateId=null, $messageCode=null)
Определения recent.php:36
static create()
Определения selector.php:47
$templateId
Определения component_props2.php:51
$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
$result
Определения get_property_values.php:14
$filter
Определения iblock_catalog_list.php:54
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936