".$l->g(526).""; die(); } if( ! function_exists( "imagefontwidth") ) { echo "
ERROR: GD for PHP is not properly installed.
Try uncommenting \";extension=php_gd2.dll\" (windows) by removing the semicolon in file php.ini, or try installing the php4-gd package.
"; die(); } else if( isset($_GET["generatePic"]) ) { $tot = 0; $quartiers = array(); $coul = array( 0x0091C3, 0xFFCB03 ,0x33CCCC, 0xFF9900, 0x969696, 0x339966, 0xFF99CC, 0x99CC00); $i = 0; while( $valStats = mysql_fetch_array( $resStats ) ) { $tot += $valStats["nb"]; if( $valStats["txt"] =="" ) $valStats["txt"] = $l->g(482); $quartiers[] = array( $valStats["nb"], $coul[ $i ], $valStats["txt"]." (".$valStats["nb"].")" ); $i++; if( $i > sizeof( $coul ) ) $i=0; } camembert($quartiers); } else { ?> OCS Inventory Stats "; echo "
".$l->g(28).": ".$valStats["nb"]."

".$l->g(483).""; ?> >$k) & 0xFF; /* détermine les "vraies" couleurs */ $color[$i]=imagecolorallocate($img,$t[0],$t[1],$t[2]); /* calcule l'angle des différents "secteurs" */ $v[$i+1]=$v[$i]+round($arr[$i][0]*360/$sum); if ($doit) { /* détermine les couleurs "ombrées" */ $shade[$i]=imagecolorallocate($img,max(0,$t[0]-50),max(0,$t[1]-50),max(0,$t[2]-50)); if ($v[$i+1]<180) { /* calcule les coordonnées des différents parallélogrammes */ $x[$i+1]=$cx+$a*cos($v[$i+1]*M_PI/180); $y[$i+1]=$cy+$b*sin($v[$i+1]*M_PI/180); } else { $m=$i+1; $x[$m]=$cx-$a; /* c'est comme si on remplaçait $v[$i+1] par 180° */ $y[$m]=$cy; $doit=false; /* indique qu'il est inutile de continuer! */ } } } /* dessine la "base" du camembert */ for ($i=0;$i<$m;$i++) imagefilledarc($img,$cx,$cy+$d,2*$a,2*$b,$v[$i],$v[$i+1],$shade[$i],IMG_ARC_PIE); /* dessine la partie "verticale" du camembert */ for ($i=0;$i<$m;$i++) { $area=array($x[$i],$y[$i]+$d,$x[$i],$y[$i],$x[$i+1],$y[$i+1],$x[$i+1],$y[$i+1]+$d); imagefilledpolygon($img,$area,4,$shade[$i]); } /* dessine le dessus du camembert */ for ($i=0;$i<$n;$i++) imagefilledarc($img,$cx,$cy,2*$a,2*$b,$v[$i],$v[$i+1],$color[$i],IMG_ARC_PIE); /*imageellipse($img,$cx,$cy-$oy,2*$A,2*$B,$black); // dessine l'ellipse "englobante" */ /* dessine les "flêches" et met en place le texte */ for ($i=0,$AA=$A*$A,$BB=$B*$B;$i<$n;$i++) if ($arr[$i][0]) { $phi=($v[$i+1]+$v[$i])/2; /* intersection des "flêches" avec l'ellipse "englobante" */ $px=$a*3*cos($phi*M_PI/180)/4; $py=$b*3*sin($phi*M_PI/180)/4; /* équation du 2ème degré avec 2 racines réelles et distinctes */ $U=$AA*$py*$py+$BB*$px*$px; $V=$AA*$oy*$px*$py; $W=$AA*$px*$px*($oy*$oy-$BB); /* calcule le pourcentage à afficher */ $value=number_format(100*$arr[$i][0]/$sum,2,",","")."%"; /* écrit le texte à droite */ if ($phi<=90 || $phi>270) { $root=(-$V+sqrt($V*$V-$U*$W))/$U; imageline($img,$px+$cx,$py+$cy,$qx=$root+$cx,$qy=$root*$py/$px+$cy,$black); imageline($img,$qx,$qy,$qx+10,$qy,$black); imagestring($img,$size,$qx+14,$qy-12,$arr[$i][2],$black); imagestring($img,$size,$qx+14,$qy-2,$value,$black); } else { /* écrit le texte à gauche */ $root=(-$V-sqrt($V*$V-$U*$W))/$U; imageline($img,$px+$cx,$py+$cy,$qx=$root+$cx,$qy=$root*$py/$px+$cy,$black); imageline($img,$qx,$qy,$qx-10,$qy,$black); imagestring($img,$size,$qx-12-$ifw*strlen($arr[$i][2]),$qy-12,$arr[$i][2],$black); imagestring($img,$size,$qx-12-$ifw*strlen($value),$qy-2,$value,$black); } } header("Content-type: image/png"); imagepng($img); imagedestroy($img); } ?>