| @@ -1,62 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -use AcyMailing\Classes\ListClass; | |
| 4 | - | |
| 5 | -include_once __DIR__.DIRECTORY_SEPARATOR.'AcymJFormField.php'; | |
| 6 | - | |
| 7 | -class JFormFieldLists extends AcymJFormField | |
| 8 | -{ | |
| 9 | - public function __construct($form = null) | |
| 10 | - { | |
| 11 | - $this->type = 'lists'; | |
| 12 | - parent::__construct($form); | |
| 13 | - } | |
| 14 | - | |
| 15 | - public function getInput() | |
| 16 | - { | |
| 17 | - | |
| 18 | - $listClass = new ListClass(); | |
| 19 | - $lists = $listClass->getAllWithoutManagement(); | |
| 20 | - foreach ($lists as $i => $oneList) { | |
| 21 | - if ($oneList->active == 0) { | |
| 22 | - unset($lists[$i]); | |
| 23 | - } | |
| 24 | - } | |
| 25 | - | |
| 26 | - if (ACYM_CMS == 'joomla' && $this->value === 'All' && !empty($this->form)) { | |
| 27 | - $formId = $this->form->getData()->get('id'); | |
| 28 | - if (!empty($formId)) { | |
| 29 | - $this->value = ''; | |
| 30 | - } | |
| 31 | - } | |
| 32 | - | |
| 33 | - if (is_string($this->value)) { | |
| 34 | - $this->value = explode(',', $this->value); | |
| 35 | - } | |
| 36 | - | |
| 37 | - if (in_array('None', $this->value)) { | |
| 38 | - $this->value = []; | |
| 39 | - } | |
| 40 | - if (in_array('All', $this->value)) { | |
| 41 | - $visibleLists = []; | |
| 42 | - foreach ($lists as $listId => $oneList) { | |
| 43 | - if ($oneList->visible == 0) continue; | |
| 44 | - | |
| 45 | - $visibleLists[] = $listId; | |
| 46 | - } | |
| 47 | - $this->value = $visibleLists; | |
| 48 | - } | |
| 49 | - | |
| 50 | - return acym_selectMultiple( | |
| 51 | - $lists, | |
| 52 | - $this->name, | |
| 53 | - $this->value, | |
| 54 | - [ | |
| 55 | - 'class' => 'acym_simple_select2', | |
| 56 | - 'id' => $this->name, | |
| 57 | - ], | |
| 58 | - 'id', | |
| 59 | - 'name' | |
| 60 | - ); | |
| 61 | - } | |
| 62 | -} | |