0){ //echo "
"; echo ""; }else{ echo ""; } adjust_head_frame("down"); adjust_title_head_frame("down"); adjust_title_tail_frame("down"); adjust_content_head_frame("down"); echo "| Type | "; echo "Attempt | "; echo "Success | "; echo "Media Error | "; echo "No Response | "; echo "General Error | "; echo "Total call duration | "; echo "Average call duration(s) | "; echo "||
| $service_type_label[$i] | "; for($j=0;$j<9;$j++) { echo "";
switch($j)
{
//Attempt
case 0:
echo "{$service_csta[$i][0]}";
break;
//Success
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
echo "{$service_csta[$i][$j]}";
if($service_csta[$i][0]==0)
$rate=0;
else
{
$rate=$service_csta[$i][$j]/$service_csta[$i][0];
$rate=$rate*100;
if($rate!=0&&$rate!=100)
$rate=number_format($rate, 2, '.', '');
}
echo " $rate%"; break; case 7: echo "{$service_csta[$i][$j]}(s)"; $hour=floor($service_csta[$i][$j]/3600); $minute=floor($service_csta[$i][$j]%3600/60); $second=$service_csta[$i][$j]%60; if($hour==0&&$minute==0&&$second==0) echo " "; else echo " $hour:$minute:$second"; break; case 8: if($service_csta[$i][1] == 0) $ave=0; else $ave=$service_csta[$i][7]/$service_csta[$i][1]; $ave=number_format($ave, 0, '.', ''); echo "$ave"; break; } echo " | ";
}
echo "
2.Service(Attempt) & Success/Failure
";
//=====graphics size=======
$sizex=650;
$sizey=250;
$im = ImageCreate ($sizex, $sizey);
$background_color=ImageColorAllocate($im,255,255,255);
$black_color=ImageColorAllocate($im,0,0,0);
$white_color= imagecolorallocate($im, 255, 255, 255);
$bgcolor=F8F8F8;
$fgcolor=000000;
$background_color = ImageColorAllocate ($im,
hexdec(substr($bgcolor, 0, 2)),
hexdec(substr($bgcolor, 2, 2)),
hexdec(substr($bgcolor, 4, 2)));
$text_color = ImageColorAllocate ($im,
hexdec(substr($fgcolor, 0, 2)),
hexdec(substr($fgcolor, 2, 2)),
hexdec(substr($fgcolor, 4, 2)));
//====graphics background=======
ImageFilledRectangle($im,0,0,$sizex,$sizey,ImageColorAllocate ($im, 198, 198, 198));
ImageFilledRectangle($im,2,2,$sizex,$sizey,ImageColorAllocate ($im, 130, 130, 130));
$pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1);
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
$pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4);
Imagefilledpolygon($im, $pointArr, 3, ImageColorAllocate ($im, 130, 130, 130));
ImageFilledRectangle($im,2,2,$sizex-3,$sizey-3,$background_color);
imagedashedline($im,30,30,100,100,$black_color);
//======draw the horizonal line========
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($im, $style);
for($i=10;$i>0;$i--)
{
$x1=40;
$y1=20+(10-$i)*18;
$x2=610;
$y2=$y1;
if($i!=10)
{
imageline($im, $x1,$y1,190,$y2, IMG_COLOR_STYLED);
imageline($im, 220,$y1,$x2,$y2, IMG_COLOR_STYLED);
}
imagestring($im,2,$x1-22,$y2-5,($i*10)."%",$black_color);
imagestring($im,2,$x2+5,$y2-5,($i*10)."%",$black_color);
}
//=======draw the vitical line=======
$u=floor(750/25);
for($i=0;$i<25;$i++)
{
$x1=40+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
if($i < 20)
ImageDashedLine($im,$x1,$y1,$x2,$y2,$black_color);
}
//=======get colors============
$color[0]=ImageColorAllocate($im,0x99,0x00,0x33);
$color[1]=ImageColorAllocate($im,0x99,0x00,0xcc);
$color[2]=ImageColorAllocate($im,0x99,0x99,0x00);
$color[3]=ImageColorAllocate($im,0x99,0xcc,0x99);
$color[4]=ImageColorAllocate($im,0x99,0xff,0x33);
$color[5]=ImageColorAllocate($im,0xff,0x99,0x66);
$color[6]=ImageColorAllocate($im,0xff,0x99,0xff);
$color[7]=ImageColorAllocate($im,0xff,0xff,0x00);
$color[8]=ImageColorAllocate($im,0x33,0x3,0x33);
$color[9]=ImageColorAllocate($im,0x00,0xcc,0xff);
$color[10]=ImageColorAllocate($im,0x00,0x66,0xcc);
$color[11]=ImageColorAllocate($im,0x33,0xff,0x99);
//=====get the precent and block height(Part-1)======
$attempt_sum_one=0;
for($i=1;$i<3;$i++)
{
$attempt_sum_one+=$service_csta[$i][0];
}
if($attempt_sum_one==0)
{
//conference precent
$conference_attempt_precent="0%";
//transcoding precent
$transcoding_attempt_precent="0%";
for($t=0;$t<2;$t++)
$height[$t]=0;
}
else
{
//sub to sub precent
$conference_attempt_precent=number_format($service_csta[1][0]*100/$attempt_sum_one,2,'.','')."%";
//sub to trunk precent
$transcoding_attempt_precent=number_format($service_csta[2][0]*100/$attempt_sum_one,2,'.','')."%";
for($t=0;$t<2;$t++)
$height[$t]=floor(180*$service_csta[$t+1][0]/$attempt_sum_one);
}
//======draw the data block======
for($i=0;$i<2;$i++)
{
$x1=40+(2*$i+1)*$u;
if($height[$i]==0)
$height[$i]=1;
$y1=200-$height[$i];
$x2=40+(2*$i+2)*$u;
$y2=199;
imagefilledrectangle($im,$x1,$y1,$x2,$y2,$color[$i]);
}
//=====get the data height (part-2)
//imagefilledrectangle($im,220,20,250,200,$color[$i]);
$field_index=array(1,2,3,4,5,6);
for($j=0;$j<6;$j++)
{
$x1_1=220+($j*2+1)*30;
$y1_1=200;
$x1_2=$x1_1+30;
if($attempt_sum_one==0)
$y1_2=200;
else
$y1_2=200-floor(180*$service_csta[1][$field_index[$j]]/$attempt_sum_one);
$x2_1=$x1_1;
$y2_1=$y1_2;
$x2_2=$x1_2;
if($attempt_sum_one==0)
$y2_2=$y1_2-0;
else
$y2_2=$y1_2-floor(180*$service_csta[2][$field_index[$j]]/$attempt_sum_one);
//echo "{$x1_1},{$y1_1},{$x1_2},{$y1_2}
";
imagefilledrectangle($im,$x1_1,$y1_1,$x1_2,$y1_2,$color[0]);
imagefilledrectangle($im,$x2_1,$y2_1,$x2_2,$y2_2,$color[1]);
}
//======draw the legend string=======
imagestring($im,2,72,205,"CONF",$black_color);
imagestring($im,2,60,220,"(".$conference_attempt_precent.")",$black_color);
imagestring($im,2,131,205,"TRAN",$black_color);
imagestring($im,2,123,220,"(".$transcoding_attempt_precent.")",$black_color);
imagestring($im,2,245,205,"Success",$black_color);
//imagestring($im,2,243,221,"(".$trunk_to_trunk_attempt_precent.")",$black_color);
imagestring($im,2,320,205,"No",$black_color);
imagestring($im,2,305,221,"Resource",$black_color);
imagestring($im,2,355,205,"Negotiation",$black_color);
imagestring($im,2,375,221,"Fail",$black_color);
imagestring($im,2,431,205,"Media",$black_color);
imagestring($im,2,430,221,"Error",$black_color);
imagestring($im,2,500,205,"No",$black_color);
imagestring($im,2,485,221,"Response",$black_color);
imagestring($im,2,548,205,"General",$black_color);
imagestring($im,2,552,221,"Error",$black_color);
//draw the outline
imageLine($im,40,20,40,200,$black_color);
imageLine($im,40,20,190,20,$black_color);
imageLine($im,190,200,190,20,$black_color);
imageLine($im,40,200,190,200,$black_color);
imageLine($im,220,200,220,20,$black_color);
imageLine($im,220,20,610,20,$black_color);
imageLine($im,610,200,610,20,$black_color);
imageLine($im,220,200,610,200,$black_color);
//======show the service attempt graphics==========
//-----输出图形文件,请勿修改
//delete *.png
$handle=opendir('.');
while($file=readdir($handle)){
$retval="";
$pt=strrpos($file,".");
if($pt) $retval=substr($file,$pt+1,strlen($file)-$pt);
if($retval=='png') unlink($file);
}
$filename="ser3_".time().".png";
if(1){
ImagePng ($im,"$filename");
ImageDestroy($im);
}
//-----显示图片
echo "";
//=======show the remark label========
echo "
| CONF-> Conference | "; echo "TRAN-> Transcoding | "; echo ""; echo " |
| "; echo " | "; echo " | "; echo " |
| "; echo " | "; echo " | "; echo " |
| "; echo " | "; echo " | "; echo " |
| "; echo " | "; echo " | "; echo " |