Commit 8c8f2ff0 authored by Tino Goratsch's avatar Tino Goratsch

- added the a new helper method "checkboxGenerator" to the forms helper object

- reduced code duplication in the users module
parent 15ca0bd2
<?php
namespace ACP3\Core;
use ACP3\Core\Helpers\Country;
use ACP3\Core\Helpers\Secure;
use ACP3\Modules\ACP3\Users;
......@@ -170,7 +171,7 @@ class Auth
$userId = (int)$userId;
if (empty($this->userInfo[$userId])) {
$countries = Lang::worldCountries();
$countries = Country::worldCountries();
$info = $this->usersModel->getOneById($userId);
if (!empty($info)) {
$info['country_formatted'] = !empty($info['country']) && isset($countries[$info['country']]) ? $countries[$info['country']] : '';
......
<?php
namespace ACP3\Core\Helpers;
/**
* Class Country
* @package ACP3\Core\Helpers
*/
class Country
{
/**
* Gibt ein Array mit allen Nationen auf der Erde zurück
*/
public static function worldCountries()
{
return [
'AU' => 'Australia',
'AF' => 'Afghanistan',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
'AQ' => 'Antarctica',
'AG' => 'Antigua & Barbuda',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AW' => 'Aruba',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BS' => 'Bahamas',
'BH' => 'Bahrain',
'BD' => 'Bangladesh',
'BB' => 'Barbados',
'BY' => 'Belarus',
'BE' => 'Belgium',
'BZ' => 'Belize',
'BJ' => 'Benin',
'BM' => 'Bermuda',
'BT' => 'Bhutan',
'BO' => 'Bolivia',
'BA' => 'Bosnia/Hercegovina',
'BW' => 'Botswana',
'BV' => 'Bouvet Island',
'BR' => 'Brazil',
'IO' => 'British Indian Ocean Territory',
'BN' => 'Brunei Darussalam',
'BG' => 'Bulgaria',
'BF' => 'Burkina Faso',
'BI' => 'Burundi',
'KH' => 'Cambodia',
'CM' => 'Cameroon',
'CA' => 'Canada',
'CV' => 'Cape Verde',
'KY' => 'Cayman Is',
'CF' => 'Central African Republic',
'TD' => 'Chad',
'CL' => 'Chile',
'CN' => 'China, People\'s Republic of',
'CX' => 'Christmas Island',
'CC' => 'Cocos Islands',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CG' => 'Congo',
'CD' => 'Congo, Democratic Republic',
'CK' => 'Cook Islands',
'CR' => 'Costa Rica',
'CI' => 'Cote d\'Ivoire',
'HR' => 'Croatia',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czech Republic',
'DK' => 'Denmark',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DO' => 'Dominican Republic',
'TP' => 'East Timor',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'SV' => 'El Salvador',
'GQ' => 'Equatorial Guinea',
'ER' => 'Eritrea',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FK' => 'Falkland Islands',
'FO' => 'Faroe Islands',
'FJ' => 'Fiji',
'FI' => 'Finland',
'FR' => 'France',
'FX' => 'France, Metropolitan',
'GF' => 'French Guiana',
'PF' => 'French Polynesia',
'TF' => 'French South Territories',
'GA' => 'Gabon',
'GM' => 'Gambia',
'GE' => 'Georgia',
'DE' => 'Germany',
'GH' => 'Ghana',
'GI' => 'Gibraltar',
'GR' => 'Greece',
'GL' => 'Greenland',
'GD' => 'Grenada',
'GP' => 'Guadeloupe',
'GU' => 'Guam',
'GT' => 'Guatemala',
'GN' => 'Guinea',
'GW' => 'Guinea-Bissau',
'GY' => 'Guyana',
'HT' => 'Haiti',
'HM' => 'Heard Island And Mcdonald Island',
'HN' => 'Honduras',
'HK' => 'Hong Kong',
'HU' => 'Hungary',
'IS' => 'Iceland',
'IN' => 'India',
'ID' => 'Indonesia',
'IR' => 'Iran',
'IQ' => 'Iraq',
'IE' => 'Ireland',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JP' => 'Japan',
'JT' => 'Johnston Island',
'JO' => 'Jordan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KI' => 'Kiribati',
'KP' => 'Korea, Democratic Peoples Republic',
'KR' => 'Korea, Republic of',
'KW' => 'Kuwait',
'KG' => 'Kyrgyzstan',
'LA' => 'Lao People\'s Democratic Republic',
'LV' => 'Latvia',
'LB' => 'Lebanon',
'LS' => 'Lesotho',
'LR' => 'Liberia',
'LY' => 'Libyan Arab Jamahiriya',
'LI' => 'Liechtenstein',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'MO' => 'Macau',
'MK' => 'Macedonia',
'MG' => 'Madagascar',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'MV' => 'Maldives',
'ML' => 'Mali',
'MT' => 'Malta',
'MH' => 'Marshall Islands',
'MQ' => 'Martinique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'YT' => 'Mayotte',
'MX' => 'Mexico',
'FM' => 'Micronesia',
'MD' => 'Moldavia',
'MC' => 'Monaco',
'MN' => 'Mongolia',
'MS' => 'Montserrat',
'MA' => 'Morocco',
'MZ' => 'Mozambique',
'MM' => 'Union Of Myanmar',
'NA' => 'Namibia',
'NR' => 'Nauru Island',
'NP' => 'Nepal',
'NL' => 'Netherlands',
'AN' => 'Netherlands Antilles',
'NC' => 'New Caledonia',
'NZ' => 'New Zealand',
'NI' => 'Nicaragua',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NU' => 'Niue',
'NF' => 'Norfolk Island',
'MP' => 'Mariana Islands, Northern',
'NO' => 'Norway',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PW' => 'Palau Islands',
'PS' => 'Palestine',
'PA' => 'Panama',
'PG' => 'Papua New Guinea',
'PY' => 'Paraguay',
'PE' => 'Peru',
'PH' => 'Philippines',
'PN' => 'Pitcairn',
'PL' => 'Poland',
'PT' => 'Portugal',
'PR' => 'Puerto Rico',
'QA' => 'Qatar',
'RE' => 'Reunion Island',
'RO' => 'Romania',
'RU' => 'Russian Federation',
'RW' => 'Rwanda',
'WS' => 'Samoa',
'SH' => 'St Helena',
'KN' => 'St Kitts & Nevis',
'LC' => 'St Lucia',
'PM' => 'St Pierre & Miquelon',
'VC' => 'St Vincent',
'SM' => 'San Marino',
'ST' => 'Sao Tome & Principe',
'SA' => 'Saudi Arabia',
'SN' => 'Senegal',
'SC' => 'Seychelles',
'SL' => 'Sierra Leone',
'SG' => 'Singapore',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SB' => 'Solomon Islands',
'SO' => 'Somalia',
'ZA' => 'South Africa',
'GS' => 'South Georgia and South Sandwich',
'ES' => 'Spain',
'LK' => 'Sri Lanka',
'XX' => 'Stateless Persons',
'SD' => 'Sudan',
'SR' => 'Suriname',
'SJ' => 'Svalbard and Jan Mayen',
'SZ' => 'Swaziland',
'SE' => 'Sweden',
'CH' => 'Switzerland',
'SY' => 'Syrian Arab Republic',
'TW' => 'Taiwan, Republic of China',
'TJ' => 'Tajikistan',
'TZ' => 'Tanzania',
'TH' => 'Thailand',
'TL' => 'Timor Leste',
'TG' => 'Togo',
'TK' => 'Tokelau',
'TO' => 'Tonga',
'TT' => 'Trinidad & Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TM' => 'Turkmenistan',
'TC' => 'Turks And Caicos Islands',
'TV' => 'Tuvalu',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'AE' => 'United Arab Emirates',
'GB' => 'United Kingdom',
'UM' => 'US Minor Outlying Islands',
'US' => 'USA',
'HV' => 'Upper Volta',
'UY' => 'Uruguay',
'UZ' => 'Uzbekistan',
'VU' => 'Vanuatu',
'VA' => 'Vatican City State',
'VE' => 'Venezuela',
'VN' => 'Vietnam',
'VG' => 'Virgin Islands (British)',
'VI' => 'Virgin Islands (US)',
'WF' => 'Wallis And Futuna Islands',
'EH' => 'Western Sahara',
'YE' => 'Yemen Arab Rep.',
'YD' => 'Yemen Democratic',
'YU' => 'Yugoslavia',
'ZR' => 'Zaire',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe'
];
}
}
\ No newline at end of file
......@@ -46,27 +46,23 @@ class Forms
/**
* Selektion eines Eintrages in einem Dropdown-Menü
*
* @param string $name
* Name des Feldes im Formular
* @param mixed $defValue
* Abzugleichender Parameter mit $currentValue
* @param mixed $currentValue
* Wert aus der SQL Tabelle
* @param string $attr
* HTML-Attribut, um Eintrag zu selektieren
* @param string $name
* @param mixed $value
* @param string|integer|array $currentValue
* @param string $attr
*
* @return string
*/
public function selectEntry($name, $defValue, $currentValue = '', $attr = 'selected')
public function selectEntry($name, $value, $currentValue = '', $attr = 'selected')
{
$attr = ' ' . $attr . '="' . $attr . '"';
$currentValue = $this->request->getPost()->get($name, $currentValue);
if (is_array($currentValue) === false && $currentValue == $defValue) {
if (is_array($currentValue) === false && $currentValue == $value) {
return $attr;
} elseif (is_array($currentValue) === true) {
foreach ($currentValue as $row) {
if ($row == $defValue) {
if ($row == $value) {
return $attr;
}
}
......@@ -77,11 +73,11 @@ class Forms
/**
*
* @param string $name
* @param array $values
* @param array $lang
* @param string|integer $currentValue
* @param string $selected
* @param string $name
* @param array $values
* @param array $lang
* @param string|integer|array $currentValue
* @param string $selected
*
* @return array
*/
......@@ -102,4 +98,17 @@ class Forms
}
return $select;
}
/**
* @param string $name
* @param array $values
* @param array $lang
* @param string|integer|array $currentValue
*
* @return array
*/
public function checkboxGenerator($name, array $values, array $lang, $currentValue = '')
{
return $this->selectGenerator($name, $values, $lang, $currentValue, 'checked');
}
}
......@@ -114,7 +114,7 @@ class Index extends Core\Modules\AdminController
if ($this->acl->hasPermission('admin/menus/items/create') === true && $this->menusHelpers) {
$lang_options = [$this->lang->t('articles', 'create_menu_item')];
$this->view->assign('options', $this->get('core.helpers.forms')->selectGenerator('create', [1], $lang_options, 0, 'checked'));
$this->view->assign('options', $this->get('core.helpers.forms')->checkboxGenerator('create', [1], $lang_options, 0));
$this->view->assign($this->menusHelpers->createMenuItemFormFields());
}
......@@ -223,7 +223,7 @@ class Index extends Core\Modules\AdminController
$menuItem = $this->menusModel->getOneMenuItemByUri(sprintf(Articles\Helpers::URL_KEY_PATTERN, $id));
$lang_options = [$this->lang->t('articles', 'create_menu_item')];
$this->view->assign('options', $this->get('core.helpers.forms')->selectGenerator('create', [1], $lang_options, !empty($menuItem) ? 1 : 0, 'checked'));
$this->view->assign('options', $this->get('core.helpers.forms')->checkboxGenerator('create', [1], $lang_options, !empty($menuItem) ? 1 : 0));
$this->view->assign(
$this->menusHelpers->createMenuItemFormFields(
......
......@@ -107,7 +107,7 @@ class Index extends Core\Modules\AdminController
// Emoticons erlauben
if ($this->modules->isActive('emoticons') === true) {
$lang_allowEmoticons = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('allow_emoticons', $this->get('core.helpers.forms')->selectGenerator('emoticons', [1, 0], $lang_allowEmoticons, $settings['emoticons'], 'checked'));
$this->view->assign('allow_emoticons', $this->get('core.helpers.forms')->checkboxGenerator('emoticons', [1, 0], $lang_allowEmoticons, $settings['emoticons']));
}
$this->formTokenHelper->generateFormToken();
......
......@@ -233,7 +233,7 @@ class Index extends Core\Modules\AdminController
if ($this->commentsHelpers) {
$lang_comments = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('comments', $this->get('core.helpers.forms')->selectGenerator('comments', [1, 0], $lang_comments, $settings['comments'], 'checked'));
$this->view->assign('comments', $this->get('core.helpers.forms')->checkboxGenerator('comments', [1, 0], $lang_comments, $settings['comments']));
}
$this->view->assign('dateformat', $this->get('core.helpers.date')->dateFormatDropdown($settings['dateformat']));
......
......@@ -192,11 +192,11 @@ class Index extends Core\Modules\AdminController
if ($this->modules->isActive('comments') === true) {
$lang_comments = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('comments', $this->get('core.helpers.forms')->selectGenerator('comments', [1, 0], $lang_comments, $settings['comments'], 'checked'));
$this->view->assign('comments', $this->get('core.helpers.forms')->checkboxGenerator('comments', [1, 0], $lang_comments, $settings['comments']));
}
$lang_overlay = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('overlay', $this->get('core.helpers.forms')->selectGenerator('overlay', [1, 0], $lang_overlay, $settings['overlay'], 'checked'));
$this->view->assign('overlay', $this->get('core.helpers.forms')->checkboxGenerator('overlay', [1, 0], $lang_overlay, $settings['overlay']));
$this->view->assign('dateformat', $this->get('core.helpers.date')->dateFormatDropdown($settings['dateformat']));
......
......@@ -111,7 +111,7 @@ class Index extends Core\Modules\AdminController
if ($settings['notify'] == 2) {
$langActivate = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('activate', $this->get('core.helpers.forms')->selectGenerator('active', [1, 0], $langActivate, $guestbook['active'], 'checked'));
$this->view->assign('activate', $this->get('core.helpers.forms')->checkboxGenerator('active', [1, 0], $langActivate, $guestbook['active']));
}
$this->view->assign('form', array_merge($guestbook, $this->request->getPost()->getAll()));
......@@ -171,18 +171,18 @@ class Index extends Core\Modules\AdminController
$this->view->assign('notify', $this->get('core.helpers.forms')->selectGenerator('notify', [0, 1, 2], $lang_notify, $settings['notify']));
$lang_overlay = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('overlay', $this->get('core.helpers.forms')->selectGenerator('overlay', [1, 0], $lang_overlay, $settings['overlay'], 'checked'));
$this->view->assign('overlay', $this->get('core.helpers.forms')->checkboxGenerator('overlay', [1, 0], $lang_overlay, $settings['overlay']));
// Emoticons erlauben
if ($this->modules->isActive('emoticons') === true) {
$lang_allow_emoticons = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('allow_emoticons', $this->get('core.helpers.forms')->selectGenerator('emoticons', [1, 0], $lang_allow_emoticons, $settings['emoticons'], 'checked'));
$this->view->assign('allow_emoticons', $this->get('core.helpers.forms')->checkboxGenerator('emoticons', [1, 0], $lang_allow_emoticons, $settings['emoticons']));
}
// In Newsletter integrieren
if ($this->modules->isActive('newsletter') === true) {
$lang_newsletter_integration = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('newsletter_integration', $this->get('core.helpers.forms')->selectGenerator('newsletter_integration', [1, 0], $lang_newsletter_integration, $settings['newsletter_integration'], 'checked'));
$this->view->assign('newsletter_integration', $this->get('core.helpers.forms')->checkboxGenerator('newsletter_integration', [1, 0], $lang_newsletter_integration, $settings['newsletter_integration']));
}
$this->view->assign('form', array_merge(['notify_email' => $settings['notify_email']], $this->request->getPost()->getAll()));
......
This diff is collapsed.
......@@ -248,19 +248,19 @@ class Index extends Core\Modules\AdminController
$this->view->assign('dateformat', $this->get('core.helpers.date')->dateFormatDropdown($settings['dateformat']));
$lang_readmore = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('readmore', $this->get('core.helpers.forms')->selectGenerator('readmore', [1, 0], $lang_readmore, $settings['readmore'], 'checked'));
$this->view->assign('readmore', $this->get('core.helpers.forms')->checkboxGenerator('readmore', [1, 0], $lang_readmore, $settings['readmore']));
$this->view->assign('readmore_chars', $this->request->getPost()->get('readmore_chars', $settings['readmore_chars']));
if ($this->modules->isActive('comments') === true) {
$lang_allow_comments = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('allow_comments', $this->get('core.helpers.forms')->selectGenerator('comments', [1, 0], $lang_allow_comments, $settings['comments'], 'checked'));
$this->view->assign('allow_comments', $this->get('core.helpers.forms')->checkboxGenerator('comments', [1, 0], $lang_allow_comments, $settings['comments']));
}
$this->view->assign('sidebar_entries', $this->get('core.helpers.forms')->recordsPerPage((int)$settings['sidebar'], 1, 10));
$lang_category_in_breadcrumb = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('category_in_breadcrumb', $this->get('core.helpers.forms')->selectGenerator('category_in_breadcrumb', [1, 0], $lang_category_in_breadcrumb, $settings['category_in_breadcrumb'], 'checked'));
$this->view->assign('category_in_breadcrumb', $this->get('core.helpers.forms')->checkboxGenerator('category_in_breadcrumb', [1, 0], $lang_category_in_breadcrumb, $settings['category_in_breadcrumb']));
$this->formTokenHelper->generateFormToken();
}
......
......@@ -70,10 +70,10 @@ class Index extends Core\Modules\AdminController
$this->view->assign('form', array_merge(['title' => '', 'text' => ''], $this->request->getPost()->getAll()));
$lang_test = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('test', $this->get('core.helpers.forms')->selectGenerator('test', [1, 0], $lang_test, 0, 'checked'));
$this->view->assign('test', $this->get('core.helpers.forms')->checkboxGenerator('test', [1, 0], $lang_test, 0));
$lang_action = [$this->lang->t('newsletter', 'send_and_save'), $this->lang->t('newsletter', 'only_save')];
$this->view->assign('action', $this->get('core.helpers.forms')->selectGenerator('action', [1, 0], $lang_action, 1, 'checked'));
$this->view->assign('action', $this->get('core.helpers.forms')->checkboxGenerator('action', [1, 0], $lang_action, 1));
$this->formTokenHelper->generateFormToken();
}
......@@ -121,10 +121,10 @@ class Index extends Core\Modules\AdminController
$this->view->assign('form', array_merge($newsletter, $this->request->getPost()->getAll()));
$lang_test = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('test', $this->get('core.helpers.forms')->selectGenerator('test', [1, 0], $lang_test, 0, 'checked'));
$this->view->assign('test', $this->get('core.helpers.forms')->checkboxGenerator('test', [1, 0], $lang_test, 0));
$lang_action = [$this->lang->t('newsletter', 'send_and_save'), $this->lang->t('newsletter', 'only_save')];
$this->view->assign('action', $this->get('core.helpers.forms')->selectGenerator('action', [1, 0], $lang_action, 1, 'checked'));
$this->view->assign('action', $this->get('core.helpers.forms')->checkboxGenerator('action', [1, 0], $lang_action, 1));
$this->formTokenHelper->generateFormToken();
} else {
......@@ -192,7 +192,7 @@ class Index extends Core\Modules\AdminController
$this->lang->t('system', 'yes'),
$this->lang->t('system', 'no')
];
$this->view->assign('html', $this->get('core.helpers.forms')->selectGenerator('html', [1, 0], $langHtml, $settings['html'], 'checked'));
$this->view->assign('html', $this->get('core.helpers.forms')->checkboxGenerator('html', [1, 0], $langHtml, $settings['html']));
$this->formTokenHelper->generateFormToken();
}
......
......@@ -104,7 +104,7 @@ class Index extends Core\Modules\FrontendController
$this->lang->t('newsletter', 'subscribe'),
$this->lang->t('newsletter', 'unsubscribe')
];
$this->view->assign('actions', $this->get('core.helpers.forms')->selectGenerator('action', ['subscribe', 'unsubscribe'], $actions_Lang, $fieldValue, 'checked'));
$this->view->assign('actions', $this->get('core.helpers.forms')->checkboxGenerator('action', ['subscribe', 'unsubscribe'], $actions_Lang, $fieldValue));
if ($this->acl->hasPermission('frontend/captcha/index/image') === true) {
$this->view->assign('captcha', $this->captchaHelpers->captcha());
......
......@@ -65,11 +65,11 @@ class Index extends Core\Modules\FrontendController
$this->lang->t('search', 'title_only'),
$this->lang->t('search', 'content_only')
];
$this->view->assign('search_areas', $this->get('core.helpers.forms')->selectGenerator('area', ['title_content', 'title', 'content'], $langSearchAreas, 'title_content', 'checked'));
$this->view->assign('search_areas', $this->get('core.helpers.forms')->checkboxGenerator('area', ['title_content', 'title', 'content'], $langSearchAreas, 'title_content'));
// Treffer sortieren
$langSortHits = [$this->lang->t('search', 'asc'), $this->lang->t('search', 'desc')];
$this->view->assign('sort_hits', $this->get('core.helpers.forms')->selectGenerator('sort', ['asc', 'desc'], $langSortHits, 'asc', 'checked'));
$this->view->assign('sort_hits', $this->get('core.helpers.forms')->checkboxGenerator('sort', ['asc', 'desc'], $langSortHits, 'asc'));
}
/**
......
......@@ -200,7 +200,7 @@ class Index extends Core\Modules\AdminController
// Sef-URIs
$lang_modRewrite = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('mod_rewrite', $this->get('core.helpers.forms')->selectGenerator('mod_rewrite', [1, 0], $lang_modRewrite, $seoSettings['mod_rewrite'], 'checked'));
$this->view->assign('mod_rewrite', $this->get('core.helpers.forms')->checkboxGenerator('mod_rewrite', [1, 0], $lang_modRewrite, $seoSettings['mod_rewrite']));
$this->view->assign('form', array_merge($seoSettings, $this->request->getPost()->getAll()));
......
......@@ -85,11 +85,11 @@ class Index extends Core\Modules\AdminController
// Wartungsmodus an/aus
$lang_maintenance = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('maintenance', $this->get('core.helpers.forms')->selectGenerator('maintenance_mode', [1, 0], $lang_maintenance, $systemSettings['maintenance_mode'], 'checked'));
$this->view->assign('maintenance', $this->get('core.helpers.forms')->checkboxGenerator('maintenance_mode', [1, 0], $lang_maintenance, $systemSettings['maintenance_mode']));
// Caching von Bildern
$lang_cacheImages = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('cache_images', $this->get('core.helpers.forms')->selectGenerator('cache_images', [1, 0], $lang_cacheImages, $systemSettings['cache_images'], 'checked'));
$this->view->assign('cache_images', $this->get('core.helpers.forms')->checkboxGenerator('cache_images', [1, 0], $lang_cacheImages, $systemSettings['cache_images']));
// Mailertyp
$lang_mailerType = [$this->lang->t('system', 'mailer_type_php_mail'), $this->lang->t('system', 'mailer_type_smtp')];
......@@ -97,7 +97,7 @@ class Index extends Core\Modules\AdminController
// Mailer SMTP Authentifizierung
$lang_mailerSmtpAuth = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('mailer_smtp_auth', $this->get('core.helpers.forms')->selectGenerator('mailer_smtp_auth', [1, 0], $lang_mailerSmtpAuth, $systemSettings['mailer_smtp_auth'], 'checked'));
$this->view->assign('mailer_smtp_auth', $this->get('core.helpers.forms')->checkboxGenerator('mailer_smtp_auth', [1, 0], $lang_mailerSmtpAuth, $systemSettings['mailer_smtp_auth']));
// Mailer SMTP Verschlüsselung
$lang_mailerSmtpSecurity = [
......
......@@ -117,7 +117,7 @@ class Maintenance extends Core\Modules\AdminController
// Ausgabe
$lang_output = [$this->lang->t('system', 'output_as_file'), $this->lang->t('system', 'output_as_text')];
$this->view->assign('output', $this->get('core.helpers.forms')->selectGenerator('output', ['file', 'text'], $lang_output, 'file', 'checked'));
$this->view->assign('output', $this->get('core.helpers.forms')->checkboxGenerator('output', ['file', 'text'], $lang_output, 'file'));
// Exportart
$lang_exportType = [
......@@ -125,7 +125,7 @@ class Maintenance extends Core\Modules\AdminController
$this->lang->t('system', 'export_structure'),
$this->lang->t('system', 'export_data')
];
$this->view->assign('export_type', $this->get('core.helpers.forms')->selectGenerator('export_type', ['complete', 'structure', 'data'], $lang_exportType, 'complete', 'checked'));
$this->view->assign('export_type', $this->get('core.helpers.forms')->checkboxGenerator('export_type', ['complete', 'structure', 'data'], $lang_exportType, 'complete'));
$drop = [];
$drop['checked'] = $this->get('core.helpers.forms')->selectEntry('drop', '1', '', 'checked');
......
......@@ -3,7 +3,7 @@
namespace ACP3\Modules\ACP3\Users\Controller;
use ACP3\Core;
use ACP3\Core\Modules\FrontendController;
use ACP3\Core\Helpers\Country;
use ACP3\Modules\ACP3\Users;
/**
......@@ -84,39 +84,23 @@ class Account extends Core\Modules\FrontendController
$this->view->assign('gender', $this->get('core.helpers.forms')->selectGenerator('gender', [1, 2, 3], $lang_gender, $user['gender']));
// Geburtstag
$datepickerParams = ['constrainInput' => 'true', 'changeMonth' => 'true', 'changeYear' => 'true', 'yearRange' => '\'-50:+0\''];
$datepickerParams = [
'constrainInput' => 'true',
'changeMonth' => 'true',
'changeYear' => 'true',
'yearRange' => "'-50:+0'"
];
$this->view->assign('birthday_datepicker', $this->get('core.helpers.date')->datepicker('birthday', $user['birthday'], 'Y-m-d', $datepickerParams, false, true));
// Kontaktangaben
$contact = [];
$contact[0]['name'] = 'mail';
$contact[0]['lang'] = $this->lang->t('system', 'email_address');
$contact[0]['value'] = $this->request->getPost()->get('mail', $user['mail']);
$contact[0]['maxlength'] = '120';
$contact[1]['name'] = 'website';
$contact[1]['lang'] = $this->lang->t('system', 'website');
$contact[1]['value'] = $this->request->getPost()->get('website', $user['website']);
$contact[1]['maxlength'] = '120';
$contact[2]['name'] = 'icq';
$contact[2]['lang'] = $this->lang->t('users', 'icq');
$contact[2]['value'] = $this->request->getPost()->get('icq', $user['icq']);
$contact[2]['maxlength'] = '9';
$contact[3]['name'] = 'skype';
$contact[3]['lang'] = $this->lang->t('users', 'skype');
$contact[3]['value'] = $this->request->getPost()->get('skype', $user['skype']);
$contact[3]['maxlength'] = '28';
$this->view->assign('contact', $contact);
$countries = Core\Lang::worldCountries();
$countries_select = [];
foreach ($countries as $key => $value) {
$countries_select[] = [
'value' => $key,
'lang' => $value,
'selected' => $this->get('core.helpers.forms')->selectEntry('countries', $key, $user['country']),
];
}
$this->view->assign('countries', $countries_select);
$this->view->assign('contact', $this->get('users.helpers.forms')->fetchContactDetails(
$user['mail'],
$user['website'],
$user['icq'],
$user['skype']
));
$this->view->assign('countries', $this->get('users.helpers.forms')->generateWorldCountriesSelect($user['country']));
$this->view->assign('form', array_merge($user, $this->request->getPost()->getAll()));
......@@ -146,20 +130,20 @@ class Account extends Core\Modules\FrontendController
$this->view->assign('time_zones', $this->get('core.helpers.date')->getTimeZones($user['time_zone']));
$lang_mailDisplay = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('mail_display', $this->get('core.helpers.forms')->selectGenerator('mail_display', [1, 0], $lang_mailDisplay, $user['mail_display'], 'checked'));
$this->view->assign('mail_display', $this->get('core.helpers.forms')->checkboxGenerator('mail_display', [1, 0], $lang_mailDisplay, $user['mail_display']));
$lang_addressDisplay = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];
$this->view->assign('address_display', $this->get('core.helpers.forms')->selectGenerator('address_display', [1, 0], $lang_addressDisplay, $user['address_display'], 'checked'));
$this->view->assign('address_display', $this->get('core.helpers.forms')->checkboxGenerator('address_display', [1, 0], $lang_addressDisplay, $user['address_display']));
$lang_countryDisplay = [$this->lang->t('system', 'yes'), $this->lang->t('system', 'no')];