Add function img_weather
This commit is contained in:
parent
5e608c9ab4
commit
47f60e1f8d
@ -261,24 +261,24 @@ $text=''; $options='height="60px"';
|
||||
print '<table>';
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-clear.png',$options);
|
||||
print img_weather($text,'weather-clear.png',$options);
|
||||
print '</td><td>= '.$level0.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-few-clouds.png',$options);
|
||||
print img_weather($text,'weather-few-clouds.png',$options);
|
||||
print '</td><td><= '.$level1.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-clouds.png',$options);
|
||||
print img_weather($text,'weather-clouds.png',$options);
|
||||
print '</td><td><= '.$level2.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print img_picto_common($text,'weather/weather-many-clouds.png',$options);
|
||||
print img_weather($text,'weather-many-clouds.png',$options);
|
||||
print '</td><td><= '.$level3.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
print img_picto_common($text,'weather/weather-storm.png',$options);
|
||||
print img_weather($text,'weather-storm.png',$options);
|
||||
print '</td><td>> '.$level3.'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
|
||||
@ -2170,6 +2170,27 @@ function img_object($titlealt, $picto, $options = '', $pictoisfullpath = false)
|
||||
return img_picto($titlealt, 'object_'.$picto, $options, $pictoisfullpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show weather picto
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @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 $options Add more attribute on img tag
|
||||
* @param int $pictoisfullpath If 1, image path is a full path
|
||||
* @return string Return img tag
|
||||
* @see #img_object, #img_picto
|
||||
*/
|
||||
function img_weather($titlealt, $picto, $options = '', $pictoisfullpath = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (! preg_match('/(\.png|\.gif)$/i', $picto)) $picto .= '.png';
|
||||
|
||||
$path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto;
|
||||
|
||||
return img_picto($titlealt, $path, $options, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show picto (generic function)
|
||||
*
|
||||
|
||||
@ -618,10 +618,10 @@ function showWeather($totallate,$text,$options)
|
||||
$level2=$offset+2*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
|
||||
$level3=$offset+3*$factor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
|
||||
|
||||
if ($totallate <= $level0) $out.=img_picto_common($text,'weather/weather-clear.png',$options);
|
||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_picto_common($text,'weather/weather-few-clouds.png',$options);
|
||||
if ($totallate > $level1 && $totallate <= $level2) $out.=img_picto_common($text,'weather/weather-clouds.png',$options);
|
||||
if ($totallate > $level2 && $totallate <= $level3) $out.=img_picto_common($text,'weather/weather-many-clouds.png',$options);
|
||||
if ($totallate > $level3) $out.=img_picto_common($text,'weather/weather-storm.png',$options);
|
||||
if ($totallate <= $level0) $out.=img_weather($text,'weather-clear.png',$options);
|
||||
if ($totallate > $level0 && $totallate <= $level1) $out.=img_weather($text,'weather-few-clouds.png',$options);
|
||||
if ($totallate > $level1 && $totallate <= $level2) $out.=img_weather($text,'weather-clouds.png',$options);
|
||||
if ($totallate > $level2 && $totallate <= $level3) $out.=img_weather($text,'weather-many-clouds.png',$options);
|
||||
if ($totallate > $level3) $out.=img_weather($text,'weather-storm.png',$options);
|
||||
return $out;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user