← All changes
|
back/dynamics/subscriber/SubscriberAutomationActions.php
+41
-35
11.0.1
→
11.1.0
View file →
| @@ -48,10 +48,32 @@ | ||
| 48 | 48 | echo json_encode($return); |
| 49 | 49 | exit; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function onAcymDeclareActions(array &$actions): void | |
| 52 | + protected function initAutomationActions(): void | |
| 53 | 53 | { |
| 54 | + $this->automationActions = [ | |
| 55 | + 'acy_user' => acym_translation('ACYM_ACTION_ON_USERS'), | |
| 56 | + 'acy_user_value' => acym_translation('ACYM_SET_USER_VALUE'), | |
| 57 | + 'acy_add_queue' => acym_translation('ACYM_ADD_EMAIL_QUEUE'), | |
| 58 | + 'acy_send_email' => acym_translation('ACYM_SEND_EMAIL'), | |
| 59 | + 'acy_remove_queue' => acym_translation('ACYM_REMOVE_EMAIL_QUEUE'), | |
| 60 | + ]; | |
| 61 | + | |
| 62 | + if ($this->config->get('require_confirmation', '1') === '1') { | |
| 63 | + $this->automationActions['resend_confirmation'] = acym_translation('ACYM_RESEND_CONFIRMATION'); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + public function onAcymDeclareActionsScenario(array &$actions): void | |
| 68 | + { | |
| 69 | + $this->onAcymDeclareActions($actions); | |
| 70 | + | |
| 71 | + unset($actions['acy_add_queue']); | |
| 72 | + } | |
| 73 | + | |
| 74 | + public function displayActionOptions_acy_user(): void | |
| 75 | + { | |
| 54 | 76 | $userActions = [ |
| 55 | 77 | 'confirm' => acym_translation('ACYM_CONFIRM_USER'), |
| 56 | 78 | 'unconfirm' => acym_translation('ACYM_UNCONFIRM_USER'), |
| 57 | 79 | 'active' => acym_translation('ACYM_ACTIVE_USER'), |
| @@ -58,15 +80,13 @@ | ||
| 58 | 80 | 'block' => acym_translation('ACYM_BLOCK_USER'), |
| 59 | 81 | 'delete' => acym_translation('ACYM_DELETE_USER'), |
| 60 | 82 | ]; |
| 61 | 83 | |
| 62 | - $actions['acy_user'] = new stdClass(); | |
| 63 | - $actions['acy_user']->name = acym_translation('ACYM_ACTION_ON_USERS'); | |
| 64 | - | |
| 65 | - ob_start(); | |
| 66 | 84 | include acym_getPartial('actions', 'acy_user'); |
| 67 | - $actions['acy_user']->option = ob_get_clean(); | |
| 85 | + } | |
| 68 | 86 | |
| 87 | + public function displayActionOptions_acy_user_value(): void | |
| 88 | + { | |
| 69 | 89 | $userClass = new UserClass(); |
| 70 | 90 | $userFields = $userClass->getAllColumnsUserAndCustomField(true); |
| 71 | 91 | unset($userFields['id']); |
| 72 | 92 | unset($userFields['cms_id']); |
| @@ -86,51 +106,36 @@ | ||
| 86 | 106 | ]; |
| 87 | 107 | |
| 88 | 108 | $fieldClass = new FieldClass(); |
| 89 | 109 | $customFields = $fieldClass->getAllFieldsForUser(); |
| 90 | - $customFieldValues = []; | |
| 91 | 110 | |
| 92 | - $actions['acy_user_value'] = new stdClass(); | |
| 93 | - $actions['acy_user_value']->name = acym_translation('ACYM_SET_USER_VALUE'); | |
| 94 | - ob_start(); | |
| 95 | 111 | include acym_getPartial('actions', 'acy_user_value'); |
| 96 | - $actions['acy_user_value']->option = ob_get_clean(); | |
| 112 | + } | |
| 97 | 113 | |
| 98 | - $actions['acy_add_queue'] = new stdClass(); | |
| 99 | - $actions['acy_add_queue']->name = acym_translation('ACYM_ADD_EMAIL_QUEUE'); | |
| 100 | - ob_start(); | |
| 114 | + public function displayActionOptions_acy_add_queue(): void | |
| 115 | + { | |
| 101 | 116 | include acym_getPartial('actions', 'acy_add_queue'); |
| 102 | - $actions['acy_add_queue']->option = ob_get_clean(); | |
| 117 | + } | |
| 103 | 118 | |
| 104 | - $actions['acy_send_email'] = new stdClass(); | |
| 105 | - $actions['acy_send_email']->name = acym_translation('ACYM_SEND_EMAIL'); | |
| 106 | - ob_start(); | |
| 119 | + public function displayActionOptions_acy_send_email(): void | |
| 120 | + { | |
| 107 | 121 | include acym_getPartial('actions', 'acy_send_email'); |
| 108 | - $actions['acy_send_email']->option = ob_get_clean(); | |
| 122 | + } | |
| 109 | 123 | |
| 110 | - $actions['acy_remove_queue'] = new stdClass(); | |
| 111 | - $actions['acy_remove_queue']->name = acym_translation('ACYM_REMOVE_EMAIL_QUEUE'); | |
| 124 | + public function displayActionOptions_acy_remove_queue(): void | |
| 125 | + { | |
| 112 | 126 | $ajaxParams = [ |
| 113 | 127 | 'plugin' => __CLASS__, |
| 114 | 128 | 'trigger' => 'searchEmails', |
| 115 | 129 | ]; |
| 116 | - ob_start(); | |
| 130 | + | |
| 117 | 131 | include acym_getPartial('actions', 'acy_remove_queue'); |
| 118 | - $actions['acy_remove_queue']->option = ob_get_clean(); | |
| 119 | - | |
| 120 | - if ($this->config->get('require_confirmation', '1') === '1') { | |
| 121 | - $actions['resend_confirmation'] = new stdClass(); | |
| 122 | - $actions['resend_confirmation']->name = acym_translation('ACYM_RESEND_CONFIRMATION'); | |
| 123 | - // The action doesn't save if there are no options | |
| 124 | - $actions['resend_confirmation']->option = '<input type="hidden" name="acym_action[actions][__and__][resend_confirmation][save]" />'; | |
| 125 | - } | |
| 126 | 132 | } |
| 127 | 133 | |
| 128 | - public function onAcymDeclareActionsScenario(array &$actions): void | |
| 134 | + public function displayActionOptions_resend_confirmation(): void | |
| 129 | 135 | { |
| 130 | - $this->onAcymDeclareActions($actions); | |
| 131 | - | |
| 132 | - unset($actions['acy_add_queue']); | |
| 136 | + // The action doesn't save if there are no options | |
| 137 | + echo '<input type="hidden" name="acym_action[actions][__and__][resend_confirmation][save]" />'; | |
| 133 | 138 | } |
| 134 | 139 | |
| 135 | 140 | public function onAcymProcessAction_acy_user(&$query, $action) |
| 136 | 141 | { |
| @@ -347,12 +352,13 @@ | ||
| 347 | 352 | $mail = $mailClass->getOneById($automationAction['acy_add_queue']['mail_id']); |
| 348 | 353 | if (empty($mail)) { |
| 349 | 354 | $automationAction = '<span class="acym__color__red">'.acym_translation('ACYM_SELECT_AN_EMAIL').'</span>'; |
| 350 | 355 | } else { |
| 356 | + $queueTime = empty($automationAction['acy_add_queue']['time']) ? '[time]' : $automationAction['acy_add_queue']['time']; | |
| 351 | 357 | $automationAction = acym_translationSprintf( |
| 352 | 358 | 'ACYM_ACTION_ADD_QUEUE_SUMMARY', |
| 353 | 359 | $mail->name, |
| 354 | - acym_date(acym_replaceDate($automationAction['acy_add_queue']['time']), 'd M Y H:i') | |
| 360 | + acym_date(acym_replaceDate($queueTime), 'd M Y H:i') | |
| 355 | 361 | ); |
| 356 | 362 | } |
| 357 | 363 | } |
| 358 | 364 | |