mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/11582] Add methods to return the language string
PHPBB3-11582
This commit is contained in:
parent
7f9a1c8116
commit
ce0a182c7f
4 changed files with 35 additions and 10 deletions
|
@ -459,7 +459,6 @@ class acp_permission_roles
|
||||||
global $template, $user, $phpbb_container;
|
global $template, $user, $phpbb_container;
|
||||||
|
|
||||||
$permissions = $phpbb_container->get('acl.permissions');
|
$permissions = $phpbb_container->get('acl.permissions');
|
||||||
$permission_categories = $permissions->get_categories();
|
|
||||||
|
|
||||||
$content_array = $categories = array();
|
$content_array = $categories = array();
|
||||||
$key_sort_array = array(0);
|
$key_sort_array = array(0);
|
||||||
|
@ -476,7 +475,7 @@ class acp_permission_roles
|
||||||
foreach ($content_array as $cat => $cat_array)
|
foreach ($content_array as $cat => $cat_array)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('auth', array(
|
$template->assign_block_vars('auth', array(
|
||||||
'CAT_NAME' => $user->lang($permission_categories[$cat]),
|
'CAT_NAME' => $permissions->get_lang_category($cat),
|
||||||
|
|
||||||
'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
|
'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false,
|
||||||
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
|
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
|
||||||
|
|
|
@ -587,10 +587,9 @@ class acp_permissions
|
||||||
*/
|
*/
|
||||||
function build_permission_dropdown($options, $default_option, $permission_scope)
|
function build_permission_dropdown($options, $default_option, $permission_scope)
|
||||||
{
|
{
|
||||||
global $user, $auth, $phpbb_container;
|
global $auth, $phpbb_container;
|
||||||
|
|
||||||
$permissions = $phpbb_container->get('acl.permissions');
|
$permissions = $phpbb_container->get('acl.permissions');
|
||||||
$permission_types = $permissions->get_types();
|
|
||||||
|
|
||||||
$s_dropdown_options = '';
|
$s_dropdown_options = '';
|
||||||
foreach ($options as $setting)
|
foreach ($options as $setting)
|
||||||
|
@ -601,8 +600,8 @@ class acp_permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
$selected = ($setting == $default_option) ? ' selected="selected"' : '';
|
$selected = ($setting == $default_option) ? ' selected="selected"' : '';
|
||||||
$l_setting = (isset($permission_types[$permission_scope][$setting])) ? $permission_types[$permission_scope][$setting] : $permission_types[$setting];
|
$l_setting = $permissions->get_lang_type($setting, $permission_scope);
|
||||||
$s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $user->lang($l_setting) . '</option>';
|
$s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $s_dropdown_options;
|
return $s_dropdown_options;
|
||||||
|
|
|
@ -1103,7 +1103,6 @@ class auth_admin extends phpbb_auth
|
||||||
global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container;
|
global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container;
|
||||||
|
|
||||||
$permissions = $phpbb_container->get('acl.permissions');
|
$permissions = $phpbb_container->get('acl.permissions');
|
||||||
$permission_categories = $permissions->get_categories();
|
|
||||||
|
|
||||||
@reset($category_array);
|
@reset($category_array);
|
||||||
while (list($cat, $cat_array) = each($category_array))
|
while (list($cat, $cat_array) = each($category_array))
|
||||||
|
@ -1113,7 +1112,7 @@ class auth_admin extends phpbb_auth
|
||||||
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
|
'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
|
||||||
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
|
'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
|
||||||
|
|
||||||
'CAT_NAME' => $user->lang($permission_categories[$cat]),
|
'CAT_NAME' => $permissions->get_lang_category($cat),
|
||||||
));
|
));
|
||||||
|
|
||||||
/* Sort permissions by name (more naturaly and user friendly than sorting by a primary key)
|
/* Sort permissions by name (more naturaly and user friendly than sorting by a primary key)
|
||||||
|
@ -1182,7 +1181,6 @@ class auth_admin extends phpbb_auth
|
||||||
global $user, $phpbb_container;
|
global $user, $phpbb_container;
|
||||||
|
|
||||||
$permissions = $phpbb_container->get('acl.permissions');
|
$permissions = $phpbb_container->get('acl.permissions');
|
||||||
$permission_categories = $permissions->get_categories();
|
|
||||||
|
|
||||||
foreach ($key_sort_array as $forum_id)
|
foreach ($key_sort_array as $forum_id)
|
||||||
{
|
{
|
||||||
|
@ -1210,7 +1208,7 @@ class auth_admin extends phpbb_auth
|
||||||
// Build our categories array
|
// Build our categories array
|
||||||
if (!isset($categories[$cat]))
|
if (!isset($categories[$cat]))
|
||||||
{
|
{
|
||||||
$categories[$cat] = $user->lang($permission_categories[$cat]);
|
$categories[$cat] = $permissions->get_lang_category($cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build our content array
|
// Build our content array
|
||||||
|
|
|
@ -83,6 +83,16 @@ class phpbb_permissions
|
||||||
return $this->categories;
|
return $this->categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the language string of a permission category
|
||||||
|
*
|
||||||
|
* @return array Language string
|
||||||
|
*/
|
||||||
|
public function get_lang_category($category)
|
||||||
|
{
|
||||||
|
return $this->user->lang($this->categories[$category]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array with all the permission types (a_, u_, m_, etc.)
|
* Returns an array with all the permission types (a_, u_, m_, etc.)
|
||||||
*
|
*
|
||||||
|
@ -93,6 +103,25 @@ class phpbb_permissions
|
||||||
return $this->types;
|
return $this->types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the language string of a permission type
|
||||||
|
*
|
||||||
|
* @return array Language string
|
||||||
|
*/
|
||||||
|
public function get_lang_type($type, $scope = false)
|
||||||
|
{
|
||||||
|
if ($scope && isset($this->types[$scope][$type]))
|
||||||
|
{
|
||||||
|
$lang_key = $this->types[$scope][$type];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lang_key = $this->types[$type];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->user->lang($lang_key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array with all the permissions.
|
* Returns an array with all the permissions.
|
||||||
* Each Permission has the following layout:
|
* Each Permission has the following layout:
|
||||||
|
|
Loading…
Add table
Reference in a new issue