/**
 * 	Show list of themes. Show all thumbs of themes
 *
 * 	@param	User|null	$fuser				User concerned or null for global theme
 * 	@param	int			$edit				1 to add edit form
 * 	@param	boolean		$foruserprofile		Show for user profile view
 * 	@return	void
 */
function show_theme($fuser, $edit = 0, $foruserprofile = false)
{
    global $conf, $langs, $db;
    global $bc;
    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
    $formother = new FormOther($db);
    //$dirthemes=array(empty($conf->global->MAIN_FORCETHEMEDIR)?'/theme':$conf->global->MAIN_FORCETHEMEDIR.'/theme');
    $dirthemes = array('/theme');
    if (!empty($conf->modules_parts['theme'])) {
        foreach ($conf->modules_parts['theme'] as $reldir) {
            $dirthemes = array_merge($dirthemes, (array) ($reldir . 'theme'));
        }
    }
    $dirthemes = array_unique($dirthemes);
    // Now dir_themes=array('/themes') or dir_themes=array('/theme','/mymodule/theme')
    $selected_theme = '';
    if (empty($foruserprofile)) {
        $selected_theme = $conf->global->MAIN_THEME;
    } else {
        $selected_theme = is_object($fuser) && !empty($fuser->conf->MAIN_THEME) ? $fuser->conf->MAIN_THEME : '';
    }
    $hoverdisabled = '';
    if (empty($foruserprofile)) {
        $hoverdisabled = isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0';
    } else {
        $hoverdisabled = is_object($fuser) ? empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0' : '';
    }
    $colspan = 2;
    if ($foruserprofile) {
        $colspan = 4;
    }
    $thumbsbyrow = 6;
    print '<table class="noborder" width="100%">';
    $var = false;
    // Title
    if ($foruserprofile) {
        print '<tr class="liste_titre"><th width="25%">' . $langs->trans("Parameter") . '</th><th width="25%">' . $langs->trans("DefaultValue") . '</th>';
        print '<th colspan="2">&nbsp;</th>';
        print '</tr>';
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("DefaultSkin") . '</td>';
        print '<td>' . $conf->global->MAIN_THEME . '</td>';
        print '<td align="left" class="nowrap" width="20%"><input ' . $bc[$var] . ' id="check_MAIN_THEME" name="check_MAIN_THEME"' . ($edit ? '' : ' disabled') . ' type="checkbox" ' . ($selected_theme ? " checked" : "") . '> ' . $langs->trans("UsePersonalValue") . '</td>';
        print '<td>&nbsp;</td>';
        print '</tr>';
    } else {
        print '<tr class="liste_titre"><th width="35%">' . $langs->trans("DefaultSkin") . '</th>';
        print '<th align="right">';
        $url = 'https://www.dolistore.com/lang-en/4-skins';
        if (preg_match('/fr/i', $langs->defaultlang)) {
            $url = 'https://www.dolistore.com/fr/4-themes';
        }
        //if (preg_match('/es/i',$langs->defaultlang)) $url='http://www.dolistore.com/lang-es/4-themes';
        print '<a href="' . $url . '" target="_blank">';
        print $langs->trans('DownloadMoreSkins');
        print '</a>';
        print '</th></tr>';
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("ThemeDir") . '</td>';
        print '<td>';
        foreach ($dirthemes as $dirtheme) {
            echo '"' . $dirtheme . '" ';
        }
        print '</td>';
        print '</tr>';
    }
    //$var=!$var;
    print '<tr ' . $bc[$var] . '><td colspan="' . $colspan . '">';
    print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
    $i = 0;
    foreach ($dirthemes as $dir) {
        //print $dirroot.$dir;exit;
        $dirtheme = dol_buildpath($dir, 0);
        // This include loop on $conf->file->dol_document_root
        $urltheme = dol_buildpath($dir, 1);
        if (is_dir($dirtheme)) {
            $handle = opendir($dirtheme);
            if (is_resource($handle)) {
                while (($subdir = readdir($handle)) !== false) {
                    if (is_dir($dirtheme . "/" . $subdir) && substr($subdir, 0, 1) != '.' && substr($subdir, 0, 3) != 'CVS' && !preg_match('/common|phones/i', $subdir)) {
                        // Disable not stable themes (dir ends with _exp or _dev)
                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
                            continue;
                        }
                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) {
                            continue;
                        }
                        print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
                        $file = $dirtheme . "/" . $subdir . "/thumb.png";
                        $url = $urltheme . "/" . $subdir . "/thumb.png";
                        if (!file_exists($file)) {
                            $url = DOL_URL_ROOT . '/public/theme/common/nophoto.png';
                        }
                        print '<a href="' . $_SERVER["PHP_SELF"] . ($edit ? '?action=edit&theme=' : '?theme=') . $subdir . (GETPOST("optioncss") ? '&optioncss=' . GETPOST("optioncss", 'alpha', 1) : '') . ($fuser ? '&id=' . $fuser->id : '') . '" style="font-weight: normal;" alt="' . $langs->trans("Preview") . '">';
                        if ($subdir == $conf->global->MAIN_THEME) {
                            $title = $langs->trans("ThemeCurrentlyActive");
                        } else {
                            $title = $langs->trans("ShowPreview");
                        }
                        print '<img src="' . $url . '" border="0" width="80" height="60" alt="' . $title . '" title="' . $title . '" style="margin-bottom: 5px;">';
                        print '</a><br>';
                        if ($subdir == $selected_theme) {
                            print '<input ' . ($edit ? '' : 'disabled') . ' type="radio" class="' . ($var ? 'imp' : '') . 'pair themethumbs" style="border: 0px;" checked name="main_theme" value="' . $subdir . '"> <b>' . $subdir . '</b>';
                        } else {
                            print '<input ' . ($edit ? '' : 'disabled') . ' type="radio" class="' . ($var ? 'imp' : '') . 'pair themethumbs" style="border: 0px;" name="main_theme" value="' . $subdir . '"> ' . $subdir;
                        }
                        print '</div>';
                        $i++;
                    }
                }
            }
        }
    }
    print '</div></td></tr></table>';
    print '</td></tr>';
    // BackgroundColor
    if ($foruserprofile) {
        /*$var=!$var;
            print '<tr '.$bc[$var].'>';
            print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
               print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
               print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
               print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"';	// Disabled for demo
               print '> '.$langs->trans("UsePersonalValue").'</td>';
               print '<td>';
            if ($edit)
            {
        		print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
            }
           	else
           	{
           		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
        		if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
        		else print '';
           	}
           	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
            print '</td>';*/
    } else {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("BackgroundColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        //var_dump($conf->global->THEME_ELDY_BACKBODY);
        if ($edit) {
            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1) . ' ';
        } else {
            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), '');
            if ($color) {
                print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #' . $color . '" value="' . $color . '">';
            } else {
                print $langs->trans("Default");
            }
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>ffffff</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
    }
    // TopMenuBackgroundColor
    if ($foruserprofile) {
        /*$var=!$var;
            print '<tr '.$bc[$var].'>';
            print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
               print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
               print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
               print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"';	// Disabled for demo
               print '> '.$langs->trans("UsePersonalValue").'</td>';
               print '<td>';
            if ($edit)
            {
        		print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
            }
           	else
           	{
           		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
        		if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
        		else print '';
           	}
           	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
            print '</td>';*/
    } else {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("TopMenuBackgroundColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        if ($edit) {
            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1) . ' ';
        } else {
            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), '');
            if ($color) {
                print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #' . $color . '" value="' . $color . '">';
            } else {
                print $langs->trans("Default");
            }
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>7882aa</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
    }
    // BackgroundTableTitleColor
    if ($foruserprofile) {
    } else {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("BackgroundTableTitleColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        if ($edit) {
            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1) . ' ';
        } else {
            print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>e6e6e6</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
        print '</tr>';
    }
    // TextTitleColor
    if ($foruserprofile) {
    } else {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("TextTitleColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        if ($edit) {
            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1) . ' ';
        } else {
            print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>3c3c14</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
        print '</tr>';
    }
    // Use Hover
    $var = !$var;
    if ($foruserprofile) {
        /* Must first change option to choose color of highlight instead of yes or no.
           print '<tr '.$bc[$var].'>';
           print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
           print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
           print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
           print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
           print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
           print '</td>';
           print '</tr>';
           */
    } else {
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("HighlightLinesColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        //print '<input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
        //print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
        if ($edit) {
            if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
                $color = 'edf4fb';
            } else {
                $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
            }
            print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1) . ' ';
        } else {
            if ($conf->global->THEME_ELDY_USE_HOVER == '1') {
                $color = 'edf4fb';
            } else {
                $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), '');
            }
            if ($color) {
                if ($color != 'edf4fb') {
                    print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #' . $color . '" value="' . $color . '">';
                } else {
                    print $langs->trans("Default");
                }
            } else {
                print $langs->trans("None");
            }
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>edf4fb</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
        print '</tr>';
    }
    // TopMenuBackgroundColor
    if ($foruserprofile) {
        /*$var=!$var;
            print '<tr '.$bc[$var].'>';
            print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
               print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
               print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
               print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"';	// Disabled for demo
               print '> '.$langs->trans("UsePersonalValue").'</td>';
               print '<td>';
            if ($edit)
            {
        		print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
            }
           	else
           	{
           		$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
        		if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
        		else print '';
           	}
           	if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
            print '</td>';*/
    } else {
        $var = !$var;
        print '<tr ' . $bc[$var] . '>';
        print '<td>' . $langs->trans("LinkColor") . '</td>';
        print '<td colspan="' . ($colspan - 1) . '">';
        if ($edit) {
            print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1) . ' ';
        } else {
            $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), '');
            if ($color) {
                print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #' . $color . '" value="' . $color . '">';
            } else {
                print $langs->trans("Default");
            }
        }
        print ' &nbsp; (' . $langs->trans("Default") . ': <strong>000078</strong>, ' . $langs->trans("NotSupportedByAllThemes") . ', ' . $langs->trans("PressF5AfterChangingThis") . ')';
        print '</td>';
    }
    print '</table>';
}
Beispiel #2
0
    text-align: center;
    border-radius: 4px;
}
.boxstats:hover {
<?php 
if ($colorbacklinepairhover) {
    ?>
	background: rgb(<?php 
    echo $colorbacklinepairhover;
    ?>
) !important;
<?php 
} else {
    ?>
	background-color: #<?php 
    echo colorArrayToHex(colorStringToArray($colorbacklinepair1));
    ?>
;
<?php 
}
?>
}
span.boxstatstext {
	opacity: 0.8;
    line-height: 18px;
}
span.boxstatsindicator {
	font-size: 110%;
	font-weight: normal;
}
span.dashboardlineindicator, span.dashboardlineindicatorlate {
 /**
  *		Output a HTML thumb of color or a text if not defined.
  *
  *		@param	string		$color				String with hex (FFFFFF) or comma RGB ('255,255,255')
  *		@param	string		$textifnotdefined	Text to show if color not defined
  * 		@return	string							HTML code for color thumb
  *		@see selectColor
  */
 static function showColor($color, $textifnotdefined = '')
 {
     $textcolor = 'FFF';
     if ($color) {
         $hex = $color;
         $r = hexdec($hex[0] . $hex[1]);
         $g = hexdec($hex[2] . $hex[3]);
         $b = hexdec($hex[4] . $hex[5]);
         $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0;
         // HSL algorithm
         if ($bright > 0.6) {
             $textcolor = '000';
         }
     }
     include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
     $color = colorArrayToHex(colorStringToArray($color, array()), '');
     if ($color) {
         print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #' . $textcolor . '; background-color: #' . $color . '" value="' . $color . '">';
     } else {
         print $textifnotdefined;
     }
 }
Beispiel #4
0
        // fix case of uk (when we use labels)
        print "\tdata.setValue(" . $i . ", 0, \"" . $valcountry . "\");\n";
        print "\tdata.setValue(" . $i . ", 1, " . $val['nb'] . ");\n";
        // Google's Geomap only supports up to 400 entries
        if ($i >= 400) {
            break;
        }
        $i++;
    }
    print "\tvar options = {};\n";
    print "\toptions['dataMode'] = 'regions';\n";
    print "\toptions['showZoomOut'] = false;\n";
    //print "\toptions['zoomOutLabel'] = '".dol_escape_js($langs->transnoentitiesnoconv("Numbers"))."';\n";
    print "\toptions['width'] = " . $graphwidth . ";\n";
    print "\toptions['height'] = " . $graphheight . ";\n";
    print "\toptions['colors'] = [0x" . colorArrayToHex($theme_datacolor[1], 'BBBBBB') . ", 0x" . colorArrayToHex($theme_datacolor[0], '444444') . "];\n";
    print "\tvar container = document.getElementById('" . $mode . "');\n";
    print "\tvar geomap = new google.visualization.GeoMap(container);\n";
    print "\tgeomap.draw(data, options);\n";
    print "};\n";
    print "</script>\n";
    // print the div tag that will contain the map
    print '<div align="center" id="' . $mode . '"></div>' . "\n";
    print '<br>';
}
if ($mode) {
    // Print array / Affiche le tableau
    print '<table class="noborder" width="100%">';
    print '<tr class="liste_titre">';
    print '<td align="center">' . $label . '</td>';
    if ($label2) {
Beispiel #5
0
    margin: 3px;
    padding: 3px;
	/*-moz-box-shadow: 3px 3px 4px #f4f4f4;
    -webkit-box-shadow: 3px 3px 4px #f4f4f4;
    box-shadow: 3px 3px 4px #f4f4f4;
    margin-bottom: 8px !important;*/
    border: 1px solid #AAA;
    text-align: center;
    border-radius: 2px;
    min-height: 38px;
}
.boxstats:hover {
<?php if ($colorbacklinepairhover) { ?>
	background: rgb(<?php echo $colorbacklinepairhover; ?>) !important;
<?php } else { ?>
	background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?>;
<?php } ?>
}
span.boxstatstext {
	opacity: 0.8;
    line-height: 18px;
}
span.boxstatsindicator {
	font-size: 110%;
	font-weight: normal;
}
span.dashboardlineindicator, span.dashboardlineindicatorlate {
	font-size: 120%;
	font-weight: bold;
}
span.dashboardlineok {
 /**
  *		Output a HTML thumb of color or a text if not defined.
  *
  *		@param	string		$color				String with hex (FFFFFF) or comma RGB ('255,255,255')
  *		@param	string		$textifnotdefined	Text to show if color not defined
  * 		@return	string							HTML code for color thumb
  *		@see selectColor
  */
 static function showColor($color, $textifnotdefined = '')
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
     $color = colorArrayToHex(colorStringToArray($color, array()), '');
     if ($color) {
         print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #' . $color . '" value="' . $color . '">';
     } else {
         print $textifnotdefined;
     }
 }
 /**
  *		Output a HTML thumb of color or a text if not defined.
  *
  *		@param	string		$color				String with hex (FFFFFF) or comma RGB ('255,255,255')
  *		@param	string		$textifnotdefined	Text to show if color not defined
  * 		@return	string							HTML code for color thumb
  *		@see selectColor
  */
 static function showColor($color, $textifnotdefined = '')
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
     $color = colorArrayToHex(colorStringToArray($color, array()), '');
     $textcolor = '000';
     $tmpcolorweight = 0;
     foreach (colorStringToArray($color, array()) as $x) {
         $tmpcolorweight += $x;
     }
     if ($tmpcolorweight < 400) {
         $textcolor = 'FFF';
     }
     if ($color) {
         print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; color: #' . $textcolor . '; background-color: #' . $color . '" value="' . $color . '">';
     } else {
         print $textifnotdefined;
     }
 }