| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
use AcyMailing\Helpers\EntitySelectHelper; |
| 5 |
|
| 6 |
?> |
| 7 |
<form id="acym_form" action="<?php echo esc_url(acym_prepareAjaxURL(acym_getVar('cmd', 'ctrl'))); ?>" method="post" name="acyForm"> |
| 8 |
<div class="grid-x acym__content" id="acym__users__export"> |
| 9 |
<div class="cell grid-x grid-margin-x"> |
| 10 |
<div class="cell acym_area medium-6 acym__content"> |
| 11 |
<div class="acym__title"><?php echo esc_html(acym_translation('ACYM_FIELDS_TO_EXPORT')); ?></div> |
| 12 |
<p><span id="acym__users__export__check_all_field"><?php echo esc_html(acym_strtolower(acym_translation('ACYM_ALL'))); ?></span> | |
| 13 |
<span id="acym__users__export__check_default_field"><?php echo esc_html(acym_strtolower(acym_translation('ACYM_DEFAULT'))); ?></span></p> |
| 14 |
<div class="margin-bottom-1"> |
| 15 |
<?php |
| 16 |
$defaultFields = explode(',', $this->config->get('export_fields', 'name,email')); |
| 17 |
foreach ($data['fields'] as $fieldName) { |
| 18 |
if (in_array($fieldName, ['id', 'automation'])) { |
| 19 |
continue; |
| 20 |
} |
| 21 |
?> |
| 22 |
<input <?php acym_checked(in_array($fieldName, $defaultFields)); ?> |
| 23 |
id="checkbox_<?php echo esc_attr($fieldName); ?>" |
| 24 |
class="acym__users__export__export_fields" |
| 25 |
type="checkbox" |
| 26 |
name="export_fields[]" |
| 27 |
value="<?php echo esc_attr($fieldName); ?>"> |
| 28 |
<label for="checkbox_<?php echo esc_attr($fieldName); ?>"><?php echo esc_html($fieldName); ?></label> |
| 29 |
<br /> |
| 30 |
<?php |
| 31 |
} |
| 32 |
|
| 33 |
foreach ($data['customfields'] as $field) { |
| 34 |
if ($field->type === 'file' || in_array($field->id, $data['coreFields'])) { |
| 35 |
continue; |
| 36 |
} |
| 37 |
|
| 38 |
$fieldName = $field->name; |
| 39 |
?> |
| 40 |
<input <?php acym_checked(in_array($field->id, $defaultFields)); ?> |
| 41 |
id="checkbox_<?php echo esc_attr($fieldName); ?>" |
| 42 |
class="acym__users__export__export_fields" |
| 43 |
type="checkbox" |
| 44 |
name="export_fields[]" |
| 45 |
value="<?php echo esc_attr($field->id); ?>"> |
| 46 |
<label for="checkbox_<?php echo esc_attr($fieldName); ?>"> |
| 47 |
<?php echo esc_html(acym_translation($fieldName)); ?> |
| 48 |
</label> |
| 49 |
<br /> |
| 50 |
<?php |
| 51 |
} |
| 52 |
?> |
| 53 |
<input <?php acym_checked(in_array('subscribe_date', $defaultFields)); ?> |
| 54 |
id="checkbox_subscribe_date" |
| 55 |
class="acym__users__export__export_fields" |
| 56 |
type="checkbox" |
| 57 |
name="export_fields[]" |
| 58 |
value="subscribe_date"> |
| 59 |
<label for="checkbox_subscribe_date"> |
| 60 |
<?php echo esc_html(acym_translation('ACYM_SUBSCRIPTION_DATE')); ?> |
| 61 |
</label> |
| 62 |
<br /> |
| 63 |
|
| 64 |
<input <?php acym_checked(in_array('unsubscribe_date', $defaultFields)); ?> |
| 65 |
id="checkbox_unsubscribe_date" |
| 66 |
class="acym__users__export__export_fields" |
| 67 |
type="checkbox" |
| 68 |
name="export_fields[]" |
| 69 |
value="unsubscribe_date"> |
| 70 |
<label for="checkbox_unsubscribe_date"> |
| 71 |
<?php echo esc_html(acym_translation('ACYM_UNSUBSCRIPTION_DATE')); ?> |
| 72 |
</label> |
| 73 |
<br /> |
| 74 |
</div> |
| 75 |
<div class="grid-x margin-bottom-1" id="userField_separator"> |
| 76 |
<label class="cell"><?php echo esc_html(acym_translation('ACYM_SEPARATOR')); ?></label> |
| 77 |
<?php |
| 78 |
acym_radio( |
| 79 |
['semicol' => acym_translation('ACYM_SEMICOLON'), 'comma' => acym_translation('ACYM_COMMA')], |
| 80 |
'export_separator', |
| 81 |
$this->config->get('export_separator', 'comma') |
| 82 |
); |
| 83 |
?> |
| 84 |
<div class="cell medium-auto"></div> |
| 85 |
</div> |
| 86 |
<div class="grid-x margin-bottom-1"> |
| 87 |
<label class="cell medium-6 xxlarge-3"><?php echo esc_html(acym_translation('ACYM_ENCODING')); ?> |
| 88 |
<?php |
| 89 |
$data['encodingHelper']->charsetField( |
| 90 |
'export_charset', |
| 91 |
$this->config->get('export_charset', 'UTF-8'), |
| 92 |
['class' => 'acym__select'], |
| 93 |
true |
| 94 |
); |
| 95 |
?> |
| 96 |
</label> |
| 97 |
<div class="cell medium-auto"></div> |
| 98 |
</div> |
| 99 |
<div class="grid-x" id="userField_excel"> |
| 100 |
<label class="cell"><?php echo esc_html(acym_translation('ACYM_EXCEL_SECURITY')); |
| 101 |
acym_info(['textShownInTooltip' => 'ACYM_EXCEL_SECURITY_DESC']); ?></label> |
| 102 |
<?php |
| 103 |
acym_boolean( |
| 104 |
'export_excelsecurity', |
| 105 |
(bool)$this->config->get('export_excelsecurity', 0) |
| 106 |
); |
| 107 |
?> |
| 108 |
<div class="cell medium-auto"></div> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
<div class="cell acym_area medium-6 acym__content"> |
| 112 |
<div class="acym__title"><?php echo esc_html(acym_translation('ACYM_SUBSCRIBERS_TO_EXPORT')); ?></div> |
| 113 |
<p class="cell margin-bottom-1"><?php echo esc_html(acym_translation('ACYM_WARNING_FILTERS_APPLIED_EXPORT')); ?></p> |
| 114 |
<?php if (empty($data['checkedElements']) || $data['isPreselectedList']) { ?> |
| 115 |
<fieldset id="acym__users__export__users-to-export"> |
| 116 |
<?php |
| 117 |
acym_radio( |
| 118 |
[ |
| 119 |
'all' => acym_translation('ACYM_ALL_SUBSCRIBERS'), |
| 120 |
'list' => acym_translation('ACYM_SUBSCRIBERS_FROM_LISTS'), |
| 121 |
], |
| 122 |
'export_users-to-export', |
| 123 |
$data['isPreselectedList'] ? 'list' : 'all' |
| 124 |
); |
| 125 |
?> |
| 126 |
</fieldset> |
| 127 |
<div id="acym__users__export__select_lists" class="margin-bottom-1" style="display: <?php echo $data['isPreselectedList'] ? 'block' : 'none'; ?>"> |
| 128 |
<?php |
| 129 |
$entityHelper = new EntitySelectHelper(); |
| 130 |
if ($data['isPreselectedList']) { |
| 131 |
$entityHelper->entitySelect( |
| 132 |
[ |
| 133 |
'display' => true, |
| 134 |
'entity' => 'list', |
| 135 |
'entityParams' => ['join' => 'join_lists-'.implode(',', $data['checkedElements'])], |
| 136 |
'columnsToDisplay' => $entityHelper->getColumnsForList('lists.list_id', true), |
| 137 |
] |
| 138 |
); |
| 139 |
} else { |
| 140 |
$entityHelper->entitySelect( |
| 141 |
[ |
| 142 |
'display' => true, |
| 143 |
'entity' => 'list', |
| 144 |
'columnsToDisplay' => $entityHelper->getColumnsForList('', true), |
| 145 |
] |
| 146 |
); |
| 147 |
} |
| 148 |
?> |
| 149 |
<div class="margin-top-1"> |
| 150 |
<?php |
| 151 |
acym_radio( |
| 152 |
[ |
| 153 |
'sub' => acym_translation('ACYM_SUBSCRIBED_USER'), |
| 154 |
'unsub' => acym_translation('ACYM_UNSUBSCRIBED_USER'), |
| 155 |
'all' => acym_translation('ACYM_EXPORT_BOTH'), |
| 156 |
'none' => acym_translation('ACYM_NO_SUBSCRIPTION_STATUS'), |
| 157 |
], |
| 158 |
'export_list', |
| 159 |
$data['exportListStatus'] |
| 160 |
); |
| 161 |
?> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
<div id="acym__users__export__segments" class="padding-top-1"> |
| 165 |
<?php echo esc_html(acym_translation('ACYM_FILTER_EXPORTED_SUBSCRIBERS_SEGMENT')); ?> |
| 166 |
</div> |
| 167 |
<div id="acym__users__export__select_segments" class="margin-bottom-1"> |
| 168 |
<div class="margin-bottom-1 margin-top-1"> |
| 169 |
<?php |
| 170 |
acym_select( |
| 171 |
$data['segments'], |
| 172 |
'export_segment', |
| 173 |
$data['preselectedSegment'], |
| 174 |
[ |
| 175 |
'class' => 'acym__select', |
| 176 |
'acym-data-infinite' => '', |
| 177 |
], |
| 178 |
'value', |
| 179 |
'text', |
| 180 |
null, |
| 181 |
false, |
| 182 |
true |
| 183 |
); |
| 184 |
?> |
| 185 |
</div> |
| 186 |
</div> |
| 187 |
<?php } else { ?> |
| 188 |
<input type="hidden" name="selected_users" value="<?php echo esc_attr(implode(',', $data['checkedElements'])); ?>" /> |
| 189 |
<div class="grid-x"> |
| 190 |
<?php |
| 191 |
if (!$data['isPreselectedList']) { |
| 192 |
foreach ($data['checkedElements'] as $id) { |
| 193 |
$user = $data['userClass']->getOneById($id); |
| 194 |
echo '<div class="cell grid-x acym__listing__row">'; |
| 195 |
echo ' <div class="cell small-6">'.esc_html($user->name ?? '').'</div> |
| 196 |
<div class="cell small-6">'.esc_html($user->email).'</div>'; |
| 197 |
echo '</div>'; |
| 198 |
} |
| 199 |
} |
| 200 |
?> |
| 201 |
</div> |
| 202 |
<?php } ?> |
| 203 |
</div> |
| 204 |
</div> |
| 205 |
<div class="cell grid-x grid-margin-x margin-top-1"> |
| 206 |
<div class="cell hide-for-small-only medium-auto"></div> |
| 207 |
<?php |
| 208 |
acym_cancelButton(); |
| 209 |
$exportButton = '<button type="button" data-task="doexport" class="cell button acy_button_submit" id="acym__export__button">'; |
| 210 |
$exportButton .= acym_translation('ACYM_EXPORT_SUBSCRIBERS'); |
| 211 |
$exportButton .= '</button>'; |
| 212 |
acym_tooltip( |
| 213 |
[ |
| 214 |
'hoveredText' => $exportButton, |
| 215 |
'textShownInTooltip' => acym_translation('ACYM_DATA_WILL_EXPORT_CSV_FORMAT'), |
| 216 |
] |
| 217 |
); |
| 218 |
?> |
| 219 |
<div class="cell hide-for-small-only medium-auto"></div> |
| 220 |
</div> |
| 221 |
</div> |
| 222 |
|
| 223 |
<?php acym_formOptions(); ?> |
| 224 |
</form> |
| 225 |
|