From cdf33682951461bfd556911cf2d622a300e88d60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Sep 2010 20:42:17 +0000 Subject: [PATCH] Qual: Uniformize code --- htdocs/admin/dict.php | 2 +- htdocs/admin/ihm.php | 2 +- htdocs/admin/numberwords.php | 2 +- htdocs/core/class/html.formadmin.class.php | 31 +++++++++++----------- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/install/index.php | 2 +- htdocs/product/traduction.php | 2 +- htdocs/societe/soc.php | 4 +-- htdocs/user/param_ihm.php | 2 +- 9 files changed, 25 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 4fc2c964cbe..ac1b8ae9a58 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -849,7 +849,7 @@ function fieldList($fieldlist,$obj='') } elseif ($fieldlist[$field] == 'lang') { print ''; - $formadmin->select_lang($conf->global->MAIN_LANG_DEFAULT,'lang'); + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang'); print ''; } // Le type de l'element (pour les type de contact).' diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 4c8a745e0ed..2dcb127ebaf 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -124,7 +124,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit') // Edit // Default language $var=!$var; print ''.$langs->trans("DefaultLanguage").''; - $formadmin->select_lang($conf->global->MAIN_LANG_DEFAULT,'main_lang_default',1); + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'main_lang_default',1); print ''; print ' '; print ''; diff --git a/htdocs/admin/numberwords.php b/htdocs/admin/numberwords.php index d6a131979c8..09c43cdb7e7 100644 --- a/htdocs/admin/numberwords.php +++ b/htdocs/admin/numberwords.php @@ -167,7 +167,7 @@ print ''; print ''; print ''; print ''; -$htmlother->select_lang($_POST["lang_id"]?$_POST["lang_id"]:$langs->defaultlang,'lang_id'); +print $htmlother->select_language($_POST["lang_id"]?$_POST["lang_id"]:$langs->defaultlang,'lang_id'); print ''; print ''; print ''.$newvaltest.''; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 0bb21f1c57c..60544b727db 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -44,14 +44,15 @@ class FormAdmin return 1; } - + /** - * \brief Retourne la liste deroulante des langues disponibles - * \param selected Langue pre-selectionnee - * \param htmlname Nom de la zone select - * \param showauto Affiche choix auto - * \param filter Array of keys to exclude in list - * \param showempty Add empty value + * Output list with available languages. + * @deprecated Use select_language instead + * @param selected Langue pre-selectionnee + * @param htmlname Nom de la zone select + * @param showauto Affiche choix auto + * @param filter Array of keys to exclude in list + * @param showempty Add empty value */ function select_lang($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0) { @@ -59,19 +60,19 @@ class FormAdmin } /** - * \brief Retourne la liste deroulante des langues disponibles - * \param selected Langue pre-selectionnee - * \param htmlname Nom de la zone select - * \param showauto Affiche choix auto - * \param filter Array of keys to exclude in list - * \param showempty Add empty value + * Return html select list with available languages + * @param selected Langue pre-selectionnee + * @param htmlname Nom de la zone select + * @param showauto Affiche choix auto + * @param filter Array of keys to exclude in list + * @param showempty Add empty value */ function select_language($selected='',$htmlname='lang_id',$showauto=0,$filter=0,$showempty=0) { global $langs; $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); - + $out=''; $out.= ''; - + return $out; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f45460edd4d..93920175d4d 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -348,7 +348,7 @@ class FormFile include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'); $formadmin=new FormAdmin($this->db); $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); - $formadmin->select_lang($defaultlang); + print $formadmin->select_language($defaultlang); } else { diff --git a/htdocs/install/index.php b/htdocs/install/index.php index 4644504aa1c..79f8a516259 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -60,7 +60,7 @@ print ''; print '

'; print ''; print ''; print '
'.$langs->trans("DefaultLanguage").' : '; -$formadmin->select_lang('auto','selectlang',1); +print $formadmin->select_language('auto','selectlang',1); print '
'; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index a505c671aaa..c5c004a86b9 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -242,7 +242,7 @@ if ($_GET["action"] == 'add' && ($user->rights->produit->creer || $user->rights- print ''; print ''; print ''; print ''; print ''; } @@ -1318,7 +1318,7 @@ else if ($conf->global->MAIN_MULTILANGS) { print ''; print ''; } diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 946c50efa05..4252724404e 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -175,7 +175,7 @@ if ($_GET["action"] == 'edit') print ! empty($dolibarr_main_demo)?' disabled="true"':''; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; print ''; // Taille max des listes
'.$langs->trans('Translation').''; - $formadmin->select_lang('','lang',0,$product->multilangs); + print $formadmin->select_language('','lang',0,$product->multilangs); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index a4ebe3d2ab5..89296897417 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -864,7 +864,7 @@ else if ($conf->global->MAIN_MULTILANGS) { print '
'.$langs->trans("DefaultLang").''."\n"; - $formadmin->select_lang(($soc->default_lang?$soc->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); + print $formadmin->select_language(($soc->default_lang?$soc->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1); print '
'.$langs->trans("DefaultLang").''."\n"; - $formadmin->select_lang($soc->default_lang,'default_lang',0,0,1); + print $formadmin->select_language($soc->default_lang,'default_lang',0,0,1); print '
'; - $formadmin->select_lang($fuser->conf->MAIN_LANG_DEFAULT,'main_lang_default',1); + print $formadmin->select_language($fuser->conf->MAIN_LANG_DEFAULT,'main_lang_default',1); print '