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/Forms/Listing.php +0 -71 10.11.1 → 11.1.1 View file →
@@ -1,71 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Controllers\Forms;
4 -
5 -use AcyMailing\Classes\FormClass;
6 -use AcyMailing\Helpers\PaginationHelper;
7 -use AcyMailing\Helpers\ToolbarHelper;
8 -
9 -trait Listing
10 -{
11 - public function listing(): void
12 - {
13 - acym_setVar('layout', 'listing');
14 - $pagination = new PaginationHelper();
15 - $searchFilter = $this->getVarFiltersListing('string', 'forms_search', '');
16 - $status = $this->getVarFiltersListing('string', 'forms_status', '');
17 - $tagFilter = $this->getVarFiltersListing('string', 'forms_tag', '');
18 - $ordering = $this->getVarFiltersListing('string', 'forms_ordering', 'id');
19 - $orderingSortOrder = $this->getVarFiltersListing('string', 'forms_ordering_sort_order', 'asc');
20 - $formClass = new FormClass();
21 -
22 - $formsPerPage = $pagination->getListLimit();
23 - $page = $this->getVarFiltersListing('int', 'forms_pagination_page', 1);
24 -
25 - $requestData = [
26 - 'ordering' => $ordering,
27 - 'search' => $searchFilter,
28 - 'elementsPerPage' => $formsPerPage,
29 - 'offset' => ($page - 1) * $formsPerPage,
30 - 'tag' => $tagFilter,
31 - 'ordering_sort_order' => $orderingSortOrder,
32 - 'status' => $status,
33 - ];
34 -
35 - $matchingForms = $this->getMatchingElementsFromData($requestData, $status, $page);
36 -
37 - $pagination->setStatus($matchingForms['total']->total, $page, $formsPerPage);
38 -
39 - $filters = [
40 - 'all' => $matchingForms['total']->total,
41 - 'active' => $matchingForms['total']->totalActive,
42 - 'inactive' => $matchingForms['total']->total - $matchingForms['total']->totalActive,
43 - ];
44 -
45 - $data = [
46 - 'allForms' => $matchingForms['elements'],
47 - 'pagination' => $pagination,
48 - 'search' => $searchFilter,
49 - 'ordering' => $ordering,
50 - 'tag' => $tagFilter,
51 - 'status' => $status,
52 - 'orderingSortOrder' => $orderingSortOrder,
53 - 'formsNumberPerStatus' => $filters,
54 - 'formTypes' => $formClass->getTranslatedTypes(),
55 - 'formClass' => $formClass,
56 - ];
57 -
58 - $this->prepareToolbar($data);
59 -
60 - parent::display($data);
61 - }
62 -
63 - public function prepareToolbar(array &$data): void
64 - {
65 - $toolbarHelper = new ToolbarHelper();
66 - $toolbarHelper->addSearchBar($data['search'], 'forms_search', 'ACYM_SEARCH');
67 - $toolbarHelper->addButton(acym_translation('ACYM_CREATE'), ['data-task' => 'newForm'], 'add', true);
68 -
69 - $data['toolbar'] = $toolbarHelper;
70 - }
71 -}