1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/17100] Move html of build_select to templates

PHPBB3-17100
This commit is contained in:
Marc Alexander
2022-04-18 22:33:30 +02:00
parent d91f11d55f
commit b09af35c90
4 changed files with 16 additions and 18 deletions

View File

@@ -306,7 +306,10 @@ class acp_inactive
$template->assign_vars(array(
'S_INACTIVE_USERS' => true,
'S_INACTIVE_OPTIONS' => build_select($option_ary),
'INACTIVE_OPTIONS' => [
'name' => 'action',
'options' => build_select($option_ary),
],
'S_LIMIT_DAYS' => $s_limit_days,
'S_SORT_KEY' => $s_sort_key,

View File

@@ -626,16 +626,7 @@ class acp_main
));
}
$option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
if ($config['email_enable'])
{
$option_ary += array('remind' => 'REMIND');
}
$template->assign_vars(array(
'S_INACTIVE_USERS' => true,
'S_INACTIVE_OPTIONS' => build_select($option_ary))
);
$template->assign_var('S_INACTIVE_USERS', true);
}
// Warn if install is still present

View File

@@ -209,18 +209,21 @@ function adm_back_link($u_action)
/**
* Build select field options in acp pages
*/
function build_select($option_ary, $option_default = false)
function build_select($option_ary, $option_default = false): array
{
global $user;
global $language;
$html = '';
$options = [];
foreach ($option_ary as $value => $title)
{
$selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : '';
$html .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$title] . '</option>';
$options[] = [
'value' => $value,
'selected' => $option_default !== false && $value == $option_default,
'label' => $language->lang($title),
];
}
return $html;
return $options;
}
/**