diff options
author | plegall <plg@piwigo.org> | 2010-03-31 13:10:09 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-03-31 13:10:09 +0000 |
commit | 8a7a223af0823e9974092e95f6e0eb6fed67096e (patch) | |
tree | 10fdb9c5473bc5268930e160e7d964afd0d7573d /admin/languages_installed.php | |
parent | 30500c8d56fa570d01d79bddafc5b44cb1a58fad (diff) |
feature 1535: apply the plugin/theme managers look&feel to language manager.
git-svn-id: http://piwigo.org/svn/trunk@5496 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/languages_installed.php')
-rw-r--r-- | admin/languages_installed.php | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/admin/languages_installed.php b/admin/languages_installed.php index abe088467..74023a34b 100644 --- a/admin/languages_installed.php +++ b/admin/languages_installed.php @@ -52,17 +52,56 @@ if (isset($_GET['action']) and isset($_GET['language']) and !is_adviser()) // +-----------------------------------------------------------------------+ $default_language = get_default_language(); +$tpl_languages = array(); + foreach($languages->fs_languages as $language_id => $language_name) { - $template->append('languages', array( - 'ID' => $language_id, - 'NAME' => $language_name, - 'U_ACTION' => $base_url.'&language='.$language_id, - 'STATE' => isset($languages->db_languages[$language_id]) ? 'active' : '', - 'IS_DEFAULT' => $language_id == $default_language, + $language = array( + 'id' => $language_id, + 'name' => $language_name, + 'u_action' => $base_url.'&language='.$language_id, + ); + + if (in_array($language_id, array_keys($languages->db_languages))) + { + $language['state'] = 'active'; + $language['deactivable'] = true; + + if (count($languages->db_languages) <= 1) + { + $language['deactivable'] = false; + $language['deactivate_tooltip'] = l10n('Impossible to deactivate this language, you need at least one language.'); + } + + if ($language_id == $default_language) + { + $language['deactivable'] = false; + $language['deactivate_tooltip'] = l10n('Impossible to deactivate this language, first set another language as default.'); + } + } + else + { + $language['state'] = 'inactive'; + } + + if ($language_id == $default_language) + { + $language['is_default'] = true; + array_unshift($tpl_languages, $language); + } + else + { + array_push($tpl_languages, $language); + } +} + +$template->assign( + array( + 'languages' => $tpl_languages, ) ); -} +$template->append('language_states', 'active'); +$template->append('language_states', 'inactive'); $missing_language_ids = array_diff( |