Qual: Uniformize menu code

This commit is contained in:
Laurent Destailleur
2013-03-02 14:43:36 +01:00
parent eff675793d
commit f172c900c7
6 changed files with 206 additions and 191 deletions

View File

@@ -491,7 +491,7 @@ function dol_strtoupper($utf8_string)
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return void
*/
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='')
@@ -706,7 +706,7 @@ function dol_format_address($object)
$ret.="\n".$object->state;
}
}
else // Other: title firstname name \n address lines \n zip town \n country
{
$ret .= ($ret ? "\n" : '' ).$object->zip;
@@ -1646,32 +1646,33 @@ function img_picto($alt, $picto, $options = '', $pictoisfullpath = false)
global $conf;
// Define fullpathpicto to use into src
if ($pictoisfullpath) {
if ($pictoisfullpath)
{
// Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto))
$picto .= '.png';
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
$fullpathpicto = $picto;
}
else
{
// By default, we search into theme directory
// By default, we search $url/theme/$theme/img/$picto
$url = DOL_URL_ROOT;
$path = 'theme/'.$conf->theme;
if (! empty($conf->global->MAIN_FORCETHEMEDIR))
$path = preg_replace('/^\//', '', $conf->global->MAIN_FORCETHEMEDIR).'/'.$path;
// If we ask an image into module/img (not into a theme path)
$theme = $conf->theme;
$path = 'theme/'.$theme;
if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES;
if (! empty($conf->global->MAIN_FORCETHEMEDIR)) $path = preg_replace('/^\//', '', $conf->global->MAIN_FORCETHEMEDIR).'/'.$path; // TODO What if there is both FORCETHEMDIR and OVERWRITE_THEM_RES
// If we ask an image into $url/$mymodule/img (instead of default path)
if (preg_match('/^([^@]+)@([^@]+)$/i',$picto,$regs))
{
$picto = $regs[1];
$path = $regs[2];
$path = $regs[2]; // $path is $mymodule
}
// Clean parameters
if (! preg_match('/(\.png|\.gif)$/i',$picto))
$picto .= '.png';
// If img file not into standard path, we use alternate path
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto))
$url = DOL_URL_ROOT_ALT;
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto .= '.png';
// If img file is not into standard path, we use alternate path (Avoid using DOL_URL_ROOT_ALT for performane)
if (defined('DOL_URL_ROOT_ALT') && DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT;
// $url is '' or '/custom', $path is current theme or
$fullpathpicto = $url.'/'.$path.'/img/'.$picto;
}