1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
mailuserrecipientappearancefilter.php
См. документацию.
1<?php
2
3namespace Bitrix\Mail\Integration\UI\EntitySelector;
4
5use Bitrix\Main\Localization\Loc;
6use Bitrix\UI\EntitySelector\BaseFilter;
7use Bitrix\UI\EntitySelector\Dialog;
8use Bitrix\UI\EntitySelector\Item;
9use Bitrix\UI\EntitySelector\Tab;
10
12{
13 public const MAIL_RECIPIENT_USER_TAB = 'mail-recipient-user';
14
15 public function __construct()
16 {
17 parent::__construct();
18 }
19
20 public function isAvailable(): bool
21 {
22 return true;
23 }
24
25 protected static function addUserTab(Dialog $dialog): void
26 {
27 $icon =
28 'data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20fill%3D%22'.
29 'none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cpath%20d%3D%22M15.953%2018.654a29.847%'.
30 '2029.847%200%2001-6.443.689c-2.672%200-5.212-.339-7.51-.948.224-1.103.53-2.573.672-3.106.238-.896'.
31 '%201.573-1.562%202.801-2.074.321-.133.515-.24.71-.348.193-.106.386-.213.703-.347.036-.165.05-.333.'.
32 '043-.5l.544-.064s.072.126-.043-.614c0%200-.61-.155-.64-1.334%200%200-.458.148-.486-.566a1.82%201.'.
33 '82%200%2000-.08-.412c-.087-.315-.164-.597.233-.841l-.287-.74S5.87%204.583%207.192%204.816c-.537-.'.
34 '823%203.99-1.508%204.29%201.015.119.76.119%201.534%200%202.294%200%200%20.677-.075.225%201.17%200'.
35 '%200-.248.895-.63.693%200%200%20.062%201.133-.539%201.325%200%200%20.043.604.043.645l.503.074s-.01'.
36 '4.503.085.557c.458.287.96.505%201.488.645%201.561.383%202.352%201.041%202.352%201.617%200%200%20.6'.
37 '41%202.3.944%203.802z%22%20fill%3D%22%23ABB1B8%22/%3E%3Cpath%20d%3D%22M21.47%2016.728c-.36.182-.73'.
38 '.355-1.112.52h-3.604c-.027-.376-.377-1.678-.58-2.434-.081-.299-.139-.513-.144-.549-.026-.711-1.015-'.
39 '1.347-2.116-1.78a1.95%201.95%200%2000.213-.351c.155-.187.356-.331.585-.42l.017-.557-1.208-.367s-.31'.
40 '-.14-.342-.14c.036-.086.08-.168.134-.245.023-.06.17-.507.17-.507-.177.22-.383.415-.614.58.211-.363.'.
41 '39-.743.536-1.135a7.02%207.02%200%2000.192-1.15%2016.16%2016.16%200%2001.387-2.093c.125-.343.346-.64'.
42 '7.639-.876a3.014%203.014%200%20011.46-.504h.062c.525.039%201.03.213%201.462.504.293.229.514.532.64.8'.
43 '76.174.688.304%201.387.387%202.092.037.38.104.755.201%201.124.145.4.322.788.527%201.161a3.066%203.06'.
44 '6%200%2001-.614-.579s.113.406.136.466c.063.09.119.185.167.283-.03%200-.342.141-.342.141l-1.208.367.0'.
45 '17.558c.23.088.43.232.585.419.073.179.188.338.337.466.292.098.573.224.84.374.404.219.847.36%201.306.'.
46 '416.463.074.755.8.755.8l.037.729.093%201.811z%22%20fill%3D%22%23ABB1B8%22/%3E%3C/svg%3E';
47
48 $dialog->addTab(new Tab([
49 'id' => self::MAIL_RECIPIENT_USER_TAB,
50 'title' => Loc::getMessage("MAIL_RECIPIENT_USER_TAB_TITLE"),
51 'icon' => [
52 'default' => $icon,
53 'selected' => str_replace('ABB1B8', 'fff', $icon),
54 ]
55 ]));
56 }
57
58 public function apply(array $items, Dialog $dialog): void
59 {
60 $usersCount = 0;
61
62 foreach ($items as $item)
63 {
64 if (!($item instanceof Item))
65 {
66 continue;
67 }
68
69 $email = '';
70
71 switch ($item->getEntityId())
72 {
73 case 'user':
74 {
75 $usersCount++;
76
77 $fields = $item->getCustomData()->getValues();
78
79 $item->getCustomData()->set('entityType', self::MAIL_RECIPIENT_USER_TAB);
80
81 $item->addTab(self::MAIL_RECIPIENT_USER_TAB);
82
83 if (isset($fields['email']))
84 {
85 $email = (string)$fields['email'];
86 }
87
88 break;
89 }
90 }
91
92 $item->setSubtitle($email);
93 }
94
95 if ($usersCount > 0 && is_null($dialog->getTab(self::MAIL_RECIPIENT_USER_TAB)))
96 {
97 self::addUserTab($dialog);
98 }
99 }
100}
addTab(Tab $tab)
Определения dialog.php:256
getTab(string $tabId)
Определения dialog.php:272
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$email
Определения payment.php:49
$items
Определения template.php:224
$fields
Определения yandex_run.php:501