2
0
forked from Wavyzz/dolibarr

NEW Gain space by moving the meteo on title line

This commit is contained in:
Laurent Destailleur
2019-02-20 06:01:13 +01:00
parent e42487ae4e
commit a3a89b755f
2 changed files with 32 additions and 13 deletions

View File

@@ -2969,6 +2969,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$picto .= '.png';
}
$fullpathpicto = $picto;
$reg=array();
if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
$morecss .= ($morecss ? ' ' : '') . $reg[1];
$moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt);
}
} else {
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
@@ -3152,7 +3157,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
return $fullpathpicto;
}
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for blind people
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt))?'':' title="'.dol_escape_htmltag($titlealt).'"').($moreatt?' '.$moreatt:' class="inline-block'.($morecss?' '.$morecss:'').'"').'>'; // Alt is used for accessibility, title for popup
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt))?'':' title="'.dol_escape_htmltag($titlealt).'"').($moreatt?' '.$moreatt.($morecss?' class="'.$morecss.'"':''):' class="inline-block'.($morecss?' '.$morecss:'').'"').'>'; // Alt is used for accessibility, title for popup
}
/**
@@ -3180,10 +3185,11 @@ function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false,
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
* @param string $moreatt Add more attribute on img tag
* @param int $pictoisfullpath If 1, image path is a full path
* @param string $morecss More CSS
* @return string Return img tag
* @see #img_object, #img_picto
*/
function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $morecss = '')
{
global $conf;
@@ -3191,7 +3197,7 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
$path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto;
return img_picto($titlealt, $path, $moreatt, 1);
return img_picto($titlealt, $path, $moreatt, 1, 0, 0, '', $morecss);
}
/**

View File

@@ -118,7 +118,9 @@ if (empty($user->societe_id))
$boxstat.='<div class="box">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
$boxstat.='<tr class="liste_titre">';
$boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
$boxstat.='<th class="liste_titre">';
$boxstat.='<div class="inline-block valignmiddle">'.$langs->trans("DolibarrStateBoard").'</div>';
$boxstat.='</th>';
$boxstat.='</tr>';
$boxstat.='<tr class="impair"><td class="tdboxstats nohover flexcontainer">';
@@ -530,10 +532,20 @@ $boxwork='';
$boxwork.='<div class="box">';
$boxwork.='<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n";
$boxwork.='<tr class="liste_titre">';
$boxwork.='<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>';
$boxwork.='<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
if ($showweather)
{
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
else $text=$langs->transnoentitiesnoconv("NoItemLate");
$text.='. '.$langs->transnoentitiesnoconv("LateDesc");
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
$options='height="24px" style="float: right"';
$boxwork.=showWeather($totallate, $text, $options, 'inline-block valignmiddle');
}
$boxwork.='</th>';
$boxwork.='</tr>'."\n";
if ($showweather)
/*if ($showweather)
{
$boxwork.='<tr class="nohover">';
$boxwork.='<td class="nohover'.($conf->global->MAIN_DISABLE_METEO == 2 ?' hideonsmartphone' : '').' center valignmiddle">';
@@ -546,7 +558,7 @@ if ($showweather)
$boxwork.=showWeather($totallate, $text, $options);
$boxwork.='</td>';
$boxwork.='</tr>';
}
}*/
// Show dashboard
$nbworkboardempty=0;
@@ -694,9 +706,10 @@ $db->close();
* @param int $totallate Nb of element late
* @param string $text Text to show on logo
* @param string $options More parameters on img tag
* @param string $morecss More CSS
* @return string Return img tag of weather
*/
function showWeather($totallate, $text, $options)
function showWeather($totallate, $text, $options, $morecss = '')
{
global $conf;
@@ -723,10 +736,10 @@ function showWeather($totallate, $text, $options)
$level3=$conf->global->{$used_conf.'3'};
}
if ($totallate <= $level0) $out.=img_weather($text, 'weather-clear.png', $options);
elseif ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text, 'weather-few-clouds.png', $options);
elseif ($totallate > $level1 && $totallate <= $level2) $out.=img_weather($text, 'weather-clouds.png', $options);
elseif ($totallate > $level2 && $totallate <= $level3) $out.=img_weather($text, 'weather-many-clouds.png', $options);
elseif ($totallate > $level3) $out.=img_weather($text, 'weather-storm.png', $options);
if ($totallate <= $level0) $out.=img_weather($text, 'weather-clear.png', $options, 0, $morecss);
elseif ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text, 'weather-few-clouds.png', $options, 0, $morecss);
elseif ($totallate > $level1 && $totallate <= $level2) $out.=img_weather($text, 'weather-clouds.png', $options, 0, $morecss);
elseif ($totallate > $level2 && $totallate <= $level3) $out.=img_weather($text, 'weather-many-clouds.png', $options, 0, $morecss);
elseif ($totallate > $level3) $out.=img_weather($text, 'weather-storm.png', $options, 0, $morecss);
return $out;
}