2012-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/graphs/functions_gd.php: fixed into the function "gd_progress_bubble" when the $progress is upper to 100% or lower 0% show the image "out of limits". Merge from the branch "pandora_4.0" git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5705 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dec4cd1e99
commit
6e0f14e2b6
|
@ -1,3 +1,11 @@
|
||||||
|
2012-03-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/graphs/functions_gd.php: fixed into the function
|
||||||
|
"gd_progress_bubble" when the $progress is upper to 100% or lower 0% show
|
||||||
|
the image "out of limits".
|
||||||
|
|
||||||
|
Merge from the branch "pandora_4.0"
|
||||||
|
|
||||||
2012-03-07 Sergio Martin <sergio.martin@artica.es>
|
2012-03-07 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* godmode/reporting/graph_builder.main.php: Added custom
|
* godmode/reporting/graph_builder.main.php: Added custom
|
||||||
|
|
|
@ -183,54 +183,64 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_
|
||||||
global $config;
|
global $config;
|
||||||
global $REMOTE_ADDR;
|
global $REMOTE_ADDR;
|
||||||
|
|
||||||
$ratingWidth = ($progress/100)*$width;
|
if ($progress > 100 || $progress < 0) {
|
||||||
$ratingHeight = ($progress/100)*$height;
|
// HACK: This report a static image... will increase render in about 200% :-) useful for
|
||||||
|
// high number of realtime statusbar images creation (in main all agents view, for example
|
||||||
$image = imagecreate($width,$height);
|
$imgPng = imageCreateFromPng($out_of_lim_image);
|
||||||
|
imageAlphaBlending($imgPng, true);
|
||||||
//colors
|
imageSaveAlpha($imgPng, true);
|
||||||
$back = ImageColorAllocate($image,255,255,255);
|
imagePng($imgPng);
|
||||||
imagecolortransparent ($image, $back);
|
|
||||||
|
|
||||||
$black = ImageColorAllocate($image,0,0,0);
|
|
||||||
$red = ImageColorAllocate($image,255,60,75);
|
|
||||||
$green = ImageColorAllocate($image,50,205,50);
|
|
||||||
$blue = ImageColorAllocate($image,44,81,120);
|
|
||||||
$soft_green = ImageColorAllocate($image,176, 255, 84);
|
|
||||||
$soft_yellow = ImageColorAllocate($image,255, 230, 84);
|
|
||||||
$soft_red = ImageColorAllocate($image,255, 154, 84);
|
|
||||||
$other_red = ImageColorAllocate($image,238, 0, 0);
|
|
||||||
if (!empty($color)) {
|
|
||||||
$defined_color = ImageColorAllocate($image, $color[0], $color[1], $color[2]);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (isset($defined_color)) {
|
$ratingWidth = ($progress/100)*$width;
|
||||||
imagefilledellipse($image, $width / 2, $height / 2,
|
$ratingHeight = ($progress/100)*$height;
|
||||||
$ratingWidth, $ratingHeight, $defined_color);
|
|
||||||
|
$image = imagecreate($width,$height);
|
||||||
|
|
||||||
|
//colors
|
||||||
|
$back = ImageColorAllocate($image,255,255,255);
|
||||||
|
imagecolortransparent ($image, $back);
|
||||||
|
|
||||||
|
$black = ImageColorAllocate($image,0,0,0);
|
||||||
|
$red = ImageColorAllocate($image,255,60,75);
|
||||||
|
$green = ImageColorAllocate($image,50,205,50);
|
||||||
|
$blue = ImageColorAllocate($image,44,81,120);
|
||||||
|
$soft_green = ImageColorAllocate($image,176, 255, 84);
|
||||||
|
$soft_yellow = ImageColorAllocate($image,255, 230, 84);
|
||||||
|
$soft_red = ImageColorAllocate($image,255, 154, 84);
|
||||||
|
$other_red = ImageColorAllocate($image,238, 0, 0);
|
||||||
|
if (!empty($color)) {
|
||||||
|
$defined_color = ImageColorAllocate($image, $color[0], $color[1], $color[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($defined_color)) {
|
||||||
|
imagefilledellipse($image, $width / 2, $height / 2,
|
||||||
|
$ratingWidth, $ratingHeight, $defined_color);
|
||||||
|
}
|
||||||
|
elseif ($rating > 70) {
|
||||||
|
imagefilledellipse($image, $width / 2, $height / 2,
|
||||||
|
$ratingWidth, $ratingHeight, $soft_green);
|
||||||
|
}
|
||||||
|
elseif ($rating > 50) {
|
||||||
|
imagefilledellipse($image, $width / 2, $height / 2,
|
||||||
|
$ratingWidth, $ratingHeight, $soft_yellow);
|
||||||
|
}
|
||||||
|
elseif ($rating > 30) {
|
||||||
|
imagefilledellipse($image, $width / 2, $height / 2,
|
||||||
|
$ratingWidth, $ratingHeight, $soft_red);
|
||||||
|
}
|
||||||
|
else if($rating > 0) {
|
||||||
|
imagefilledellipse($image, $width / 2, $height / 2,
|
||||||
|
$ratingWidth, $ratingHeight, $other_red);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Write the value
|
||||||
|
$size = imagettfbbox ($fontsize, 0, $font, $value_text);
|
||||||
|
ImageTTFText($image, $fontsize, 0,
|
||||||
|
($width/2) - ($size[4] / 2), ($height/2) + ($size[1] / 2), $black, $font, $value_text);
|
||||||
|
|
||||||
|
imagePNG($image);
|
||||||
}
|
}
|
||||||
elseif ($rating > 70) {
|
|
||||||
imagefilledellipse($image, $width / 2, $height / 2,
|
|
||||||
$ratingWidth, $ratingHeight, $soft_green);
|
|
||||||
}
|
|
||||||
elseif ($rating > 50) {
|
|
||||||
imagefilledellipse($image, $width / 2, $height / 2,
|
|
||||||
$ratingWidth, $ratingHeight, $soft_yellow);
|
|
||||||
}
|
|
||||||
elseif ($rating > 30) {
|
|
||||||
imagefilledellipse($image, $width / 2, $height / 2,
|
|
||||||
$ratingWidth, $ratingHeight, $soft_red);
|
|
||||||
}
|
|
||||||
else if($rating > 0) {
|
|
||||||
imagefilledellipse($image, $width / 2, $height / 2,
|
|
||||||
$ratingWidth, $ratingHeight, $other_red);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Write the value
|
|
||||||
$size = imagettfbbox ($fontsize, 0, $font, $value_text);
|
|
||||||
ImageTTFText($image, $fontsize, 0,
|
|
||||||
($width/2) - ($size[4] / 2), ($height/2) + ($size[1] / 2), $black, $font, $value_text);
|
|
||||||
|
|
||||||
imagePNG($image);
|
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue