PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.1
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/Controllers/Stats/Detailed.php +0 -101 10.11.1 → 11.1.1 View file →
@@ -1,101 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Stats;
4 -
5 -use AcyMailing\Classes\UserStatClass;
6 -use AcyMailing\Helpers\ExportHelper;
7 -use AcyMailing\Helpers\PaginationHelper;
8 -
9 -trait Detailed
10 -{
11 - public function detailedStats(): void
12 - {
13 - acym_setVar('layout', 'detailed_stats');
14 -
15 - $data = [];
16 -
17 - $this->prepareDefaultPageInfo($data);
18 -
19 - $this->prepareDetailedListing($data);
20 - if (count($this->selectedMailIds) == 1) {
21 - if ($data['isAbTest']) {
22 - $this->prepareAbTestMails($data);
23 - } elseif (acym_isMultilingual()) {
24 - $this->prepareMultilingualMails($data);
25 - }
26 - }
27 - $this->prepareMailFilter($data);
28 -
29 - parent::display($data);
30 - }
31 -
32 - public function exportDetailed(): void
33 - {
34 - $exportHelper = new ExportHelper();
35 - $data = [];
36 - $this->prepareDefaultPageInfo($data);
37 -
38 - $where = '';
39 - if (!empty($this->selectedMailIds)) {
40 - $where = 'WHERE userstat.`mail_id` IN ('.implode(',', $this->selectedMailIds).')';
41 - }
42 -
43 - $groupBy = ' GROUP BY userstat.mail_id, userstat.user_id ';
44 -
45 - $columnsMailStat = acym_getColumns('user_stat');
46 - $columnsToExport = [];
47 -
48 - $columnsToExport['mail.subject'] = acym_translation('ACYM_EMAIL_SUBJECT');
49 - $columnsToExport['user.email'] = acym_translation('ACYM_USER_EMAIL');
50 - $columnsToExport['user.name'] = acym_translation('ACYM_USER_NAME');
51 - foreach ($columnsMailStat as $column) {
52 - if (in_array($column, ['user_id', 'mail_id'])) continue;
53 - $trad = acym_translation('ACYM_'.strtoupper($column).'_COLUMN_STAT');
54 - if ($column === 'send_date') $trad = acym_translation('ACYM_SEND_DATE');
55 - if ($column === 'open') $trad = acym_translation('ACYM_OPEN_TOTAL_COLUMN_STAT');
56 - if ($column === 'bounce') $trad = acym_translation('ACYM_BOUNCE_UNIQUE_COLUMN_STAT');
57 - $columnsToExport['userstat.'.$column] = $trad;
58 - }
59 -
60 - $query = 'SELECT '.implode(', ', array_keys($columnsToExport)).', SUM(urlclick.click) AS click FROM #__acym_user_stat AS userstat
61 - LEFT JOIN #__acym_user AS user ON user.id = userstat.user_id
62 - LEFT JOIN #__acym_mail AS mail ON mail.id = userstat.mail_id
63 - LEFT JOIN #__acym_url_click AS urlclick ON urlclick.user_id = userstat.user_id AND userstat.mail_id = urlclick.mail_id '.$where.$groupBy;
64 - $columnsToExport['urlclick.click'] = acym_translation('ACYM_TOTAL_CLICK');
65 - $exportHelper->exportStatsFullCSV($query, $columnsToExport, 'detailed');
66 - exit;
67 - }
68 -
69 - private function prepareDetailedListing(array &$data): void
70 - {
71 - $data['search'] = $this->getVarFiltersListing('string', 'detailed_stats_search', '');
72 - $data['ordering'] = $this->getVarFiltersListing('string', 'detailed_stats_ordering', 'send_date');
73 - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', 'detailed_stats_ordering_sort_order', 'desc');
74 -
75 - if (empty($this->selectedMailIds)) {
76 - return;
77 - }
78 -
79 - $userStatClass = new UserStatClass();
80 - $pagination = new PaginationHelper();
81 -
82 - $detailedStatsPerPage = $pagination->getListLimit();
83 - $page = $this->getVarFiltersListing('int', 'detailed_stats_pagination_page', 1);
84 -
85 - $matchingDetailedStats = $userStatClass->getDetailedStats(
86 - [
87 - 'ordering' => $data['ordering'],
88 - 'ordering_sort_order' => $data['orderingSortOrder'],
89 - 'search' => $data['search'],
90 - 'detailedStatsPerPage' => $detailedStatsPerPage,
91 - 'offset' => ($page - 1) * $detailedStatsPerPage,
92 - 'mail_ids' => $this->selectedMailIds,
93 - ]
94 - );
95 -
96 - $pagination->setStatus((int)$matchingDetailedStats['total']->total, $page, $detailedStatsPerPage);
97 -
98 - $data['pagination'] = $pagination;
99 - $data['detailed_stats'] = $matchingDetailedStats['detailed_stats'];
100 - }
101 -}