| 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 |
if (!empty($data['user-information']->id)) { ?> |
| 5 |
<div class="cell grid-x acym__users__display__history acym__content"> |
| 6 |
<div class="cell grid-x acym__users__history__toggle"> |
| 7 |
<button type="button" |
| 8 |
class="cell small-6 acym__users__history__toggle-button acym__users__history__toggle-button-selected" |
| 9 |
data-acym-toggle-history="mail"><?php echo esc_html(acym_translation('ACYM_EMAIL_HISTORY')); ?></button> |
| 10 |
<button type="button" class="cell small-6 acym__users__history__toggle-button" data-acym-toggle-history="user"> |
| 11 |
<?php echo esc_html(acym_translation('ACYM_USER_HISTORY')); ?> |
| 12 |
</button> |
| 13 |
</div> |
| 14 |
<div class="cell grid-x align-middle" data-acym-type="mail"> |
| 15 |
<?php if (empty($data['userMailHistory'])) { |
| 16 |
echo '<h2 class="cell acym__title__primary__color text-center">'.esc_html(acym_translation('ACYM_YOU_DIDNT_SENT_EMAIL_SUBSCRIBER')).'</h2>'; |
| 17 |
} else { ?> |
| 18 |
<div class="grid-x cell grid-margin-x acym__listing__header acym__listing__header__user_history text-center"> |
| 19 |
<div class="medium-4 hide-for-small-only cell acym__listing__header__title"> |
| 20 |
<?php echo esc_html(acym_translation('ACYM_EMAIL_SUBJECT')); ?> |
| 21 |
</div> |
| 22 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 23 |
<?php echo esc_html(acym_translation('ACYM_SEND_DATE')); ?> |
| 24 |
</div> |
| 25 |
<div class="medium-1 hide-for-small-only cell acym__listing__header__title"> |
| 26 |
<?php echo esc_html(acym_translation('ACYM_OPEN')); ?> |
| 27 |
</div> |
| 28 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 29 |
<?php echo esc_html(acym_translation('ACYM_OPEN_DATE')); ?> |
| 30 |
</div> |
| 31 |
<div class="medium-1 hide-for-small-only cell acym__listing__header__title"> |
| 32 |
<?php echo esc_html(acym_translation('ACYM_CLICK')); ?> |
| 33 |
</div> |
| 34 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 35 |
<?php echo esc_html(acym_translation('ACYM_BOUNCES')); ?> |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
<div class="acym__users__display__history__listing grid-x cell"> |
| 39 |
<?php foreach ($data['userMailHistory'] as $oneMailHistory) { ?> |
| 40 |
<div class="grid-x cell text-center acym__listing__row grid-margin-x"> |
| 41 |
<div class="medium-4 cell acym__users__email__history__subject"> |
| 42 |
<a href="<?php echo esc_url(acym_frontendLink('archive&task=view&id='.$oneMailHistory->id.'&'.acym_noTemplate())); ?>" |
| 43 |
target="_blank"><?php echo esc_html($oneMailHistory->subject); ?></a> |
| 44 |
</div> |
| 45 |
<div class="medium-2 cell"> |
| 46 |
<?php |
| 47 |
if (empty($oneMailHistory->send_date) || '0000-00-00 00:00:00' == $oneMailHistory->send_date) { |
| 48 |
echo '-'; |
| 49 |
} else { |
| 50 |
acym_tooltip( |
| 51 |
[ |
| 52 |
'hoveredText' => acym_date(acym_getTimeFromUTCDate($oneMailHistory->send_date), 'd F H:i'), |
| 53 |
'textShownInTooltip' => acym_date(acym_getTimeFromUTCDate($oneMailHistory->send_date), acym_getDateTimeFormat()), |
| 54 |
] |
| 55 |
); |
| 56 |
} |
| 57 |
?> |
| 58 |
</div> |
| 59 |
<div class="medium-1 cell text-center"> |
| 60 |
<?php echo esc_html($oneMailHistory->open ?? ''); ?> |
| 61 |
</div> |
| 62 |
<div class="medium-2 cell text-center"> |
| 63 |
<?php |
| 64 |
if (empty($oneMailHistory->open_date)) { |
| 65 |
echo '-'; |
| 66 |
} else { |
| 67 |
acym_tooltip( |
| 68 |
[ |
| 69 |
'hoveredText' => acym_date(acym_getTimeFromUTCDate($oneMailHistory->open_date), 'd F H:i'), |
| 70 |
'textShownInTooltip' => acym_date(acym_getTimeFromUTCDate($oneMailHistory->open_date), acym_getDateTimeFormat()), |
| 71 |
] |
| 72 |
); |
| 73 |
} |
| 74 |
?> |
| 75 |
</div> |
| 76 |
<div class="medium-1 cell text-center"> |
| 77 |
<?php echo esc_html($oneMailHistory->click ?? ''); ?> |
| 78 |
</div> |
| 79 |
<div class="medium-2 cell text-center acym__listing__header__user_history__bounce"> |
| 80 |
<?php echo empty($oneMailHistory->bounce_rule) ? '-' : esc_html($oneMailHistory->ruleName ?? ''); ?> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
<?php } ?> |
| 84 |
</div> |
| 85 |
<?php } ?> |
| 86 |
</div> |
| 87 |
<div class="cell grid-x align-middle" data-acym-type="user"> |
| 88 |
<?php if (empty($data['userHistory'])) { |
| 89 |
echo '<h2 class="cell acym__title__primary__color text-center">'.esc_html(acym_translation('ACYM_USER_HISTORY_EMPTY')).'</h2>'; |
| 90 |
} else { ?> |
| 91 |
<div class="grid-x cell text-center grid-margin-x acym__listing__header acym__listing__header__user_history"> |
| 92 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 93 |
<?php echo esc_html(acym_translation('ACYM_DATE')); ?> |
| 94 |
</div> |
| 95 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 96 |
<?php echo esc_html(acym_translation('ACYM_IP')); ?> |
| 97 |
</div> |
| 98 |
<div class="medium-2 hide-for-small-only cell acym__listing__header__title"> |
| 99 |
<?php echo esc_html(acym_translation('ACYM_ACTIONS')); ?> |
| 100 |
</div> |
| 101 |
<div class="medium-3 hide-for-small-only cell acym__listing__header__title"> |
| 102 |
<?php echo esc_html(acym_translation('ACYM_DETAILS')); ?> |
| 103 |
</div> |
| 104 |
<div class="medium-3 hide-for-small-only cell acym__listing__header__title"> |
| 105 |
<?php echo esc_html(acym_translation('ACYM_SOURCE')); ?> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
<div class="acym__users__display__history__listing grid-x cell"> |
| 109 |
<?php foreach ($data['userHistory'] as $key => $oneHistory) { ?> |
| 110 |
<div class="grid-x cell text-center acym__listing__row grid-margin-x"> |
| 111 |
<div class="cell small-12 medium-2"> |
| 112 |
<?php echo esc_html(acym_date($oneHistory->date, acym_getDateTimeFormat())); ?> |
| 113 |
</div> |
| 114 |
<div class="cell small-6 medium-2 acym__users__display__history__listing__ip"> |
| 115 |
<?php echo esc_html($oneHistory->ip); ?> |
| 116 |
</div> |
| 117 |
<div class="cell small-6 medium-2"> |
| 118 |
<?php |
| 119 |
$langKey = 'ACYM_ACTION_'.strtoupper($oneHistory->action); |
| 120 |
$translation = acym_translation($langKey); |
| 121 |
echo esc_html($translation === $langKey ? $oneHistory->action : $translation); |
| 122 |
if ($oneHistory->action === 'unsubscribed' && !empty($oneHistory->unsubscribe_reason)) { |
| 123 |
if (is_numeric($oneHistory->unsubscribe_reason)) { |
| 124 |
$index = $oneHistory->unsubscribe_reason - 1; |
| 125 |
$reason = $data['unsubReasons'][$index] ?? $oneHistory->unsubscribe_reason; |
| 126 |
} else { |
| 127 |
$reason = $oneHistory->unsubscribe_reason; |
| 128 |
} |
| 129 |
echo '<br />'.esc_html($reason); |
| 130 |
} |
| 131 |
?> |
| 132 |
</div> |
| 133 |
<div class="cell small-6 medium-3"> |
| 134 |
<?php |
| 135 |
if (!empty($oneHistory->data)) { |
| 136 |
$historyData = explode("\n", $oneHistory->data); |
| 137 |
$details = '<div><h5>'.esc_html(acym_translation('ACYM_DETAILS')).'</h5><br />'; |
| 138 |
if (!empty($oneHistory->mail_id)) { |
| 139 |
$details .= '<b>'.esc_html(acym_translation('ACYM_CAMPAIGN')).' : </b>'; |
| 140 |
$details .= esc_html($oneHistory->subject).' ( '.esc_html(acym_translation('ACYM_ID').' : '.$oneHistory->mail_id).' )<br />'; |
| 141 |
} |
| 142 |
|
| 143 |
foreach ($historyData as $value) { |
| 144 |
if (!strpos($value, '::')) { |
| 145 |
$details .= $value.'<br />'; |
| 146 |
continue; |
| 147 |
} |
| 148 |
[$part1, $part2] = explode('::', $value); |
| 149 |
if (preg_match('#^[A-Z_]*$#', $part2)) { |
| 150 |
$part2 = acym_translation($part2); |
| 151 |
} |
| 152 |
$details .= '<b>'.esc_html(acym_translation($part1)).' : </b>'.esc_html($part2).'<br />'; |
| 153 |
} |
| 154 |
|
| 155 |
if ($oneHistory->action === 'unsubscribed') { |
| 156 |
$details .= esc_html(acym_translation('ACYM_UNSUBSCRIBE_REASON')); |
| 157 |
if (empty($oneHistory->unsubscribe_reason)) { |
| 158 |
$details .= ' '.esc_html(acym_translation('ACYM_NO_REASON_SET_BY_USER')); |
| 159 |
} else { |
| 160 |
$reason = $data['historyClass']->getUnsubscribeReasonText($oneHistory->unsubscribe_reason); |
| 161 |
$details .= ' '.esc_html($reason); |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
$details .= '</div>'; |
| 166 |
|
| 167 |
acym_modal( |
| 168 |
acym_translation('ACYM_VIEW_DETAILS'), |
| 169 |
$details, |
| 170 |
null, |
| 171 |
['style' => 'word-break: break-word;'], |
| 172 |
['class' => 'history_details'], |
| 173 |
true, |
| 174 |
false |
| 175 |
); |
| 176 |
} |
| 177 |
?> |
| 178 |
</div> |
| 179 |
<div class="cell small-6 medium-3"> |
| 180 |
<?php |
| 181 |
if (!empty($oneHistory->source)) { |
| 182 |
$source = explode("\n", $oneHistory->source); |
| 183 |
$details = '<div><h5>'.esc_html(acym_translation('ACYM_SOURCE')).'</h5><br />'; |
| 184 |
foreach ($source as $value) { |
| 185 |
if (!strpos($value, '::')) continue; |
| 186 |
[$part1, $part2] = explode('::', $value); |
| 187 |
$details .= '<b>'.esc_html($part1).' : </b>'.esc_html($part2).'<br />'; |
| 188 |
} |
| 189 |
$details .= '</div>'; |
| 190 |
|
| 191 |
acym_modal( |
| 192 |
acym_translation('ACYM_VIEW_SOURCE'), |
| 193 |
$details, |
| 194 |
null, |
| 195 |
['style' => 'word-break: break-word;'], |
| 196 |
['class' => 'history_details'] |
| 197 |
); |
| 198 |
} |
| 199 |
?> |
| 200 |
</div> |
| 201 |
</div> |
| 202 |
<?php } ?> |
| 203 |
</div> |
| 204 |
<?php } ?> |
| 205 |
</div> |
| 206 |
</div> |
| 207 |
<?php } |
| 208 |
|