1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
recipient.php
См. документацию.
1<?php
8
9namespace Bitrix\Sender\Integration\Sender\Connectors;
10
11use Bitrix\Main\Localization\Loc;
12use Bitrix\Sender\Connector\Base as ConnectorBase;
13use Bitrix\Sender\PostingRecipientTable;
14use Bitrix\Sender\MailingTable;
15
16Loc::loadMessages(__FILE__);
17
18class Recipient extends ConnectorBase
19{
23 public function getName()
24 {
25 return Loc::getMessage('sender_connector_recipient_name1');
26 }
27
31 public function getCode()
32 {
33 return "recipient_list";
34 }
35
39 public function getData()
40 {
41 $mailingId = $this->getFieldValue('MAILING_ID', 0);
42 $send = $this->getFieldValue('SEND', null);
43 $read = $this->getFieldValue('READ', null);
44 $click = $this->getFieldValue('CLICK', null);
45 $unsub = $this->getFieldValue('UNSUB', null);
46
47 $filter = array(
48 '=POSTING.MAILING_ID' => $mailingId,
49 );
50
51 if($send=='Y')
53 elseif($send=='N')
55
56 if($read=='Y')
57 $filter['=IS_READ'] = 'Y';
58 elseif($read=='N')
59 $filter['=IS_READ'] = 'N';
60
61 if($click=='Y')
62 $filter['=IS_CLICK'] = 'Y';
63 elseif($click=='N')
64 $filter['=IS_CLICK'] = 'N';
65
66 if($unsub=='Y')
67 $filter['=IS_UNSUB'] = 'Y';
68 elseif($unsub=='N')
69 $filter['=IS_UNSUB'] = 'N';
70
72 'select' => array('NAME' => 'CONTACT.NAME', 'EMAIL' => 'CONTACT.CODE'),
73 'filter' => $filter,
74 'group' => array('NAME', 'EMAIL'),
75 ));
76 }
77
82 public function getForm()
83 {
84 $mailingInput = '<select name="'.$this->getFieldName('MAILING_ID').'">';
85 $mailingDb = MailingTable::getList(array(
86 'select' => array('ID','NAME',),
87 'order' => array('NAME' => 'ASC', 'ID' => 'DESC')
88 ));
89 while($mailing = $mailingDb->fetch())
90 {
91 $inputSelected = ($mailing['ID'] == $this->getFieldValue('MAILING_ID') ? 'selected' : '');
92 $mailingInput .= '<option value="'.$mailing['ID'].'" '.$inputSelected.'>';
93 $mailingInput .= htmlspecialcharsbx($mailing['NAME']);
94 $mailingInput .= '</option>';
95 }
96 $mailingInput .= '</select>';
97
98
99 $booleanValues = array(
100 '' => Loc::getMessage('sender_connector_recipient_all'),
101 'Y' => Loc::getMessage('sender_connector_recipient_y'),
102 'N' => Loc::getMessage('sender_connector_recipient_n'),
103 );
104
105
106 $sentInput = '<select name="'.$this->getFieldName('SEND').'">';
107 foreach($booleanValues as $k => $v)
108 {
109 $inputSelected = ($k == $this->getFieldValue('SEND') ? 'selected' : '');
110 $sentInput .= '<option value="'.$k.'" '.$inputSelected.'>';
111 $sentInput .= htmlspecialcharsbx($v);
112 $sentInput .= '</option>';
113 }
114 $sentInput .= '</select>';
115
116
117 $readInput = '<select name="'.$this->getFieldName('READ').'">';
118 foreach($booleanValues as $k => $v)
119 {
120 $inputSelected = ($k == $this->getFieldValue('READ') ? 'selected' : '');
121 $readInput .= '<option value="'.$k.'" '.$inputSelected.'>';
122 $readInput .= htmlspecialcharsbx($v);
123 $readInput .= '</option>';
124 }
125 $readInput .= '</select>';
126
127
128 $clickInput = '<select name="'.$this->getFieldName('CLICK').'">';
129 foreach($booleanValues as $k => $v)
130 {
131 $inputSelected = ($k == $this->getFieldValue('CLICK') ? 'selected' : '');
132 $clickInput .= '<option value="'.$k.'" '.$inputSelected.'>';
133 $clickInput .= htmlspecialcharsbx($v);
134 $clickInput .= '</option>';
135 }
136 $clickInput .= '</select>';
137
138
139 $unsubInput = '<select name="'.$this->getFieldName('UNSUB').'">';
140 foreach($booleanValues as $k => $v)
141 {
142 $inputSelected = ($k == $this->getFieldValue('UNSUB') ? 'selected' : '');
143 $unsubInput .= '<option value="'.$k.'" '.$inputSelected.'>';
144 $unsubInput .= htmlspecialcharsbx($v);
145 $unsubInput .= '</option>';
146 }
147 $unsubInput .= '</select>';
148
149
150 return '
151 <table>
152 <tr>
153 <td>'.Loc::getMessage('sender_connector_recipient_mailing').'</td>
154 <td>'.$mailingInput.'</td>
155 </tr>
156 <tr>
157 <td>'.Loc::getMessage('sender_connector_recipient_sent').'</td>
158 <td>'.$sentInput.'</td>
159 </tr>
160 <tr>
161 <td>'.Loc::getMessage('sender_connector_recipient_read').'</td>
162 <td>'.$readInput.'</td>
163 </tr>
164 <tr>
165 <td>'.Loc::getMessage('sender_connector_recipient_click').'</td>
166 <td>'.$clickInput.'</td>
167 </tr>
168 <tr>
169 <td>'.Loc::getMessage('sender_connector_recipient_unsub').'</td>
170 <td>'.$unsubInput.'</td>
171 </tr>
172 </table>
173 ';
174 }
175}
static getList(array $parameters=array())
Определения datamanager.php:431
getFieldValue($name, $defaultValue=null)
Определения base.php:195
const SEND_RESULT_NONE
Определения posting.php:670
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$filter
Определения iblock_catalog_list.php:54
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
Определения agent.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$k
Определения template_pdf.php:567