From d51c22a012fb4c55751c96b0247e6a1cab371ec5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 21 Sep 2017 17:28:00 +0200 Subject: [PATCH] NEW : customizable meteo in value or percentage --- htdocs/admin/delais.php | 239 ++++++++++++++++++++++++++++++++-------- 1 file changed, 196 insertions(+), 43 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index d3ef125f2a7..0b6690cd051 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -136,8 +136,18 @@ if ($action == 'update') } } } - - dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity); + + dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity); + + // For update value with percentage + $plus=''; + if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE'; + // Update values + for($i=0;$i<4;$i++) { + if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity); + } + } @@ -196,13 +206,6 @@ if ($action == 'edit') print ''.$langs->trans("MAIN_DISABLE_METEO").'' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . ''; print ''; - - print '
'; - - print '
'; - print '
'; - - print ''; } else { @@ -244,17 +247,20 @@ else print ''; - print '
'; - - // Boutons d'action - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; - } -print '
'; +print '
'; +if($action == 'edit') { + + $str = $langs->trans('StdMod'); + $str = $langs->trans('PercentageMod'); + print ''.$str.''; + print ''; + + print '

'; + +} // Show logo for weather print $langs->trans("DescWeather").'
'; @@ -268,35 +274,182 @@ $level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level $level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2; $level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3; $text=''; $options='height="60px"'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; + -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +if($action == 'edit') { + + + print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; + + print '
'; -print img_weather($text,'weather-clear.png',$options); -print '= '.$level0.'         '; -print img_weather($text,'weather-few-clouds.png',$options); -print '<= '.$level1.'         '; -print img_weather($text,'weather-clouds.png',$options); -print '<= '.$level2.'
'; -print img_weather($text,'weather-many-clouds.png',$options); -print '<= '.$level3.'         '; -print img_weather($text,'weather-storm.png',$options); -print '> '.$level3.'                        
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + /*print '';*/ + print ''; + print ''; + print ''; + print ''; + + print '
'; + print img_weather($text,'weather-clear.png',$options); + print '=         '; + print img_weather($text,'weather-few-clouds.png',$options); + print '<=         '; + print img_weather($text,'weather-clouds.png',$options); + print '<=
'; + print img_weather($text,'weather-many-clouds.png',$options); + print '<=         '; + print img_weather($text,'weather-storm.png',$options); + print '> '.$level3.'                        
'; + + print ''; + print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + /*print '';*/ + print ''; + print ''; + print ''; + print ''; + + print '
'; + print img_weather($text,'weather-clear.png',$options); + print '=  %         '; + print img_weather($text,'weather-few-clouds.png',$options); + print '<=  %         '; + print img_weather($text,'weather-clouds.png',$options); + print '<=  %
'; + print img_weather($text,'weather-many-clouds.png',$options); + print '<=  %         '; + print img_weather($text,'weather-storm.png',$options); + print '> '.$level3.'                        
'; + + print '
'; + +} else { + + if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + print img_weather($text,'weather-clear.png',$options); + print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %         '; + print img_weather($text,'weather-few-clouds.png',$options); + print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %         '; + print img_weather($text,'weather-clouds.png',$options); + print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %
'; + print img_weather($text,'weather-many-clouds.png',$options); + print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %         '; + print img_weather($text,'weather-storm.png',$options); + print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %                        
'; + + } else { + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + print img_weather($text,'weather-clear.png',$options); + print '= '.$level0.'         '; + print img_weather($text,'weather-few-clouds.png',$options); + print '<= '.$level1.'         '; + print img_weather($text,'weather-clouds.png',$options); + print '<= '.$level2.'
'; + print img_weather($text,'weather-many-clouds.png',$options); + print '<= '.$level3.'         '; + print img_weather($text,'weather-storm.png',$options); + print '> '.$level3.'                        
'; + + } +} +print ''; + +if($action == 'edit') { + + print '
'; + print '
'; + +} else { + + // Boutons d'action + print '
'; + print ''.$langs->trans("Modify").'
'; + +} -print ''; +?> + + +close();