| @@ -1,0 +1,206 @@ | ||
| 1 | +<?php | |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | +?> | |
| 5 | +<form id="acym_form" action="<?php echo esc_url(acym_completeLink(acym_getVar('cmd', 'ctrl'))); ?>" method="post" name="acyForm" data-abide novalidate> | |
| 6 | + <input type="hidden" name="id" value="<?php echo !empty($data['automation']->id) ? intval($data['automation']->id) : ''; ?>"> | |
| 7 | + <input type="hidden" name="stepAutomationId" value="<?php echo empty($data['step']->id) ? '' : intval($data['step']->id); ?>"> | |
| 8 | + <input type="hidden" name="automation[admin]" value="<?php echo empty($data['automation']->admin) ? '' : intval($data['automation']->admin); ?>"> | |
| 9 | + <div class="acym__content cell grid-x" id="acym__automation__info"> | |
| 10 | + <?php | |
| 11 | + if (empty($data['automation']->id)) { | |
| 12 | + $data['workflowHelper']->disabledAfter = 'info'; | |
| 13 | + } | |
| 14 | + $data['workflowHelper']->display($this->steps, $this->step); | |
| 15 | + ?> | |
| 16 | + <div class="cell grid-x grid-margin-x"> | |
| 17 | + <div class="medium-12 small-12 cell grid-x acym__content acym__automation__info__first margin-top-2 margin-y"> | |
| 18 | + <div class="cell medium-6"> | |
| 19 | + <label for="automation_name"><?php echo esc_html(acym_translation('ACYM_NAME')); ?></label> | |
| 20 | + <?php if (empty($data['automation']->admin)) { ?> | |
| 21 | + <input required | |
| 22 | + type="text" | |
| 23 | + id="automation_name" | |
| 24 | + name="automation[name]" | |
| 25 | + value="<?php echo !empty($data['automation']->name) ? esc_attr($data['automation']->name) : ''; ?>"> | |
| 26 | + <?php } else { ?> | |
| 27 | + <input required | |
| 28 | + type="text" | |
| 29 | + id="automation_name" | |
| 30 | + name="automation[name]" | |
| 31 | + disabled | |
| 32 | + value="<?php echo esc_attr(acym_translation($data['automation']->name)); ?>"> | |
| 33 | + <?php } ?> | |
| 34 | + </div> | |
| 35 | + <div class="cell medium-shrink grid-x acym_vcenter margin-left-2" <?php echo empty($data['automation']->id) ? 'style="display: none"' : ''; ?>> | |
| 36 | + <?php acym_switch([ | |
| 37 | + 'name' => 'automation[active]', | |
| 38 | + 'value' => $data['automation']->active, | |
| 39 | + 'label' => acym_translation('ACYM_ACTIVE'), | |
| 40 | + ]); ?> | |
| 41 | + </div> | |
| 42 | + <label class="cell"> | |
| 43 | + <h6 id="acym__automation__info__desc__button" class="cursor-pointer"> | |
| 44 | + <?php echo esc_html(acym_translation('ACYM_DESCRIPTION')); ?> | |
| 45 | + <i class="acymicon-keyboard-arrow-down"></i> | |
| 46 | + </h6> | |
| 47 | + <?php if (!empty($data['automation']->admin)) $data['automation']->description = esc_html(acym_translation($data['automation']->description)); ?> | |
| 48 | + <textarea style="display: none" | |
| 49 | + name="automation[description]" <?php echo empty($data['automation']->admin) ? '' : 'disabled'; ?> rows="6" | |
| 50 | + class="margin-top-1"><?php echo !empty($data['automation']->description) ? esc_html( | |
| 51 | + $data['automation']->description | |
| 52 | + ) : ''; ?></textarea> | |
| 53 | + </label> | |
| 54 | + </div> | |
| 55 | + <div class="medium-12 cell grid-x acym__content acym__automation__info__trigger margin-top-2"> | |
| 56 | + <div class="cell grid-x margin-bottom-2" id="acym__automation__info__choose__trigger__type"> | |
| 57 | + <input type="hidden" | |
| 58 | + name="type_trigger" | |
| 59 | + value="<?php echo !empty($data['type_trigger']) ? esc_attr($data['type_trigger']) : 'classic'; ?>" | |
| 60 | + id="acym__automation__trigger__type__input"> | |
| 61 | + <div class="cell auto"></div> | |
| 62 | + <?php | |
| 63 | + $class = ''; | |
| 64 | + if (!empty($data['type_trigger']) && $data['type_trigger'] == 'classic') { | |
| 65 | + $class = 'selected-trigger'; | |
| 66 | + } elseif (empty($data['type_trigger'])) { | |
| 67 | + $class = 'selected-trigger'; | |
| 68 | + } | |
| 69 | + ?> | |
| 70 | + <p id="acym__automation__info__group" | |
| 71 | + data-trigger-type="classic" | |
| 72 | + class="shrink cell <?php echo esc_attr($class); ?> margin-right-2"> | |
| 73 | + <?php echo esc_html(acym_translation('ACYM_CLASSIC_TRIGGER')); ?> | |
| 74 | + </p> | |
| 75 | + <p id="acym__automation__info__one-user" | |
| 76 | + data-trigger-type="user" | |
| 77 | + class="shrink cell <?php echo (!empty($data['type_trigger']) && $data['type_trigger'] == 'user') ? 'selected-trigger' : ''; ?>"><?php echo esc_html( | |
| 78 | + acym_translation( | |
| 79 | + 'ACYM_TRIGGER_BASED_ON_USER_ACTIONS' | |
| 80 | + ) | |
| 81 | + ); ?></p> | |
| 82 | + <div class="cell auto"></div> | |
| 83 | + </div> | |
| 84 | + <div class="acym__automation__info__choose__trigger cell grid-x grid-margin-x grid-margin-y" | |
| 85 | + id="acym__automation__info__choose__trigger__classic" <?php echo (!empty($data['type_trigger']) && $data['type_trigger'] == 'classic') ? '' | |
| 86 | + : (empty($data['type_trigger']) ? '' : 'style="display: none"'); ?>> | |
| 87 | + <div class="cell large-6 acym__content grid-x acym__automation__draggable"> | |
| 88 | + <h6 class="acym__title acym__title__secondary"><?php echo esc_html(acym_translation('ACYM_ALL_TRIGGER')); ?></h6> | |
| 89 | + <div class="cell acym__automation__all-trigger__classic grid-x"> | |
| 90 | + <?php | |
| 91 | + foreach ($data['classic'] as $key => $classic) { | |
| 92 | + ?> | |
| 93 | + <div | |
| 94 | + <?php echo in_array($key, $data['defaultValues']) ? 'style="display: none"' : ''; ?> | |
| 95 | + class="acym__automation__trigger__droppable__classic margin-top-1 cell" | |
| 96 | + data-trigger="<?php echo esc_attr($key); ?>"> | |
| 97 | + <span class="acym__automation__trigger__name"> | |
| 98 | + <?php echo esc_html($classic->name); ?> | |
| 99 | + </span> | |
| 100 | + <span class="acym__automation__trigger__action"> | |
| 101 | + <?php acym_displayAddonOption($classic); ?> | |
| 102 | + </span> | |
| 103 | + </div> | |
| 104 | + <?php } ?> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + | |
| 108 | + <div class="cell large-6 acym__content grid-x acym__automation__droppable__classic"> | |
| 109 | + <h6 class="acym__title acym__title__secondary cell"><?php echo esc_html(acym_translation('ACYM_EXECUTE_AUTOMATION')); ?></h6> | |
| 110 | + <div class="cell acym__automation__user-trigger__classic acym__automation__trigger__sortable"> | |
| 111 | + <?php | |
| 112 | + if (count($data['defaultValues']) < 2) { | |
| 113 | + echo '<div class="cell margin-top-1 acym__automation__drag-here-text">'.esc_html(acym_translation('ACYM_DRAG_YOUR_TRIGGERS')).'</div>'; | |
| 114 | + } | |
| 115 | + foreach ($data['classic'] as $key => $classic) { | |
| 116 | + if (!in_array($key, $data['defaultValues'])) continue; | |
| 117 | + ?> | |
| 118 | + <div class="acym__automation__droppable__trigger margin-top-1"> | |
| 119 | + <div class="acym__automation__one__trigger"> | |
| 120 | + <span class="acym__automation__trigger__name"> | |
| 121 | + <?php echo esc_html($classic->name); ?> | |
| 122 | + </span> | |
| 123 | + <span class="acym__automation__trigger__action"> | |
| 124 | + <?php acym_displayAddonOption($classic); ?> | |
| 125 | + </span> | |
| 126 | + </div> | |
| 127 | + <i data-trigger-show="<?php echo esc_attr($key); ?>" | |
| 128 | + class="acymicon-close acym__color__red acym__automation__delete__trigger cursor-pointer"></i> | |
| 129 | + </div> | |
| 130 | + <?php | |
| 131 | + } | |
| 132 | + ?> | |
| 133 | + </div> | |
| 134 | + </div> | |
| 135 | + </div> | |
| 136 | + <div class="acym__automation__info__choose__trigger cell grid-x grid-margin-x grid-margin-y" | |
| 137 | + id="acym__automation__info__choose__trigger__user" <?php echo (!empty($data['type_trigger']) && $data['type_trigger'] == 'user') ? '' | |
| 138 | + : 'style="display: none"'; ?>> | |
| 139 | + <div class="cell large-6 acym__content grid-x acym__automation__draggable"> | |
| 140 | + <h6 class="acym__title acym__title__secondary"><?php echo esc_html(acym_translation('ACYM_ALL_TRIGGER')); ?></h6> | |
| 141 | + <div class="cell acym__automation__all-trigger__action grid-x"> | |
| 142 | + <?php | |
| 143 | + foreach ($data['user'] as $key => $triggerUser) { | |
| 144 | + ?> | |
| 145 | + <div | |
| 146 | + <?php echo in_array($key, $data['defaultValues']) ? 'style="display: none"' : ''; ?> | |
| 147 | + class="acym__automation__trigger__droppable__action margin-top-1 cell" | |
| 148 | + data-trigger="<?php echo esc_attr($key); ?>"> | |
| 149 | + <span class="acym__automation__trigger__name"> | |
| 150 | + <?php echo esc_html($triggerUser->name); ?> | |
| 151 | + </span> | |
| 152 | + <span class="acym__automation__trigger__action"> | |
| 153 | + <?php acym_displayAddonOption($triggerUser); ?> | |
| 154 | + </span> | |
| 155 | + </div> | |
| 156 | + <?php } ?> | |
| 157 | + </div> | |
| 158 | + </div> | |
| 159 | + | |
| 160 | + <div class="cell large-6 acym__content grid-x acym__automation__droppable__action"> | |
| 161 | + <h6 class="acym__title acym__title__secondary cell"><?php echo esc_html(acym_translation('ACYM_EXECUTE_AUTOMATION')); ?></h6> | |
| 162 | + <div class="cell acym__automation__user-trigger__action acym__automation__trigger__sortable"> | |
| 163 | + <?php | |
| 164 | + if (count($data['defaultValues']) < 2) { | |
| 165 | + echo '<div class="cell margin-top-1 acym__automation__drag-here-text">'.esc_html(acym_translation('ACYM_DRAG_YOUR_TRIGGERS')).'</div>'; | |
| 166 | + } | |
| 167 | + foreach ($data['user'] as $key => $triggerUser) { | |
| 168 | + if (!in_array($key, $data['defaultValues'])) continue; | |
| 169 | + ?> | |
| 170 | + <div class="acym__automation__droppable__trigger margin-top-1"> | |
| 171 | + <div class="acym__automation__one__trigger"> | |
| 172 | + <span class="acym__automation__trigger__name"> | |
| 173 | + <?php echo esc_html($triggerUser->name); ?> | |
| 174 | + </span> | |
| 175 | + <span class="acym__automation__trigger__action"> | |
| 176 | + <?php acym_displayAddonOption($triggerUser); ?> | |
| 177 | + </span> | |
| 178 | + </div> | |
| 179 | + <i data-trigger-show="<?php echo esc_attr($key); ?>" | |
| 180 | + class="acymicon-close acym__color__red acym__automation__delete__trigger cursor-pointer"></i> | |
| 181 | + </div> | |
| 182 | + <?php | |
| 183 | + } | |
| 184 | + ?> | |
| 185 | + </div> | |
| 186 | + </div> | |
| 187 | + </div> | |
| 188 | + </div> | |
| 189 | + <div class="cell grid-x margin-top-2"> | |
| 190 | + <div class="cell medium-shrink medium-margin-bottom-0 margin-bottom-1 text-left"> | |
| 191 | + <?php acym_backToListing('automation'); ?> | |
| 192 | + </div> | |
| 193 | + <div class="cell medium-auto grid-x grid-margin-x text-right"> | |
| 194 | + <div class="cell auto"></div> | |
| 195 | + <button class="cell medium-shrink button medium-margin-bottom-0 margin-bottom-1 acy_button_submit button-secondary" | |
| 196 | + type="button" | |
| 197 | + data-task="saveExitInfo"><?php echo esc_html(acym_translation('ACYM_SAVE_EXIT')); ?></button> | |
| 198 | + <button class="cell medium-shrink button margin-bottom-0 acy_button_submit" type="button" data-task="saveInfo"> | |
| 199 | + <?php echo esc_html(acym_translation('ACYM_SAVE_CONTINUE')); ?> | |
| 200 | + </button> | |
| 201 | + </div> | |
| 202 | + </div> | |
| 203 | + </div> | |
| 204 | + </div> | |
| 205 | + <?php acym_formOptions(); ?> | |
| 206 | +</form> | |