forked from Wavyzz/dolibarr
Merge branch 'theme_top_menu' of github.com:atm-john/dolibarr into theme_badge_status
This commit is contained in:
@@ -7971,7 +7971,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
|||||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiledAttributes = !empty($TCompiledAttr)?implode(' ',$TCompiledAttr):'';
|
$compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):'';
|
||||||
|
|
||||||
$tag = !empty($url)?'a':'span';
|
$tag = !empty($url)?'a':'span';
|
||||||
|
|
||||||
@@ -8043,14 +8043,12 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
else{ // $displayMode >= 6
|
else{ // $displayMode >= 6
|
||||||
$return = $htmlLabel .' '. $htmlImg;
|
$return = $htmlLabel .' '. $htmlImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Use new badge
|
// Use new badge
|
||||||
elseif(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){
|
elseif(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){
|
||||||
|
|
||||||
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
|
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
|
||||||
|
|
||||||
|
|
||||||
if($displayMode == 3){
|
if($displayMode == 3){
|
||||||
$return = dolGetBadge($statusLabel, '', $statusType, 'dot');
|
$return = dolGetBadge($statusLabel, '', $statusType, 'dot');
|
||||||
}
|
}
|
||||||
@@ -8060,7 +8058,6 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
|||||||
else{
|
else{
|
||||||
$return = dolGetBadge($statusLabel, $html, $statusType);
|
$return = dolGetBadge($statusLabel, $html, $statusType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
@@ -8128,7 +8125,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
|
|||||||
$TCompiledAttr[] = $key.'="'.$value.'"';
|
$TCompiledAttr[] = $key.'="'.$value.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiledAttributes = !empty($TCompiledAttr)?implode(' ',$TCompiledAttr):'';
|
$compiledAttributes = !empty($TCompiledAttr)?implode(' ', $TCompiledAttr):'';
|
||||||
|
|
||||||
$tag = !empty($attr['href'])?'a':'span';
|
$tag = !empty($attr['href'])?'a':'span';
|
||||||
|
|
||||||
|
|||||||
@@ -2200,11 +2200,11 @@ function colorStringToArray($stringcolor, $colorifnotfound = array(88,88,88))
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $color
|
* @param string $color the color you need to valid
|
||||||
* @param boolean $allow_white
|
* @param boolean $allow_white in case of white isn't valid
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function colorValidateHex($color, $allow_white = false)
|
function colorValidateHex($color, $allow_white = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false;
|
if(!$allow_white && ($color === '#fff' || $color === '#ffffff') ) return false;
|
||||||
@@ -2218,8 +2218,8 @@ function colorValidateHex($color, $allow_white = false)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hex
|
* @param string $hex color in hex
|
||||||
* @param integer $steps
|
* @param integer $steps Steps should be between -255 and 255. Negative = darker, positive = lighter
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function colorAdjustBrightness($hex, $steps)
|
function colorAdjustBrightness($hex, $steps)
|
||||||
@@ -2230,7 +2230,7 @@ function colorAdjustBrightness($hex, $steps)
|
|||||||
// Normalize into a six character long hex string
|
// Normalize into a six character long hex string
|
||||||
$hex = str_replace('#', '', $hex);
|
$hex = str_replace('#', '', $hex);
|
||||||
if (strlen($hex) == 3) {
|
if (strlen($hex) == 3) {
|
||||||
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
|
$hex = str_repeat(substr($hex, 0, 1), 2).str_repeat(substr($hex, 1, 1), 2).str_repeat(substr($hex, 2, 1), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split into three parts: R, G and B
|
// Split into three parts: R, G and B
|
||||||
@@ -2239,7 +2239,7 @@ function colorAdjustBrightness($hex, $steps)
|
|||||||
|
|
||||||
foreach ($color_parts as $color) {
|
foreach ($color_parts as $color) {
|
||||||
$color = hexdec($color); // Convert to decimal
|
$color = hexdec($color); // Convert to decimal
|
||||||
$color = max(0,min(255,$color + $steps)); // Adjust color
|
$color = max(0, min(255, $color + $steps)); // Adjust color
|
||||||
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2247,7 +2247,7 @@ function colorAdjustBrightness($hex, $steps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hex
|
* @param string $hex color in hex
|
||||||
* @param integer $percent 0 to 100
|
* @param integer $percent 0 to 100
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -2258,7 +2258,7 @@ function colorDarker($hex, $percent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hex
|
* @param string $hex color in hex
|
||||||
* @param integer $percent 0 to 100
|
* @param integer $percent 0 to 100
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -2270,9 +2270,9 @@ function colorLighten($hex, $percent)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $hex
|
* @param string $hex color in hex
|
||||||
* @param float $alpha 0 to 1
|
* @param float $alpha 0 to 1
|
||||||
* @param bool $returnArray :
|
* @param bool $returnArray
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
||||||
@@ -2286,10 +2286,10 @@ function colorHexToRgb($hex, $alpha = false, $returnArray = false)
|
|||||||
$rgb['b'] = hexdec($length == 6 ? substr($hex, 4, 2) : ($length == 3 ? str_repeat(substr($hex, 2, 1), 2) : 0));
|
$rgb['b'] = hexdec($length == 6 ? substr($hex, 4, 2) : ($length == 3 ? str_repeat(substr($hex, 2, 1), 2) : 0));
|
||||||
if ( $alpha !== false ) {
|
if ( $alpha !== false ) {
|
||||||
$rgb['a'] = floatval($alpha);
|
$rgb['a'] = floatval($alpha);
|
||||||
$string = 'rgba('.implode(',', $rgb ).')';
|
$string = 'rgba('.implode(',', $rgb).')';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$string = 'rgb('.implode(',', $rgb ).')';
|
$string = 'rgb('.implode(',', $rgb).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($returnArray){
|
if($returnArray){
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||||
@@ -288,27 +288,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
|||||||
|
|
||||||
<h2 id="helper">Use status helper function</h2>
|
<h2 id="helper">Use status helper function</h2>
|
||||||
<p>Using the dolGetStatus function provide in core/lib/functions.lib.php. This function is recommended for code uniformisation and easy maintain</p>
|
<p>Using the dolGetStatus function provide in core/lib/functions.lib.php. This function is recommended for code uniformisation and easy maintain</p>
|
||||||
<?php
|
<?php
|
||||||
$saveGlobalConf = $conf->global->MAIN_STATUS_USES_CSS;
|
$saveGlobalConf = $conf->global->MAIN_STATUS_USES_CSS;
|
||||||
$conf->global->MAIN_STATUS_USES_CSS = 1;
|
$conf->global->MAIN_STATUS_USES_CSS = 1;
|
||||||
?>
|
?>
|
||||||
<h4>Using hidden global conf MAIN_STATUS_USES_CSS=1</h4>
|
<h4>Using hidden global conf MAIN_STATUS_USES_CSS=1</h4>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4') ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4') ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',1) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 1) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',2) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 2) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',3) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 3) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',4) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 4) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',5) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 5) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',6) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 6) ?></p>
|
||||||
|
|
||||||
<?php $conf->global->MAIN_STATUS_USES_CSS = 0; ?>
|
<?php $conf->global->MAIN_STATUS_USES_CSS = 0; ?>
|
||||||
<h4>Disabled hidden global conf : MAIN_STATUS_USES_CSS=0</h4>
|
<h4>Disabled hidden global conf : MAIN_STATUS_USES_CSS=0</h4>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',1) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 1) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',2) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 2) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',3) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 3) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',4) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 4) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',5) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 5) ?></p>
|
||||||
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',6) ?></p>
|
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 6) ?></p>
|
||||||
|
|
||||||
<?php $conf->global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?>
|
<?php $conf->global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?>
|
||||||
|
|
||||||
|
|||||||
@@ -76,5 +76,3 @@ $badgeStatus6='#cad2d2';
|
|||||||
$badgeStatus7='#baa32b';
|
$badgeStatus7='#baa32b';
|
||||||
$badgeStatus8='#be3013';
|
$badgeStatus8='#be3013';
|
||||||
$badgeStatus9='#e7f0f0';
|
$badgeStatus9='#e7f0f0';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user