Merge pull request #4617 from aspangaro/develop-p5

New: Weather icons depends of the theme
This commit is contained in:
Laurent Destailleur 2016-02-14 12:50:12 +01:00
commit a8c305f820
53 changed files with 31 additions and 10 deletions

View File

@ -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> &nbsp; &nbsp; &nbsp; &nbsp; </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>&lt;= '.$level1.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td>';
print img_picto_common($text,'weather/weather-clouds.png',$options);
print img_weather($text,'weather-clouds.png',$options);
print '</td><td>&lt;= '.$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>&lt;= '.$level3.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td>';
print img_picto_common($text,'weather/weather-storm.png',$options);
print img_weather($text,'weather-storm.png',$options);
print '</td><td>&gt; '.$level3.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';

View File

@ -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)
*

View File

@ -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;
}

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB