Skip to content

Commit

Permalink
Add export function for email list
Browse files Browse the repository at this point in the history
  • Loading branch information
E Webinmd authored and E Webinmd committed Dec 22, 2022
1 parent 5b47f67 commit 747921b
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
10 changes: 8 additions & 2 deletions _build/data/transport.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

$tmp = [
'export_fields' => [
'value' => 'email',
'xtype' => 'textfield',
'area' => 'sendex_main',
'value' => 'email',
'key' => 'sendex_export_fields',
'area' => 'sendex_main',
],
'hide_export_button' => array(
'xtype' => 'combo-boolean',
'value' => false,
'key' => 'sendex_hide_export_button',
'area' => 'sendex_main',
),
];

foreach ($tmp as $k => $v) {
Expand Down
4 changes: 3 additions & 1 deletion assets/components/sendex/css/mgr/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ a.x-menu-item .x-menu-item-text .fa {line-height:16px; top:auto;}
.fa.actions-menu {width: 40px;}
.fa.actions-menu:after {content: " \f107";}

.sendex-row-disabled {font-style: italic; opacity: .6; color: #555;}
.sendex-row-disabled {font-style: italic; opacity: .6; color: #555;}

#sendex-grid-newsletter-subscribers .x-toolbar-right-row .x-form-field-wrap{margin-right: 1px;}
3 changes: 2 additions & 1 deletion assets/components/sendex/js/mgr/widgets/newsletters.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ Sendex.grid.NewsletterSubscribers = function(config) {
select: {fn: this.addSubscriber, scope: this}
}
},{
xtype: 'button',
xtype: 'button',
hidden: Sendex.config.hideExportButton,
text: '<i class="icon-arrow-circle-up icon"></i> ' + _('sendex_btn_subscrubers_export'),
id: 'sendex-export-form',
cls: 'x-btn-restore-all',
Expand Down
2 changes: 2 additions & 0 deletions core/components/sendex/lexicon/en/setting.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

$_lang['setting_sendex_export_fields'] = 'Fields for export';
$_lang['setting_sendex_export_fields_desc'] = 'Enter fields separated by commas. Available values: id,user_id,email,username,fullname,phone,mobilephone';
$_lang['setting_sendex_hide_export_button'] = 'Hide export button';
$_lang['setting_sendex_hide_export_button_desc'] = 'Disables the button to export the list of email addresses in the mailing list';
2 changes: 2 additions & 0 deletions core/components/sendex/lexicon/ru/setting.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

$_lang['setting_sendex_export_fields'] = 'Поля для экспорта';
$_lang['setting_sendex_export_fields_desc'] = 'Введите данные через запятую. Доступные значения: id,user_id,email,username,fullname,phone,mobilephone';
$_lang['setting_sendex_hide_export_button'] = 'Скрыть кнопку экспорта';
$_lang['setting_sendex_hide_export_button_desc'] = 'Отключает кнопку экспорта списка email адресов в рассылке';
18 changes: 11 additions & 7 deletions core/components/sendex/model/sendex/sendex.class.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

/**
* The base class for Sendex.
*/

class Sendex {
class Sendex
{
/* @var modX $modx */
public $modx;
/* @var SendexControllerRequest $request */
Expand All @@ -16,8 +18,9 @@ class Sendex {
* @param modX $modx
* @param array $config
*/
function __construct(modX &$modx, array $config = array()) {
$this->modx =& $modx;
function __construct(modX &$modx, array $config = array())
{
$this->modx = &$modx;

$corePath = $this->modx->getOption('sendex_core_path', $config, $this->modx->getOption('core_path') . 'components/sendex/');
$assetsUrl = $this->modx->getOption('sendex_assets_url', $config, $this->modx->getOption('assets_url') . 'components/sendex/');
Expand All @@ -36,7 +39,8 @@ function __construct(modX &$modx, array $config = array()) {
'templatesPath' => $corePath . 'elements/templates/',
'chunkSuffix' => '.chunk.tpl',
'snippetsPath' => $corePath . 'elements/snippets/',
'processorsPath' => $corePath . 'processors/'
'processorsPath' => $corePath . 'processors/',
'hideExportButton' => (bool)$this->modx->getOption('sendex_hide_export_button', null, false)
), $config);

$this->modx->addPackage('sendex', $this->config['modelPath']);
Expand All @@ -52,7 +56,8 @@ function __construct(modX &$modx, array $config = array()) {
*
* @return string|bool
*/
public function sendEmail($email, array $options = array()) {
public function sendEmail($email, array $options = array())
{
/** @var modPHPMailer $mail */
$mail = $this->modx->getService('mail', 'mail.modPHPMailer');

Expand All @@ -72,5 +77,4 @@ public function sendEmail($email, array $options = array()) {

return $response;
}

}
}

0 comments on commit 747921b

Please sign in to comment.