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/Classes/ActionClass.php +0 -79 10.2.2 → 11.1.1 View file →
@@ -1,79 +1,0 @@
1 -<?php
2 -
3 -namespace AcyMailing\Classes;
4 -
5 -use AcyMailing\Core\AcymClass;
6 -
7 -class ActionClass extends AcymClass
8 -{
9 - public function __construct()
10 - {
11 - parent::__construct();
12 -
13 - $this->table = 'action';
14 - $this->pkey = 'id';
15 - }
16 -
17 - public function getActionsByStepId($stepId): array
18 - {
19 - return acym_loadObjectList(
20 - 'SELECT `action`.*
21 - FROM #__acym_action AS `action`
22 - LEFT JOIN #__acym_condition AS `conditionT` ON `action`.condition_id = `conditionT`.id
23 - WHERE `conditionT`.step_id = '.intval($stepId).'
24 - ORDER BY `action`.order'
25 - );
26 - }
27 -
28 - public function getActionsByConditionId($id): array
29 - {
30 - return acym_loadObjectList(
31 - 'SELECT action.*
32 - FROM #__acym_action as action
33 - WHERE action.condition_id = '.intval($id)
34 - );
35 - }
36 -
37 - public function getOneByConditionId($id)
38 - {
39 - return acym_loadObject(
40 - 'SELECT `action`.*
41 - FROM #__acym_action AS `action`
42 - WHERE `action`.`condition_id` = '.intval($id)
43 - );
44 - }
45 -
46 - public function getAllActionsIdByConditionsId($elements)
47 - {
48 - acym_arrayToInteger($elements);
49 -
50 - return acym_loadResultArray('SELECT id FROM #__acym_action WHERE condition_id IN ('.implode(',', $elements).')');
51 - }
52 -
53 - public function delete($elements)
54 - {
55 - acym_arrayToInteger($elements);
56 - if (empty($elements)) return 0;
57 - $actions = acym_loadObjectList('SELECT * FROM #__acym_action WHERE id IN ('.implode(',', $elements).')');
58 - if (empty($actions)) return 0;
59 -
60 - $mailClass = new MailClass();
61 -
62 - foreach ($actions as $action) {
63 - $action->actions = json_decode($action->actions, true);
64 - if (!empty($action->actions)) {
65 - foreach ($action->actions as $innerAction) {
66 - if (!empty($innerAction['acy_add_queue']) && !empty($innerAction['acy_add_queue']['mail_id'])) $mailClass->delete($innerAction['acy_add_queue']['mail_id']);
67 - }
68 - }
69 - }
70 -
71 - return parent::delete($elements);
72 - }
73 -
74 - public function save($element)
75 - {
76 - if (!isset($element->order)) $element->order = 1;
77 - parent::save($element);
78 - }
79 -}