| @@ -1,0 +1,223 @@ | ||
| 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 | +?> | |
| 5 | +<form id="acym_form" action="<?php echo esc_url(acym_completeLink(acym_getVar('cmd', 'ctrl'))); ?>" method="post" name="acyForm" data-abide novalidate> | |
| 6 | + <?php | |
| 7 | + $isEmpty = empty($data['allElements']) && empty($data['search']) && empty($data['tag']) && empty($data['status']); | |
| 8 | + if (!$isEmpty) { | |
| 9 | + $data['toolbar']->displayToolbar($data); | |
| 10 | + } | |
| 11 | + ?> | |
| 12 | + <div id="acym__queue" class="acym__content"> | |
| 13 | + <?php | |
| 14 | + $workflow = $data['workflowHelper']; | |
| 15 | + $workflow->displayTabs($this->steps, 'campaigns'); | |
| 16 | + ?> | |
| 17 | + | |
| 18 | + <?php if ($isEmpty) { ?> | |
| 19 | + <div class="grid-x text-center"> | |
| 20 | + <h1 class="acym__listing__empty__title cell"><?php echo esc_html(acym_translation('ACYM_YOU_DONT_HAVE_ANY_CAMPAIGN_IN_QUEUE')); ?></h1> | |
| 21 | + <h1 class="acym__listing__empty__subtitle cell"><?php echo esc_html(acym_translation('ACYM_SEND_ONE_AND_SEE_HOW_AMAZING_QUEUE_IS')); ?></h1> | |
| 22 | + </div> | |
| 23 | + <?php } else { ?> | |
| 24 | + <?php if (empty($data['allElements'])) { ?> | |
| 25 | + <h1 class="cell acym__listing__empty__search__title text-center"><?php echo esc_html(acym_translation('ACYM_NO_RESULTS_FOUND')); ?></h1> | |
| 26 | + <?php } else { ?> | |
| 27 | + <div class="cell grid-x"> | |
| 28 | + <div class="grid-x acym__listing__actions cell auto"> | |
| 29 | + <?php | |
| 30 | + $sendingText = $this->config->get('cron_last', 0) < (time() - 43200) ? 'ACYM_QUEUE_READY' : 'ACYM_SENDING'; | |
| 31 | + | |
| 32 | + acym_filterStatus( | |
| 33 | + [ | |
| 34 | + '' => ['ACYM_ALL', $data['numberPerStatus']['all']], | |
| 35 | + 'sending' => [$sendingText, $data['numberPerStatus']['sending']], | |
| 36 | + 'paused' => ['ACYM_PAUSED', $data['numberPerStatus']['paused']], | |
| 37 | + 'automation' => ['ACYM_AUTOMATION', $data['numberPerStatus']['automation']], | |
| 38 | + 'followup' => ['ACYM_FOLLOW_UP', $data['numberPerStatus']['followup']], | |
| 39 | + ], | |
| 40 | + $data['status'], | |
| 41 | + 'cqueue_status' | |
| 42 | + ); | |
| 43 | + ?> | |
| 44 | + </div> | |
| 45 | + </div> | |
| 46 | + <div class="grid-x acym__listing acym__listing__view__cqueue"> | |
| 47 | + <div class="cell grid-x acym__listing__header hide-for-small-only"> | |
| 48 | + <div class="acym__listing__header__title cell medium-auto"> | |
| 49 | + <?php echo esc_html(acym_translation('ACYM_MAILS')); ?> | |
| 50 | + </div> | |
| 51 | + <div class="acym__listing__header__title cell large-3 hide-for-medium-only text-center"> | |
| 52 | + <?php echo esc_html(acym_translation('ACYM_RECIPIENTS')); ?> | |
| 53 | + </div> | |
| 54 | + <div class="acym__listing__header__title cell medium-4 text-center"> | |
| 55 | + <?php echo esc_html(acym_translation('ACYM_STATUS')); ?> | |
| 56 | + </div> | |
| 57 | + <div class="cell medium-2"></div> | |
| 58 | + </div> | |
| 59 | + <?php foreach ($data['allElements'] as $row) { | |
| 60 | + ?> | |
| 61 | + <div data-acy-elementid="<?php echo esc_attr($row->id); ?>" class="cell grid-x acym__listing__row"> | |
| 62 | + <div class="cell medium-auto acym_vcenter"> | |
| 63 | + <div class="acym__listing__title"> | |
| 64 | + <?php | |
| 65 | + $afterName = $row->language; | |
| 66 | + if (!empty($row->sending_params['abtest'])) { | |
| 67 | + $afterName = $row->subject; | |
| 68 | + } elseif (!empty($data['languages'][$row->language])) { | |
| 69 | + $afterName = $data['languages'][$row->language]->name; | |
| 70 | + } | |
| 71 | + $afterName = empty($afterName) ? '' : ' - '.$afterName | |
| 72 | + ?> | |
| 73 | + <h6 class="acym__listing__title__primary acym_text_ellipsis"><?php echo esc_html($row->name.$afterName); ?></h6> | |
| 74 | + <span class="acym__listing__title__secondary acym_text_ellipsis"><?php echo esc_html($row->subject ?? ''); ?></span> | |
| 75 | + <p class="acym__listing__title__secondary"> | |
| 76 | + <?php echo esc_html(acym_date($row->sending_date, acym_getDateTimeFormat())); ?> | |
| 77 | + </p> | |
| 78 | + </div> | |
| 79 | + </div> | |
| 80 | + <div class="cell large-3 hide-for-medium-only hide-for-small-only text-center"> | |
| 81 | + <div class="queue_lists"> | |
| 82 | + <?php | |
| 83 | + if (!$row->iscampaign) { | |
| 84 | + echo esc_html($row->lists); | |
| 85 | + } else { | |
| 86 | + $i = 0; | |
| 87 | + $class = 'acym_subscription acymicon-circle'; | |
| 88 | + foreach ($row->lists as $oneList) { | |
| 89 | + if ($i == 6) { | |
| 90 | + acym_tooltip( | |
| 91 | + [ | |
| 92 | + 'hoveredText' => '<i data-campaign="'.$row->id.'" class="acym_subscription acymicon-add"></i>', | |
| 93 | + 'textShownInTooltip' => acym_translation('ACYM_SHOW_ALL_LISTS'), | |
| 94 | + ] | |
| 95 | + ); | |
| 96 | + $class .= ' is-hidden'; | |
| 97 | + } | |
| 98 | + acym_tooltip( | |
| 99 | + [ | |
| 100 | + 'hoveredText' => '<i class="'.esc_attr($class).'" style="color:'.esc_attr($oneList->color ?? '#0079d3').'"></i>', | |
| 101 | + 'textShownInTooltip' => $oneList->name, | |
| 102 | + ] | |
| 103 | + ); | |
| 104 | + $i++; | |
| 105 | + } | |
| 106 | + } | |
| 107 | + ?> | |
| 108 | + </div> | |
| 109 | + <?php | |
| 110 | + if (!empty($row->recipients)) { | |
| 111 | + echo wp_kses( | |
| 112 | + acym_translationSprintf('ACYM_X_RECIPIENTS', '<strong>'.number_format($row->recipients, 0, '.', ' ').'</strong>'), | |
| 113 | + [ | |
| 114 | + 'strong' => [], | |
| 115 | + ] | |
| 116 | + ); | |
| 117 | + } | |
| 118 | + ?> | |
| 119 | + </div> | |
| 120 | + <div class="cell medium-4 small-9"> | |
| 121 | + <div class="acym_vcenter grid-x text-center"> | |
| 122 | + <?php | |
| 123 | + // First determine the type (paused / sending) | |
| 124 | + if (!$row->iscampaign) { | |
| 125 | + $text = acym_translation('ACYM_SCHEDULED'); | |
| 126 | + $class = 'acym_status_scheduled'; | |
| 127 | + } elseif ($row->active == 0) { | |
| 128 | + $text = acym_translation('ACYM_PAUSED'); | |
| 129 | + $class = 'acym_status_paused'; | |
| 130 | + } else { | |
| 131 | + if ($this->config->get('cron_last', 0) < (time() - 43200)) { | |
| 132 | + $text = acym_translation('ACYM_QUEUE_READY'); | |
| 133 | + $class = 'acym_status_ready'; | |
| 134 | + } else { | |
| 135 | + $text = acym_translation('ACYM_QUEUE_SENDING'); | |
| 136 | + $class = 'acym_status_sending'; | |
| 137 | + } | |
| 138 | + } | |
| 139 | + ?> | |
| 140 | + | |
| 141 | + <div class="cell"> | |
| 142 | + <div class="progress_bar <?php echo esc_attr($class); ?>"> | |
| 143 | + <?php | |
| 144 | + $percentageSent = 0; | |
| 145 | + if (!empty($row->nbqueued) && $row->iscampaign) { | |
| 146 | + if (!empty($row->recipients)) { | |
| 147 | + $percentageSent = 100 - ceil($row->nbqueued * 100 / $row->recipients); | |
| 148 | + } | |
| 149 | + echo '<div class="progress_bar_left" style="width: '.esc_attr($percentageSent).'%;"></div>'; | |
| 150 | + } | |
| 151 | + ?> | |
| 152 | + <div class="progress_bar_text grid-x"> | |
| 153 | + <span class="cell auto acym_text_ellipsis"><?php echo esc_html($text); ?></span> | |
| 154 | + <?php | |
| 155 | + if (!empty($row->nbqueued) && $row->iscampaign) { | |
| 156 | + echo '<span class="cell" style="width: 40px;">'.esc_html($percentageSent).'%</span>'; | |
| 157 | + } | |
| 158 | + ?> | |
| 159 | + </div> | |
| 160 | + </div> | |
| 161 | + </div> | |
| 162 | + | |
| 163 | + <?php if ($row->active == 1) { ?> | |
| 164 | + <div class="cell acym_sendnow"> | |
| 165 | + | |
| 166 | + <?php | |
| 167 | + $sendID = 'send_campaign_'.$row->id; | |
| 168 | + acym_modal( | |
| 169 | + '<i class="acymicon-paper-plane" data-acy-elementid="'.esc_attr($row->id).'"></i> '.acym_translation('ACYM_SEND_NOW'), | |
| 170 | + '', | |
| 171 | + null, | |
| 172 | + ['data-reveal-larger' => true], | |
| 173 | + [ | |
| 174 | + 'data-reload' => 'true', | |
| 175 | + 'data-ajax' => 'true', | |
| 176 | + 'data-iframe' => '&ctrl=queue&task=continuesend&id='.$row->id.'&totalsend='.$row->nbqueued, | |
| 177 | + ] | |
| 178 | + ); | |
| 179 | + ?> | |
| 180 | + </div> | |
| 181 | + <?php } ?> | |
| 182 | + </div> | |
| 183 | + </div> | |
| 184 | + <div class="cell medium-2 small-3"> | |
| 185 | + <div class="acym_vcenter"> | |
| 186 | + <?php | |
| 187 | + // Now display the action buttons | |
| 188 | + echo '<div class="acym_action_buttons">'; | |
| 189 | + | |
| 190 | + $cancelText = 'ACYM_CANCEL_SCHEDULING'; | |
| 191 | + // Play/pause button | |
| 192 | + if (!empty($row->nbqueued) && $row->iscampaign) { | |
| 193 | + $class = $row->active == 0 ? 'acymicon-play-circle-filled' : 'acymicon-pause-circle'; | |
| 194 | + acym_tooltip([ | |
| 195 | + 'hoveredText' => '<i campaignid="'.esc_attr($row->campaign).'" class="'.esc_attr($class).' acym__queue__play_pause__button"></i>', | |
| 196 | + 'textShownInTooltip' => acym_translation($row->active == 0 ? 'ACYM_UNPAUSE_CAMPAIGN' : 'ACYM_PAUSE_CAMPAIGN'), | |
| 197 | + ]); | |
| 198 | + $cancelText = 'ACYM_CANCEL_CAMPAIGN'; | |
| 199 | + } | |
| 200 | + | |
| 201 | + // Delete button | |
| 202 | + acym_tooltip( | |
| 203 | + [ | |
| 204 | + 'hoveredText' => '<i class="acymicon-times-circle acym__queue__cancel__button" mailid="'.$row->id.'"></i>', | |
| 205 | + 'textShownInTooltip' => acym_translation($cancelText), | |
| 206 | + ] | |
| 207 | + ); | |
| 208 | + echo '</div>'; | |
| 209 | + ?> | |
| 210 | + </div> | |
| 211 | + </div> | |
| 212 | + </div> | |
| 213 | + <?php } ?> | |
| 214 | + </div> | |
| 215 | + <?php $data['pagination']->display('cqueue'); ?> | |
| 216 | + <?php } ?> | |
| 217 | + <?php } ?> | |
| 218 | + <?php acym_formOptions(); ?> | |
| 219 | + <input type="hidden" name="acym__queue__cancel__mail_id"> | |
| 220 | + <input type="hidden" name="acym__queue__play_pause__campaign_id"> | |
| 221 | + <input type="hidden" name="acym__queue__play_pause__active__new_value"> | |
| 222 | + </div> | |
| 223 | +</form> | |