diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1dc2a00d264..98fcf9a65ec 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -191,9 +191,12 @@ while (($file = readdir($handle))!==false) { $j = 1000 + $i; } - $modules[$i] = $modName; - $numero[$i] = $j; - $orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module + + $modules[$i] = $objMod; + + $nom[$i] = $modName; + $numero[$i] = $j; + $orders[$i] = "$objMod->family"."_".$j; // Tri par famille puis numero module $j++; $i++; } @@ -211,21 +214,23 @@ $familylib=array( 'other'=>$langs->trans("ModuleFamilyOther"), 'technic'=>$langs->trans("ModuleFamilyTechnic"), 'financial'=>$langs->trans("ModuleFamilyFinancial"), -'experimental'=>$langs->trans("ModuleFamilyExperimental") ); foreach ($orders as $key => $value) { $tab=split('_',$value); $family=$tab[0]; $numero=$tab[1]; - $modName = $modules[$key]; - if ($modName) - { - $objMod = new $modName($db); - } + $modName = $nom[$key]; + $objMod = $modules[$key]; + // On affiche pas module si en version 'development' et que + // constante MAIN_SHOW_DEVELOPMENT_MODULES non définie + if ($objMod->version == 'development' && ! $conf->global->MAIN_SHOW_DEVELOPMENT_MODULES) + { + continue; + } + $const_name = $objMod->const_name; - $const_value = $objMod->const_config; if ($oldfamily && $family!=$oldfamily && $atleastoneforfamily) { print "\n \n\n"; @@ -233,22 +238,22 @@ foreach ($orders as $key => $value) } if((!$objMod->special && !$_GET["spe"] ) or ($objMod->special && $_GET["spe"])) - { + { $atleastoneforfamily=1; $var=!$var; - + print "\n"; - + print " "; if ($family!=$oldfamily) - { - print "
".$familylib[$family]."
"; - $oldfamily=$family; - } + { + print "
".$familylib[$family]."
"; + $oldfamily=$family; + } else - { - print ' '; - } + { + print ' '; + } print "\n"; print ' '; print $objMod->picto?img_object('',$objMod->picto):img_object('','generic'); @@ -261,24 +266,23 @@ foreach ($orders as $key => $value) print $objMod->getDbVersion(); print "\n "; - if ($const_value == 1) - { - print img_tick(); - } + if ($conf->global->$const_name == 1) + { + print img_tick(); + } else - { + { print " "; - } - - print "\n "; - + } - if ($const_value == 1) - { + print "\n "; + + if ($conf->global->$const_name == 1) + { // Module actif print "numero."&action=reset&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "\n"; - - + + if ($objMod->config_page_url) { if (is_array($objMod->config_page_url)) { @@ -308,17 +312,17 @@ foreach ($orders as $key => $value) { print "  "; } - + } else - { + { // Module non actif print "numero."&action=set&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "\n  \n"; - } - + } + print "\n"; } - + } print "\n";