Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
unsubscribers.php
1<?php
10
11use \Bitrix\Main\Localization\Loc;
12use Bitrix\Sender\Connector\Base as ConnectorBase;
13use \Bitrix\Sender\MailingTable;
14use \Bitrix\Sender\MailingSubscriptionTable;
15
16Loc::loadMessages(__FILE__);
17
18class UnSubscribers extends ConnectorBase
19{
24 public function getName()
25 {
26 return Loc::getMessage('sender_connector_unsubscribers_name1');
27 }
28
33 public function getCode()
34 {
35 return "sender_unsubscribers";
36 }
37
42 public function getData()
43 {
44 $mailingId = $this->getFieldValue('MAILING_ID', 0);
45 $filter = array();
46 if($mailingId)
47 {
48 $filter['=MAILING_ID'] = $mailingId;
49 }
51 'select' => array(
52 'SENDER_CONTACT_ID' => 'CONTACT.ID',
53 'EMAIL' => 'CONTACT.CODE'
54 ),
55 'filter' => $filter,
56 'group' => array('CONTACT.CODE'),
57 ));
58
59 return $mailingDb;
60 }
61
66 public function getForm()
67 {
68 $mailingDb = MailingTable::getList(array(
69 'select' => array('ID','NAME',),
70 'order' => array('NAME' => 'ASC', 'ID' => 'DESC')
71 ));
72 $mailingList = $mailingDb->fetchAll();
73 $mailingList = array_merge(
74 array(
75 array('ID' => '', 'NAME' => Loc::getMessage('sender_connector_unsubscribers_all'))
76 ),
77 $mailingList
78 );
79
80 $mailingInput = '<select name="'.$this->getFieldName('MAILING_ID').'">';
81 foreach($mailingList as $mailing)
82 {
83 $inputSelected = ($mailing['ID'] == $this->getFieldValue('MAILING_ID') ? 'selected' : '');
84 $mailingInput .= '<option value="'.$mailing['ID'].'" '.$inputSelected.'>';
85 $mailingInput .= htmlspecialcharsbx($mailing['NAME']);
86 $mailingInput .= '</option>';
87 }
88 $mailingInput .= '</select>';
89
90 return '
91 <table>
92 <tr>
93 <td>' . Loc::getMessage('sender_connector_unsubscribers_mailing') . '</td>
94 <td>' . $mailingInput . '</td>
95 </tr>
96 </table>
97 ';
98 }
99}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getFieldValue($name, $defaultValue=null)
Definition base.php:195
static getUnSubscriptionList(array $parameters=array())
Definition mailing.php:838