[(#REM) /*******************************************************************************\ * BIODIV, plugin et squelette pour SPIP - https://www.spip.net/ * * dédié à la gestion d'observations naturalistes * * * * Copyright (C) 2008-2020 Renaud LAURETTE * * * * BIODIV a été développé initialement pour le projet Biodiv.Balma de l'APCVEB * * (Association de Protection du Cadre de Vie et de l'Environnement balmanais) * * voir Biodiv.Balma : https://balma.biodiv.fr/ * * voir APCVEB : http://apcveb.free.fr/ * * * * Ce programme est un logiciel libre distribué sous licence GNU/GPL. * * Pour plus de détails voir les fichier COPYING.txt et LICENCE-BIODIV.md * \*******************************************************************************/ ] "#CLE" => #VALEUR ); if(count($data) == 0) { echo "\n"; echo " [(#ENV{titre}) - ]Aucune donnée.\n"; echo "\n"; } else { // Mise à jour des min/max $fyear = $lyear = $count =0; foreach($data as $key => $value) { // Extraction de l'année preg_match('/x(\d{4})/',$key,$matches); $annee = $matches[1]; $count += $value; if($i==0) { $fyear = $annee; $lyear = $annee; $i=1; } else { $fyear = ($annee < $fyear)?$annee:$fyear; $lyear = ($annee > $lyear)?$annee:$lyear; } } $dyear = $lyear - $fyear +1; $xview = 10*12 + 20; $height = 10* $dyear; $yview = $height + 20; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $grid = array(); $imois = array('J','F','M','A','M','J','J','A','S','O','N','D'); $vleg = ""; for($i=0; $fyear+$i <= $lyear; $i++) { // Initialisation des mois à white - 12 mois for($j=0; $j<12; $j++) { $grid[$i][$j] = 'white'; } $py = $i*50 +20; $year = $fyear+$i; $vleg .= "$year\n"; } foreach($data as $key => $value) { preg_match('/x(\d{4})-(\d{2})/',$key,$matches); $annee = $matches[1]; $mois=$matches[2]-1; $index = $annee - $fyear; /* if($value==0) $color = 'white'; elseif($value==1) $color = 'lightgreen'; elseif($value <5) $color = 'green'; else $color = 'forestgreen'; */ if($value==0) $color = 'white'; elseif($value==1) $color = '#93CA88'; elseif($value==2) $color = '#63A555'; elseif($value <5) $color = '#428733'; elseif($value <10) $color = '#276B19'; else $color = '#104805'; $grid[$index][$mois] = $color; } for($j=0; $j<12; $j++) { $px = $j * 10; for($i=0; $fyear+$i <= $lyear; $i++) { $py = $i * 10; echo " \n"; } $tx = $j*50 + 20; echo "". $imois[$j] ."\n"; } echo $vleg; echo ""; $yt = ($height + 12)*5; echo " [(#ENV{titre}) - ]Total: $count\n"; echo "\n"; } ?>