| @@ -18,9 +18,8 @@ | ||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function storeRedirectListing(bool $fromListing = false): void |
| 21 | 21 | { |
| 22 | - acym_session(); | |
| 23 | 22 | $isFrontJoomla = !acym_isAdmin() && ACYM_CMS === 'joomla'; |
| 24 | 23 | $variableName = $isFrontJoomla ? 'ctrl_stored_front' : 'ctrl_stored'; |
| 25 | 24 | |
| 26 | 25 | $currentTask = acym_getVar('string', 'task', ''); |
| @@ -27,10 +26,13 @@ | ||
| 27 | 26 | if (!in_array($currentTask, self::TASKS_TO_REMEMBER_FOR_LISTING) && !$fromListing) { |
| 28 | 27 | return; |
| 29 | 28 | } |
| 30 | 29 | |
| 31 | - if ((empty($currentTask) || !in_array($currentTask, self::TASKS_TO_REMEMBER_FOR_LISTING)) && !empty($_SESSION[$variableName])) { | |
| 32 | - $taskToGo = is_array($_SESSION[$variableName]) ? $_SESSION[$variableName]['task'].'&type='.$_SESSION[$variableName]['type'] : $_SESSION[$variableName]; | |
| 30 | + $controller = acym_getVar('RAW', $variableName, null, 'SESSION'); | |
| 31 | + if ((empty($currentTask) || !in_array($currentTask, self::TASKS_TO_REMEMBER_FOR_LISTING)) && !empty($controller)) { | |
| 32 | + $taskToGo = is_array($controller) | |
| 33 | + ? $controller['task'].'&type='.$controller['type'] | |
| 34 | + : $controller; | |
| 33 | 35 | $link = acym_completeLink(($isFrontJoomla ? 'front' : '').'campaigns&task='.$taskToGo, false, true); |
| 34 | 36 | acym_redirect($link); |
| 35 | 37 | } else { |
| 36 | 38 | if (empty($currentTask) || !in_array($currentTask, self::TASKS_TO_REMEMBER_FOR_LISTING)) { |
| @@ -41,9 +43,9 @@ | ||
| 41 | 43 | $type = acym_getVar('string', 'type', ''); |
| 42 | 44 | $currentTask = empty($type) ? self::TASK_TYPE_CAMPAIGN : ['task' => $currentTask, 'type' => $type]; |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | - $_SESSION[$variableName] = $currentTask; | |
| 47 | + acym_setSession($variableName, $currentTask); | |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | $taskToCall = is_array($currentTask) ? $currentTask['task'] : $currentTask; |
| 49 | 51 | |
| @@ -64,10 +66,9 @@ | ||
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | $isFrontJoomla = !acym_isAdmin() && ACYM_CMS === 'joomla'; |
| 67 | 69 | $variableName = $isFrontJoomla ? 'ctrl_stored_front' : 'ctrl_stored'; |
| 68 | - acym_session(); | |
| 69 | - $_SESSION[$variableName] = $task; | |
| 70 | + acym_setSession($variableName, $task); | |
| 70 | 71 | |
| 71 | 72 | return true; |
| 72 | 73 | } |
| 73 | 74 | |
| @@ -83,8 +84,9 @@ | ||
| 83 | 84 | $type = acym_getVar('string', 'type'); |
| 84 | 85 | |
| 85 | 86 | $data = [ |
| 86 | 87 | 'type' => $type, |
| 88 | + //We set campaign here to generate the statuses in the campaign class in the function getCountStatusFilter | |
| 87 | 89 | 'campaign_type' => 'campaigns', |
| 88 | 90 | ]; |
| 89 | 91 | $this->getAllParamsRequest($data); |
| 90 | 92 | $this->prepareListingClasses($data); |
| @@ -133,13 +135,13 @@ | ||
| 133 | 135 | $data['pagination'] = new PaginationHelper(); |
| 134 | 136 | $data['status'] = ''; |
| 135 | 137 | if (isset($data['campaign_type'])) { |
| 136 | 138 | $data['status'] = $this->getVarFiltersListing('string', $data['campaign_type'].'_status', ''); |
| 137 | - $data['ordering'] = $this->getVarFiltersListing('string', $data['campaign_type'].'_ordering', 'id'); | |
| 138 | - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', $data['campaign_type'].'_ordering_sort_order', 'desc'); | |
| 139 | + $data['ordering'] = $this->getVarFiltersListing('cmd', $data['campaign_type'].'_ordering', 'id'); | |
| 140 | + $data['orderingSortOrder'] = $this->getVarFiltersListing('cmd', $data['campaign_type'].'_ordering_sort_order', 'desc'); | |
| 139 | 141 | } elseif (isset($data['email_type'])) { |
| 140 | - $data['ordering'] = $this->getVarFiltersListing('string', $data['email_type'].'_ordering', 'id'); | |
| 141 | - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', $data['email_type'].'_ordering_sort_order', 'desc'); | |
| 142 | + $data['ordering'] = $this->getVarFiltersListing('cmd', $data['email_type'].'_ordering', 'id'); | |
| 143 | + $data['orderingSortOrder'] = $this->getVarFiltersListing('cmd', $data['email_type'].'_ordering_sort_order', 'desc'); | |
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | if (!empty($data['tag'])) { |
| 145 | 147 | $data['status_toolbar'] = [ |
| @@ -159,12 +161,14 @@ | ||
| 159 | 161 | } |
| 160 | 162 | |
| 161 | 163 | public function prepareEmailsListing(array &$data, string $campaignType = '', string $class = ''): void |
| 162 | 164 | { |
| 165 | + // Prepare the pagination | |
| 163 | 166 | $campaignsPerPage = $data['pagination']->getListLimit(); |
| 164 | 167 | $page = $this->getVarFiltersListing('int', 'campaigns_pagination_page', 1); |
| 165 | 168 | $status = $data['status']; |
| 166 | 169 | |
| 170 | + // Get the matching campaigns | |
| 167 | 171 | $matchingCampaigns = $this->getMatchingElementsFromData( |
| 168 | 172 | [ |
| 169 | 173 | 'element_tab' => $campaignType, |
| 170 | 174 | 'ordering' => $data['ordering'], |