mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 19:18:22 +01:00
fix compatibility status
This commit is contained in:
@@ -7981,14 +7981,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $statusLabel label of badge no html : use in alt attribute for accessibility
|
* @param string $statusLabel label of badge no html : use in alt attribute for accessibility
|
||||||
|
* @param string $statusLabelShort short label of badge no html
|
||||||
* @param string $html optional : label of badge with html
|
* @param string $html optional : label of badge with html
|
||||||
* @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name
|
* @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name
|
||||||
* @param int $displayMode for retrocompatibility 0=label only, 1=label + Picto, 2=Picto, 3=Picto + label
|
* @param int $displayMode for retrocompatibility 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||||
* @param string $url the url for link
|
* @param string $url the url for link
|
||||||
* @param array $params various params for future : recommended rather than adding more function arguments
|
* @param array $params various params for future : recommended rather than adding more function arguments
|
||||||
* @return string html status
|
* @return string html status
|
||||||
*/
|
*/
|
||||||
function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array())
|
function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array())
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@@ -8011,28 +8012,36 @@ function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $d
|
|||||||
if($displayMode==0){
|
if($displayMode==0){
|
||||||
$return = !empty($html)?$html:$statusLabel;
|
$return = !empty($html)?$html:$statusLabel;
|
||||||
}
|
}
|
||||||
|
elseif($displayMode===1){
|
||||||
|
$return = !empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel);
|
||||||
|
}
|
||||||
// use status with images
|
// use status with images
|
||||||
elseif(empty($conf->global->MAIN_STATUS_USES_CSS)){
|
elseif(empty($conf->global->MAIN_STATUS_USES_CSS)){
|
||||||
$return = '';
|
$return = '';
|
||||||
$htmlLabel = '<span class="hideonsmartphone">'.(!empty($html)?$html:$statusLabel).'</span>';
|
$htmlLabel = '<span class="hideonsmartphone">'.(!empty($html)?$html:$statusLabel).'</span>';
|
||||||
|
$htmlLabelShort = '<span class="hideonsmartphone">'.(!empty($html)?$html:(!empty($statusLabelShort)?$statusLabelShort:$statusLabel)).'</span>';
|
||||||
|
|
||||||
if(!empty($statusImg[$statusType])){
|
if(!empty($statusImg[$statusType])){
|
||||||
$htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
|
$htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
|
||||||
}else{
|
}else{
|
||||||
$htmlImg = img_picto($statusLabel, $statusType);
|
$htmlImg = img_picto($statusLabel, $statusType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($displayMode === 1){
|
|
||||||
$return = $htmlLabel .' '. $htmlImg;
|
if($displayMode === 2){
|
||||||
}
|
|
||||||
elseif($displayMode === 2){
|
|
||||||
$return = $htmlImg;
|
|
||||||
}
|
|
||||||
elseif($displayMode === 3){
|
|
||||||
$return = $htmlImg .' '. $htmlLabel;
|
$return = $htmlImg .' '. $htmlLabel;
|
||||||
}
|
}
|
||||||
else{
|
elseif($displayMode === 3){
|
||||||
$return = !empty($html)?$html:$statusLabel;
|
$return = $htmlImg;
|
||||||
|
}
|
||||||
|
elseif($displayMode === 4){
|
||||||
|
$return = $htmlImg .' '. $htmlLabel;
|
||||||
|
}
|
||||||
|
elseif($displayMode === 5){
|
||||||
|
$return = $htmlLabelShort .' '. $htmlImg;
|
||||||
|
}
|
||||||
|
else{ // $displayMode >= 6
|
||||||
|
$return = $htmlLabel .' '. $htmlImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8040,10 +8049,19 @@ function dolGetStatus($statusLabel = '', $html = '', $statusType = 'status0', $d
|
|||||||
// Use new badge
|
// Use new badge
|
||||||
if(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){
|
if(!empty($conf->global->MAIN_STATUS_USES_CSS) && !empty($displayMode)){
|
||||||
|
|
||||||
$mode = 'pill';
|
$statusLabelShort = !empty($statusLabelShort)?$statusLabelShort:$statusLabel;
|
||||||
if($displayMode == 2)$mode = 'dot';
|
|
||||||
|
|
||||||
$return = dolGetBadge($statusLabel, $html, $statusType, $mode);
|
if($displayMode == 3){
|
||||||
|
$return = dolGetBadge($statusLabel, '', $statusType, 'dot');
|
||||||
|
}
|
||||||
|
elseif($displayMode === 5){
|
||||||
|
$return = dolGetBadge($statusLabelShort, $html, $statusType);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$return = dolGetBadge($statusLabel, $html, $statusType);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|||||||
@@ -293,26 +293,34 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
|||||||
$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 <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 <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 <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 <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',5) ?></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 <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 <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 <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 <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',5) ?></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; ?>
|
||||||
|
|
||||||
|
|
||||||
<figure class="highlight"><pre>
|
<figure class="highlight"><pre>
|
||||||
<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4') ?>
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4') ?>
|
||||||
<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',1) ?>
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',1) ?>
|
||||||
<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',2) ?>
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',2) ?>
|
||||||
<?php print dolGetStatus('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'status4',3) ?>
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',3) ?>
|
||||||
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',4) ?>
|
||||||
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',5) ?>
|
||||||
|
<?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4',6) ?>
|
||||||
</pre></figure>
|
</pre></figure>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user