| 1 |
<?php |
| 2 |
|
| 3 |
namespace AcyMailing\Controllers; |
| 4 |
|
| 5 |
use AcyMailing\Classes\UserClass; |
| 6 |
use AcyMailing\Core\AcymController; |
| 7 |
use AcyMailing\Controllers\Users\Listing; |
| 8 |
use AcyMailing\Controllers\Users\Edition; |
| 9 |
use AcyMailing\Controllers\Users\Import; |
| 10 |
use AcyMailing\Controllers\Users\Export; |
| 11 |
use AcyMailing\Controllers\Users\Subscription; |
| 12 |
|
| 13 |
class UsersController extends AcymController |
| 14 |
{ |
| 15 |
use Listing; |
| 16 |
use Edition; |
| 17 |
use Import; |
| 18 |
use Export; |
| 19 |
use Subscription; |
| 20 |
|
| 21 |
public function __construct() |
| 22 |
{ |
| 23 |
parent::__construct(); |
| 24 |
$this->breadcrumb[acym_translation('ACYM_SUBSCRIBERS')] = acym_completeLink('users'); |
| 25 |
$this->loadScripts = [ |
| 26 |
'edit' => ['datepicker'], |
| 27 |
'all' => ['vue-applications' => ['entity_select']], |
| 28 |
]; |
| 29 |
} |
| 30 |
|
| 31 |
public function getAll() |
| 32 |
{ |
| 33 |
$userClass = new UserClass(); |
| 34 |
return $userClass->getAll(); |
| 35 |
} |
| 36 |
|
| 37 |
public function clean() |
| 38 |
{ |
| 39 |
if (acym_isAcyCheckerInstalled()) { |
| 40 |
if (ACYM_CMS === 'joomla') { |
| 41 |
acym_redirect(acym_route('index.php?option=com_acychecker', false)); |
| 42 |
} else { |
| 43 |
acym_redirect(admin_url().'admin.php?page=acychecker_dashboard'); |
| 44 |
} |
| 45 |
} else { |
| 46 |
acym_redirect(acym_completeLink('dashboard&task=acychecker', false, true)); |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
public function getUserInfoAjax() |
| 51 |
{ |
| 52 |
$userId = acym_getVar('int', 'userId', 0); |
| 53 |
|
| 54 |
if (empty($userId)) { |
| 55 |
acym_sendAjaxResponse(acym_translation('ACYM_USER_NOT_FOUND'), [], false); |
| 56 |
} |
| 57 |
|
| 58 |
$userClass = new UserClass(); |
| 59 |
$user = $userClass->getCustomFieldValueById($userId); |
| 60 |
|
| 61 |
if (empty($user)) { |
| 62 |
acym_sendAjaxResponse(acym_translation('ACYM_SUBSCRIBER_NOT_CUSTOM_FIELD'), [], false); |
| 63 |
} |
| 64 |
|
| 65 |
acym_sendAjaxResponse('', $user); |
| 66 |
} |
| 67 |
} |
| 68 |
|