PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.0.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.0.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
acymailing / back / Classes / ActionClass.php

ActionClass.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.0.1, at back/Classes/ActionClass.php

78 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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)
18 {
19 $query = 'SELECT action.* FROM #__acym_action AS action LEFT JOIN #__acym_condition AS conditionT ON action.condition_id = conditionT.id WHERE conditionT.step_id = '.intval(
20 $stepId
21 ).' ORDER BY action.order';
22
23 return acym_loadObjectList($query);
24 }
25
26 public function getActionsByConditionId($id)
27 {
28 return acym_loadObjectList(
29 'SELECT action.*
30 FROM #__acym_action as action
31 WHERE action.condition_id = '.intval($id)
32 );
33 }
34
35 public function getOneByConditionId($id)
36 {
37 return acym_loadObject(
38 'SELECT `action`.*
39 FROM #__acym_action AS `action`
40 WHERE `action`.`condition_id` = '.intval($id)
41 );
42 }
43
44 public function getAllActionsIdByConditionsId($elements)
45 {
46 acym_arrayToInteger($elements);
47
48 return acym_loadResultArray('SELECT id FROM #__acym_action WHERE condition_id IN ('.implode(',', $elements).')');
49 }
50
51 public function delete($elements)
52 {
53 acym_arrayToInteger($elements);
54 if (empty($elements)) return 0;
55 $actions = acym_loadObjectList('SELECT * FROM #__acym_action WHERE id IN ('.implode(',', $elements).')');
56 if (empty($actions)) return 0;
57
58 $mailClass = new MailClass();
59
60 foreach ($actions as $action) {
61 $action->actions = json_decode($action->actions, true);
62 if (!empty($action->actions)) {
63 foreach ($action->actions as $innerAction) {
64 if (!empty($innerAction['acy_add_queue']) && !empty($innerAction['acy_add_queue']['mail_id'])) $mailClass->delete($innerAction['acy_add_queue']['mail_id']);
65 }
66 }
67 }
68
69 return parent::delete($elements);
70 }
71
72 public function save($element)
73 {
74 if (!isset($element->order)) $element->order = 1;
75 parent::save($element);
76 }
77 }
78