| @@ -1,93 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -namespace AcyMailing\Controllers\Stats; | |
| 4 | - | |
| 5 | -use AcyMailing\Classes\UrlClickClass; | |
| 6 | -use AcyMailing\Helpers\ExportHelper; | |
| 7 | -use AcyMailing\Helpers\PaginationHelper; | |
| 8 | - | |
| 9 | -trait UserLinksDetails | |
| 10 | -{ | |
| 11 | - public function exportUserLinksDetails(): void | |
| 12 | - { | |
| 13 | - $data = []; | |
| 14 | - if (!$this->prepareDefaultPageInfo($data, true)) { | |
| 15 | - return; | |
| 16 | - } | |
| 17 | - | |
| 18 | - $this->prepareUserLinksDetailsListing($data); | |
| 19 | - $exportHelper = new ExportHelper(); | |
| 20 | - | |
| 21 | - $columnsToExport['user.email'] = acym_translation('ACYM_SUBSCRIBER'); | |
| 22 | - $columnsToExport['user_name'] = acym_translation('ACYM_USER_NAME'); | |
| 23 | - $columnsToExport['url_name'] = acym_translation('ACYM_URL'); | |
| 24 | - $columnsToExport['date_click'] = acym_translation('ACYM_CLICK_DATE'); | |
| 25 | - $columnsToExport['click'] = acym_translation('ACYM_TOTAL_CLICKS'); | |
| 26 | - | |
| 27 | - $exportHelper->exportStatsFullCSV($data['query'], $columnsToExport, 'user_links_details'); | |
| 28 | - exit; | |
| 29 | - } | |
| 30 | - | |
| 31 | - public function userClickDetails(): void | |
| 32 | - { | |
| 33 | - acym_setVar('layout', 'user_links_details'); | |
| 34 | - | |
| 35 | - $data = []; | |
| 36 | - | |
| 37 | - if (!$this->prepareDefaultPageInfo($data, true)) { | |
| 38 | - return; | |
| 39 | - } | |
| 40 | - | |
| 41 | - $this->prepareUserLinksDetailsListing($data); | |
| 42 | - if (count($this->selectedMailIds) == 1) { | |
| 43 | - if ($data['isAbTest']) { | |
| 44 | - $this->prepareAbTestMails($data); | |
| 45 | - } elseif (acym_isMultilingual()) { | |
| 46 | - $this->prepareMultilingualMails($data); | |
| 47 | - } | |
| 48 | - } | |
| 49 | - $this->prepareMailFilter($data); | |
| 50 | - | |
| 51 | - parent::display($data); | |
| 52 | - } | |
| 53 | - | |
| 54 | - private function prepareUserLinksDetailsListing(array &$data): void | |
| 55 | - { | |
| 56 | - $data['search'] = $this->getVarFiltersListing('string', 'user_links_details_search', ''); | |
| 57 | - $data['ordering'] = $this->getVarFiltersListing('string', 'user_links_details_ordering', 'user_id'); | |
| 58 | - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', 'user_links_details_ordering_sort_order', 'desc'); | |
| 59 | - | |
| 60 | - if (base64_encode(base64_decode($data['search'])) === $data['search']) { | |
| 61 | - $data['search'] = base64_decode($data['search']); | |
| 62 | - } | |
| 63 | - | |
| 64 | - if (empty($this->selectedMailIds)) { | |
| 65 | - return; | |
| 66 | - } | |
| 67 | - | |
| 68 | - $pagination = new PaginationHelper(); | |
| 69 | - $urlClickClass = new UrlClickClass(); | |
| 70 | - | |
| 71 | - $detailedStatsPerPage = $pagination->getListLimit(); | |
| 72 | - $page = $this->getVarFiltersListing('int', 'user_links_details_pagination_page', 1); | |
| 73 | - | |
| 74 | - $userClicks = $urlClickClass->getUserUrlClicksStats( | |
| 75 | - [ | |
| 76 | - 'ordering' => $data['ordering'], | |
| 77 | - 'search' => $data['search'], | |
| 78 | - 'detailedStatsPerPage' => $detailedStatsPerPage, | |
| 79 | - 'offset' => ($page - 1) * $detailedStatsPerPage, | |
| 80 | - 'ordering_sort_order' => $data['orderingSortOrder'], | |
| 81 | - 'mail_ids' => $this->selectedMailIds, | |
| 82 | - ] | |
| 83 | - ); | |
| 84 | - | |
| 85 | - $this->decode($userClicks['user_links_details']); | |
| 86 | - | |
| 87 | - $pagination->setStatus((int)$userClicks['total']->total, $page, $detailedStatsPerPage); | |
| 88 | - | |
| 89 | - $data['pagination'] = $pagination; | |
| 90 | - $data['user_links_details'] = $userClicks['user_links_details']; | |
| 91 | - $data['query'] = $userClicks['query']; | |
| 92 | - } | |
| 93 | -} | |