| @@ -1,256 +1,0 @@ | ||
| 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 | -if (empty($data['allUsers'])) { ?> | |
| 5 | - <h1 class="cell acym__listing__empty__search__title text-center"><?php echo esc_html(acym_translation('ACYM_NO_RESULTS_FOUND')); ?></h1> | |
| 6 | -<?php } else { ?> | |
| 7 | - <div class="cell grid-x margin-top-1"> | |
| 8 | - <div class="grid-x acym__listing__actions cell margin-bottom-1"> | |
| 9 | - <?php | |
| 10 | - $actions = [ | |
| 11 | - 'setActive' => acym_translation('ACYM_ACTIVATE'), | |
| 12 | - 'setInactive' => acym_translation('ACYM_DEACTIVATE'), | |
| 13 | - 'delete' => acym_translation('ACYM_DELETE'), | |
| 14 | - ]; | |
| 15 | - acym_listingActions($actions); | |
| 16 | - ?> | |
| 17 | - </div> | |
| 18 | - <div class="cell grid-x align-justify"> | |
| 19 | - <div class="cell grid-x large-shrink acym_vcenter"> | |
| 20 | - <?php | |
| 21 | - $options = [ | |
| 22 | - '' => ['ACYM_ALL', $data['userNumberPerStatus']['all']], | |
| 23 | - 'active' => ['ACYM_ACTIVE', $data['userNumberPerStatus']['active']], | |
| 24 | - 'inactive' => ['ACYM_INACTIVE', $data['userNumberPerStatus']['inactive']], | |
| 25 | - ]; | |
| 26 | - if ($this->config->get('require_confirmation', '0') == '1') { | |
| 27 | - $options['confirmed'] = ['ACYM_CONFIRMED', $data['userNumberPerStatus']['confirmed']]; | |
| 28 | - $options['unconfirmed'] = ['ACYM_NOT_CONFIRMED', $data['userNumberPerStatus']['unconfirmed']]; | |
| 29 | - } | |
| 30 | - acym_filterStatus($options, $data['status'], 'users_status'); | |
| 31 | - ?> | |
| 32 | - </div> | |
| 33 | - <div class="cell large-shrink acym_listing_sort-by"> | |
| 34 | - <?php acym_sortBy( | |
| 35 | - [ | |
| 36 | - 'id' => acym_strtolower(acym_translation('ACYM_ID')), | |
| 37 | - 'email' => acym_translation('ACYM_EMAIL'), | |
| 38 | - 'name' => acym_translation('ACYM_NAME'), | |
| 39 | - 'creation_date' => acym_translation('ACYM_DATE_CREATED'), | |
| 40 | - 'active' => acym_translation('ACYM_ACTIVE'), | |
| 41 | - 'confirmed' => acym_translation('ACYM_CONFIRMED'), | |
| 42 | - 'cms_id' => acym_translation('ACYM_USER_CMSID'), | |
| 43 | - ], | |
| 44 | - 'users', | |
| 45 | - $data['ordering'], | |
| 46 | - $data['orderingSortOrder'] | |
| 47 | - ); ?> | |
| 48 | - </div> | |
| 49 | - </div> | |
| 50 | - </div> | |
| 51 | - <div class="grid-x acym__listing"> | |
| 52 | - <div class="grid-x cell acym__listing__header"> | |
| 53 | - <div class="medium-shrink small-1 cell"> | |
| 54 | - <input id="checkbox_all" type="checkbox" name="checkbox_all"> | |
| 55 | - </div> | |
| 56 | - <div class="grid-x medium-auto small-11 cell acym__listing__header__title__container"> | |
| 57 | - <div class="cell medium-4 small-7 xlarge-3 acym__listing__header__title"> | |
| 58 | - <?php echo esc_html(acym_translation('ACYM_EMAIL')); ?> | |
| 59 | - </div> | |
| 60 | - <div class="cell hide-for-small-only hide-for-medium-only large-2 acym__listing__header__title"> | |
| 61 | - <?php echo esc_html(acym_translation('ACYM_NAME')); ?> | |
| 62 | - </div> | |
| 63 | - <div class="cell hide-for-small-only hide-for-medium-only large-2 xlarge-1 acym__listing__header__title"> | |
| 64 | - <?php echo esc_html(acym_translation('ACYM_DATE_CREATED')); ?> | |
| 65 | - </div> | |
| 66 | - <?php | |
| 67 | - if (!empty($data['fields'])) { | |
| 68 | - foreach ($data['fields'] as $field) { | |
| 69 | - ?> | |
| 70 | - <div class="cell medium-auto hide-for-small-only acym__listing__header__title"> | |
| 71 | - <?php echo esc_html(acym_translation($field)); ?> | |
| 72 | - </div> | |
| 73 | - <?php | |
| 74 | - } | |
| 75 | - } | |
| 76 | - ?> | |
| 77 | - <div class="cell medium-auto hide-for-small-only acym__listing__header__title"> | |
| 78 | - <?php echo esc_html(acym_translation('ACYM_LISTS')); ?> | |
| 79 | - </div> | |
| 80 | - <?php if (acym_isAdmin()) { ?> | |
| 81 | - <div class="cell medium-1 hide-for-small-only acym__listing__header__title"> | |
| 82 | - <?php echo esc_html(acym_translationSprintf('ACYM_CMS_USER', ACYM_CMS_TITLE)); ?> | |
| 83 | - </div> | |
| 84 | - <?php } ?> | |
| 85 | - <div class="cell medium-1 small-5 small-text-right medium-text-center acym__listing__header__title"> | |
| 86 | - <?php echo esc_html(acym_translation('ACYM_STATUS')); ?> | |
| 87 | - </div> | |
| 88 | - <div class="large-1 cell hide-for-small-only hide-for-medium-only text-center acym__listing__header__title"> | |
| 89 | - <?php echo esc_html(acym_translation('ACYM_ACTIONS')); ?> | |
| 90 | - </div> | |
| 91 | - <div class="cell medium-shrink hide-for-small-only text-center acym__listing__header__title acym__listing__id"> | |
| 92 | - <?php echo esc_html(acym_translation('ACYM_ID')); ?> | |
| 93 | - </div> | |
| 94 | - </div> | |
| 95 | - </div> | |
| 96 | - <?php | |
| 97 | - foreach ($data['allUsers'] as $user) { | |
| 98 | - $linkUser = acym_completeLink(acym_getVar('cmd', 'ctrl').'&task=edit&userId='.$user->id); | |
| 99 | - ?> | |
| 100 | - <div class="grid-x cell align-middle acym__listing__row"> | |
| 101 | - <div class="medium-shrink small-1 cell"> | |
| 102 | - <input id="checkbox_<?php echo esc_attr($user->id); ?>" type="checkbox" name="elements_checked[]" value="<?php echo esc_attr($user->id); ?>"> | |
| 103 | - </div> | |
| 104 | - <div class="grid-x medium-auto small-11 cell acym__listing__title__container"> | |
| 105 | - <div class="grid-x cell small-9 medium-4 xlarge-3 acym__listing__title"> | |
| 106 | - <a class="cell auto" href="<?php echo esc_url($linkUser); ?>"> | |
| 107 | - <div><?php echo esc_html($user->email); ?></div> | |
| 108 | - </a> | |
| 109 | - </div> | |
| 110 | - <div class="cell hide-for-small-only hide-for-medium-only large-2"> | |
| 111 | - <?php echo esc_html($user->name ?? ''); ?> | |
| 112 | - </div> | |
| 113 | - <div class="cell hide-for-small-only hide-for-medium-only large-2 xlarge-1"> | |
| 114 | - <?php | |
| 115 | - acym_tooltip( | |
| 116 | - [ | |
| 117 | - 'hoveredText' => acym_date( | |
| 118 | - $user->creation_date, | |
| 119 | - acym_getDateTimeFormat('ACYM_DATE_FORMAT_LC5') | |
| 120 | - ), | |
| 121 | - 'textShownInTooltip' => acym_date( | |
| 122 | - $user->creation_date, | |
| 123 | - 'Y-m-d H:i:s' | |
| 124 | - ), | |
| 125 | - ] | |
| 126 | - ); | |
| 127 | - ?> | |
| 128 | - </div> | |
| 129 | - <?php | |
| 130 | - if (!empty($user->fields)) { | |
| 131 | - foreach ($user->fields as $field) { | |
| 132 | - ?> | |
| 133 | - <div class="medium-auto hide-for-small-only cell"> | |
| 134 | - <?php echo esc_html($field); ?> | |
| 135 | - </div> | |
| 136 | - <?php | |
| 137 | - } | |
| 138 | - } | |
| 139 | - ?> | |
| 140 | - <div class="acym__users__subscription medium-auto small-11 cell"> | |
| 141 | - <?php | |
| 142 | - if (!empty($data['usersSubscriptions'][$user->id])) { | |
| 143 | - $subscriptionsCount = count($data['usersSubscriptions'][$user->id]); | |
| 144 | - $counter = 0; | |
| 145 | - foreach ($data['usersSubscriptions'][$user->id] as $oneSub) { | |
| 146 | - $classes = 'acym_subscription acym_toggleable '; | |
| 147 | - $newvalue = intval($oneSub->status) === 1 ? 0 : 1; | |
| 148 | - $classes .= $newvalue === 0 ? 'acymicon-circle' : 'acymicon-radio-button-unchecked'; | |
| 149 | - if ($counter >= 5 && $subscriptionsCount !== 6) $classes .= ' acym_subscription_more'; | |
| 150 | - $toggleAttributes = 'data-acy-user-id="'.$user->id.'" data-acy-list-name="'.$oneSub->name.'" data-acy-list-id="'.$oneSub->id.'"'; | |
| 151 | - | |
| 152 | - $dataTask = $newvalue === 0 ? 'unsubscribeOnClick' : 'subscribeOnClick'; | |
| 153 | - $toggleAttributes .= ' data-acy-task="'.$dataTask.'"'; | |
| 154 | - | |
| 155 | - $toggleAttributes .= ' data-acy-newvalue="'.$newvalue.'"'; | |
| 156 | - | |
| 157 | - acym_tooltip( | |
| 158 | - [ | |
| 159 | - 'hoveredText' => '<i class="'.$classes.'" style="color:'.esc_attr($oneSub->color ?? '#0079d3').'" '.$toggleAttributes.'></i>', | |
| 160 | - 'textShownInTooltip' => acym_translationSprintf( | |
| 161 | - $newvalue === 0 ? 'ACYM_SUBSCRIBED_TO_LIST' : 'ACYM_UNSUBSCRIBED_FROM_LIST', | |
| 162 | - esc_html($oneSub->name) | |
| 163 | - ), | |
| 164 | - ] | |
| 165 | - ); | |
| 166 | - $counter++; | |
| 167 | - } | |
| 168 | - | |
| 169 | - if ($counter > 5 && $subscriptionsCount !== 6) { | |
| 170 | - $counter = $counter - 5; | |
| 171 | - echo '<span class="acym__user__show-subscription acymicon-stack" data-iscollapsed="0" acym-data-value="'.esc_attr($counter).'"> | |
| 172 | - <i class="acym__user__button__showsubscription acymicon-circle acymicon-stack-2x"></i> | |
| 173 | - <span class="acym__listing__text acym__user__show-subscription-bt acymicon-stack-1x">+'.esc_html($counter).'</span> | |
| 174 | - </span>'; | |
| 175 | - } | |
| 176 | - } | |
| 177 | - ?> | |
| 178 | - </div> | |
| 179 | - <?php if (acym_isAdmin()) { ?> | |
| 180 | - <div class="cell hide-for-small-only medium-1"> | |
| 181 | - <?php | |
| 182 | - if (empty($user->cms_id)) { | |
| 183 | - echo '-'; | |
| 184 | - } else { | |
| 185 | - echo '<a href="'.esc_url(acym_getCmsUserEdit($user->cms_id)).'" target="_blank">'; | |
| 186 | - echo esc_html($user->cms_username).'<br />'; | |
| 187 | - echo esc_html(acym_translation('ACYM_ID').': '.$user->cms_id); | |
| 188 | - echo '</a>'; | |
| 189 | - } | |
| 190 | - ?> | |
| 191 | - </div> | |
| 192 | - <?php } ?> | |
| 193 | - <div class="acym__listing__controls acym__users__controls small-1 text-center cell acym__icon__table"> | |
| 194 | - <?php | |
| 195 | - if ($user->active == 1) { | |
| 196 | - $class = 'acymicon-check-circle acym__color__green'; | |
| 197 | - $newvalue = 0; | |
| 198 | - $tooltip = 'ACYM_ACTIVATED'; | |
| 199 | - } else { | |
| 200 | - $class = 'acymicon-times-circle acym__color__red'; | |
| 201 | - $newvalue = 1; | |
| 202 | - $tooltip = 'ACYM_DEACTIVATED'; | |
| 203 | - } | |
| 204 | - acym_tooltip( | |
| 205 | - [ | |
| 206 | - 'hoveredText' => '<i data-acy-table="user" data-acy-field="active" data-acy-elementid="'.esc_attr( | |
| 207 | - $user->id | |
| 208 | - ).'" data-acy-newvalue="'.esc_attr($newvalue).'" class="acym_toggleable '.esc_attr($class).'"></i>', | |
| 209 | - 'textShownInTooltip' => acym_translation($tooltip), | |
| 210 | - ] | |
| 211 | - ); | |
| 212 | - | |
| 213 | - if ($this->config->get('require_confirmation', '0') == '1') { | |
| 214 | - if ($user->confirmed == 1) { | |
| 215 | - $class = 'acymicon-check-circle acym__color__green'; | |
| 216 | - $newvalue = 0; | |
| 217 | - $tooltip = 'ACYM_CONFIRMED'; | |
| 218 | - } else { | |
| 219 | - $class = 'acymicon-times-circle acym__color__red'; | |
| 220 | - $newvalue = 1; | |
| 221 | - $tooltip = 'ACYM_NOT_CONFIRMED'; | |
| 222 | - } | |
| 223 | - acym_tooltip( | |
| 224 | - [ | |
| 225 | - 'hoveredText' => '<i data-acy-table="user" data-acy-field="confirmed" data-acy-elementid="'.esc_attr( | |
| 226 | - $user->id | |
| 227 | - ).'" data-acy-newvalue="'.esc_attr($newvalue).'" class="acym_toggleable '.esc_attr($class).'"></i>', | |
| 228 | - 'textShownInTooltip' => acym_translation($tooltip), | |
| 229 | - ] | |
| 230 | - ); | |
| 231 | - } | |
| 232 | - ?> | |
| 233 | - </div> | |
| 234 | - <div class="large-1 hide-for-small-only hide-for-medium-only cell text-center acym__icon__table"> | |
| 235 | - <a href="<?php echo esc_url($linkUser); ?>"><i class="acymicon-pencil" title="<?php echo esc_attr(acym_translation('ACYM_EDIT')); ?>"></i></a> | |
| 236 | - <?php if (acym_isAdmin()) { ?> | |
| 237 | - <a><i class="acymicon-download fastActions" | |
| 238 | - data-action="export" | |
| 239 | - data-acy-elementid="<?php echo esc_attr($user->id); ?>" | |
| 240 | - title="<?php echo esc_attr(acym_translation('ACYM_EXPORT')); ?>"></i></a> | |
| 241 | - <?php } ?> | |
| 242 | - <i class="cursor-pointer acymicon-delete fastActions deleteFastAction" | |
| 243 | - data-action="delete" | |
| 244 | - data-acy-elementid="<?php echo esc_attr($user->id); ?>" | |
| 245 | - title="<?php echo esc_attr(acym_translation('ACYM_DELETE')); ?>"></i> | |
| 246 | - </div> | |
| 247 | - <div class="text-center medium-shrink hide-for-small-only acym__listing__text acym__listing__id"><?php echo esc_html($user->id); ?></div> | |
| 248 | - </div> | |
| 249 | - </div> | |
| 250 | - <?php | |
| 251 | - } | |
| 252 | - ?> | |
| 253 | - </div> | |
| 254 | - <?php | |
| 255 | - $data['pagination']->display('users'); | |
| 256 | -} | |