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 "Caller clear | "; echo "Sub Busy | "; echo "No Answer | "; echo "Signal Error | "; echo "Total call duration | "; echo "Average call duration(s) | "; echo "||
|   | "; echo "||||||||||
| $service_type_label[$i] | "; for($j=0;$j<9;$j++) { echo "";
if($j==8)
{
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"; } else echo "{$service_csta[$i][$j]}"; if($j>0&&$j<8) { 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%"; } echo " | ";
}
echo ""; if($service_csta[$i][1]!=0) $ave=round($service_csta[$i][8]/$service_csta[$i][1]); else $ave=0; echo "$ave"; echo " | "; echo "||||||||
2.Service(Attempt)
";
//=====graphics size=======
$sizex=830;
$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=790;
$y2=$y1;
if($i!=10)
{
imageline($im, $x1,$y1,460,$y2, IMG_COLOR_STYLED);
imageline($im, 490,$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;
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=0;$i<7;$i++)
{
$attempt_sum_one+=$service_csta[$i][0];
}
if($attempt_sum_one==0)
{
//sub to sub precent
$subs_to_subs_attempt_precent="0%";
//sub to trunk precent
$subs_to_trunk_attempt_precent="0%";
//trunk to sub precent
$trunk_to_subs_attempt_precent="0%";
//trunk to trunk precent
$trunk_to_trunk_attempt_precent="0%";
//interconnection precent
$interconnection_attempt_precent="0%";
//subs to IP precent
$subs_to_ip_attempt_precent="0%";
//trunk to IP precent
$trunk_to_ip_attempt_precent="0%";
for($t=0;$t<7;$t++)
$height[$t]=0;
}
else
{
//sub to sub precent
$subs_to_subs_attempt_precent=number_format($service_csta[0][0]*100/$attempt_sum_one,2,'.','')."%";
//sub to trunk precent
$subs_to_trunk_attempt_precent=number_format($service_csta[1][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to sub precent
$trunk_to_subs_attempt_precent=number_format($service_csta[2][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to trunk precent
$trunk_to_trunk_attempt_precent=number_format($service_csta[3][0]*100/$attempt_sum_one,2,'.','')."%";
//interconnection precent
$interconnection_attempt_precent=number_format($service_csta[4][0]*100/$attempt_sum_one,2,'.','')."%";
//subs to IP precent
$subs_to_ip_attempt_precent=number_format($service_csta[5][0]*100/$attempt_sum_one,2,'.','')."%";
//trunk to IP precent
$trunk_to_ip_attempt_precent=number_format($service_csta[6][0]*100/$attempt_sum_one,2,'.','')."%";
for($t=0;$t<7;$t++)
$height[$t]=floor(180*$service_csta[$t][0]/$attempt_sum_one);
}
//=====get the precent and block height(Part-2)======
$attempt_sum_tow=0;
for($i=7;$i<12;$i++)
{
$attempt_sum_tow+=$service_csta[$i][0];
}
if($attempt_sum_tow==0)
{
//mobile originated precent
$mobile_originated_attempt_precent="0%";
//mobile terminated precent
$mobile_terminated_attempt_precent="0%";
//in trunk precent
$in_trunk_attempt_precent="0%";
//out_trunk precent
$out_trunk_attempt_precent="0%";
//IP terminated precent
$ip_terminated_attempt_precent="0%";
for($t=7;$t<12;$t++)
$height[$t]=0;
}
else
{
//mobile originated precent
$mobile_originated_attempt_precent=number_format($service_csta[7][0]*100/$attempt_sum_tow,2,'.','')."%";
//mobile terminated precent
$mobile_terminated_attempt_precent=number_format($service_csta[8][0]*100/$attempt_sum_tow,2,'.','')."%";
//in trunk precent
$in_trunk_attempt_precent=number_format($service_csta[9][0]*100/$attempt_sum_tow,2,'.','')."%";
//out_trunk precent
$out_trunk_attempt_precent=number_format($service_csta[10][0]*100/$attempt_sum_tow,2,'.','')."%";
//IP terminated precent
$ip_terminated_attempt_precent=number_format($service_csta[11][0]*100/$attempt_sum_tow,2,'.','')."%";
for($t=7;$t<12;$t++)
$height[$t]=floor(180*$service_csta[$t][0]/$attempt_sum_tow);
}
//======draw the data block======
for($i=0;$i<12;$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]);
}
//======draw the legend string=======
imagestring($im,2,65,205,"SUB SUB",$black_color);
imagestring($im,2,60,220,"(".$subs_to_subs_attempt_precent.")",$black_color);
imagestring($im,2,125,205,"SUB TRK",$black_color);
imagestring($im,2,123,220,"(".$subs_to_trunk_attempt_precent.")",$black_color);
imagestring($im,2,185,205,"TRK SUB",$black_color);
imagestring($im,2,185,220,"(".$trunk_to_subs_attempt_precent.")",$black_color);
imagestring($im,2,245,205,"TRK TRK",$black_color);
imagestring($im,2,243,221,"(".$trunk_to_trunk_attempt_precent.")",$black_color);
imagestring($im,2,310,205,"INTRA",$black_color);
imagestring($im,2,308,221,"(".$interconnection_attempt_precent.")",$black_color);
imagestring($im,2,368,205,"SUB IP",$black_color);
imagestring($im,2,366,221,"(".$subs_to_ip_attempt_precent.")",$black_color);
imagestring($im,2,428,205,"TRK IP",$black_color);
imagestring($im,2,425,221,"(".$trunk_to_ip_attempt_precent.")",$black_color);
imagestring($im,2,500,205,"MO",$black_color);
imagestring($im,2,487,221,"(".$mobile_originated_attempt_precent.")",$black_color);
imagestring($im,2,560,205,"MT",$black_color);
imagestring($im,2,547,221,"(".$mobile_terminated_attempt_precent.")",$black_color);
imagestring($im,2,608,205,"IN TRK",$black_color);
imagestring($im,2,605,221,"(".$in_trunk_attempt_precent.")",$black_color);
imagestring($im,2,668,205,"OUT TRK",$black_color);
imagestring($im,2,667,221,"(".$out_trunk_attempt_precent.")",$black_color);
imagestring($im,2,742,205,"IP",$black_color);
imagestring($im,2,727,221,"(".$ip_terminated_attempt_precent.")",$black_color);
//draw the outline
imageLine($im,40,20,40,200,$black_color);
imageLine($im,40,20,460,20,$black_color);
imageLine($im,460,200,460,20,$black_color);
imageLine($im,40,200,460,200,$black_color);
imageLine($im,490,200,490,20,$black_color);
imageLine($im,490,20,790,20,$black_color);
imageLine($im,790,200,790,20,$black_color);
imageLine($im,490,200,790,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 "
| SUB SUB-> Subscriber to subscriber | "; echo "TRK TRK-> Trunk to trunk | "; echo "MO-> Mobile originated | "; echo "
| SUB TRK-> Subscriber to trunk | "; echo "INTRA-> Intraconnection | "; echo "MT-> Mobile terminated | "; echo "
| TRK SUB-> Trunk to subscriber | "; echo "SUB IP-> Subscriber to IP | "; echo "IN TRK-> In trunk | "; echo "
| TRK IP-> Trunk to IP | "; echo ""; echo " | OUT TRK-> Out trunk | "; echo "
| "; echo " | "; echo " | IP-> IP terminated | "; echo "
3.Success/Failure
";
$sizex=830;
$sizey=310;
$image=imagecreate($sizex,$sizey);
$bgcolor=imagecolorallocate($image,255,255,255);
$black_color=ImageColorAllocate($image,0,0,0);
$bgcolor=F8F8F8;
$fgcolor=000000;
$background_color = ImageColorAllocate ($image,
hexdec(substr($bgcolor, 0, 2)),
hexdec(substr($bgcolor, 2, 2)),
hexdec(substr($bgcolor, 4, 2)));
$text_color = ImageColorAllocate ($image,
hexdec(substr($fgcolor, 0, 2)),
hexdec(substr($fgcolor, 2, 2)),
hexdec(substr($fgcolor, 4, 2)));
//=====background========
ImageFilledRectangle($image,0,0,$sizex,$sizey,ImageColorAllocate ($image, 198, 198, 198));
ImageFilledRectangle($image,2,2,$sizex,$sizey,ImageColorAllocate ($image, 130, 130, 130));
$pointArr=array(0,$sizey-1,3,$sizey-4,4,$sizey-1);
Imagefilledpolygon($image, $pointArr, 3, ImageColorAllocate ($image, 130, 130, 130));
$pointArr=array($sizex-1,0,$sizex-4,3,$sizex,4);
Imagefilledpolygon($image, $pointArr, 3, ImageColorAllocate ($image, 130, 130, 130));
ImageFilledRectangle($image,2,2,$sizex-3,$sizey-3,$background_color);
//first
imageLine($image,40,20,40,200,$black_color);
imageLine($image,40,20,400,20,$black_color);
imageLine($image,400,200,400,20,$black_color);
imageLine($image,40,200,400,200,$black_color);
//second
imageLine($image,430,20,430,200,$black_color);
imageLine($image,430,20,790,20,$black_color);
imageLine($image,790,200,790,20,$black_color);
imageLine($image,430,200,790,200,$black_color);
//========draw the horizonal line(part-1)=======
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($image, $style);
for($i=10;$i>0;$i--)
{
$x1=40;
$y1=20+(10-$i)*18;
$x2=400;
$y2=$y1;
if($i!=10)
imageline($image, $x1,$y1,$x2,$y2, IMG_COLOR_STYLED);
imagestring($image,2,$x1-22,$y2-5,($i*10)."%",$black_color);
}
//========draw the horizonal line(part-2)=======
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
imagesetstyle($image, $style);
for($i=10;$i>0;$i--)
{
$x1=430;
$y1=20+(10-$i)*18;
$x2=790;
$y2=$y1;
if($i!=10)
imageline($image, $x1,$y1,$x2,$y2, IMG_COLOR_STYLED);
imagestring($image,2,$x1-22,$y2-5,($i*10)."%",$black_color);
}
//========draw the vitical line(part-1)=========
$u=floor(360/15);
for($i=0;$i<16;$i++)
{
$x1=40+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
ImageDashedLine($image,$x1,$y1,$x2,$y2,$black_color);
}
//========draw the vitical line(part-2)=========
for($i=0;$i<16;$i++)
{
$x1=430+$i*$u;
$y1=20;
$x2=$x1;
$y2=200;
ImageDashedLine($image,$x1,$y1,$x2,$y2,$black_color);
}
//=======get colors============
$color[0]=ImageColorAllocate($image,0x99,0x00,0x33);
$color[1]=ImageColorAllocate($image,0x99,0x00,0xcc);
$color[2]=ImageColorAllocate($image,0x99,0x99,0x00);
$color[3]=ImageColorAllocate($image,0x99,0xcc,0x99);
$color[4]=ImageColorAllocate($image,0x99,0xff,0x33);
$color[5]=ImageColorAllocate($image,0xff,0x99,0x66);
$color[6]=ImageColorAllocate($image,0xff,0x99,0xff);
$color[7]=ImageColorAllocate($image,0xff,0xff,0x00);
$color[8]=ImageColorAllocate($image,0x33,0x3,0x33);
$color[9]=ImageColorAllocate($image,0x00,0xcc,0xff);
$color[10]=ImageColorAllocate($image,0x00,0x66,0xcc);
$color[11]=ImageColorAllocate($image,0x33,0xff,0x99);
//======get the block height(part-1)===========
$sum_one=0;
for($i=0;$i<7;$i++)
$sum_one+=$service_csta[$i][0];
for($i=0;$i<7;$i++)
{
for($j=0;$j<7;$j++)
{
if($sum_one==0)
$total_height[$j][$i]=0;
else
$total_height[$j][$i]=floor(180*$service_csta[$i][$j+1]/$sum_one);
}
}
//======get the block height(part-2)===========
$sum_two=0;
for($i=7;$i<12;$i++)
$sum_two+=$service_csta[$i][0];
for($i=7;$i<12;$i++)
{
for($j=0;$j<7;$j++)
{
if($sum_two==0)
$total_height[$j][$i]=0;
else
$total_height[$j][$i]=floor(180*$service_csta[$i][$j+1]/$sum_two);
}
}
//========draw the data block(part-1)==========
for($i=0;$i<7;$i++)
{
for($j=0;$j<7;$j++)
{
if($total_height[$i][$j]<1)
$total_height[$i][$j]=0;
//echo "lie-$i-hang-$j-{$total_height[$i][$j]}
";
$x1=40+(2*$i+1)*24;
$y1=199;
for($z=0;$z<$j+1;$z++)
{
$y1=$y1-$total_height[$i][$z];
}
$x2=40+(2*$i+2)*24;
$y2=199;
for($z=0;$z<$j;$z++)
{
$y2=$y2-$total_height[$i][$z];
}
imagefilledrectangle($image,$x1,$y1,$x2,$y2,$color[$j]);
}
}
//========draw the data block(part-2)==========
for($i=0;$i<7;$i++)
{
for($j=7;$j<12;$j++)
{
if($total_height[$i][$j]<1)
$total_height[$i][$j]=0;
//echo "lie-$i-hang-$j-{$total_height[$i][$j]}
";
$x1=430+(2*$i+1)*24;
$y1=199;
for($z=7;$z<$j+1;$z++)
{
$y1=$y1-$total_height[$i][$z];
}
$x2=430+(2*$i+2)*24;
$y2=199;
for($z=7;$z<$j;$z++)
{
$y2=$y2-$total_height[$i][$z];
}
imagefilledrectangle($image,$x1,$y1,$x2,$y2,$color[$j]);
}
}
//=====draw the legend string(part-1)============
imagefilledrectangle($image,30,230,40,240,$color[0]);
imagestring($image,2,50,230,"SUB SUB",$black_color);
imagefilledrectangle($image,170,230,180,240,$color[1]);
imagestring($image,2,190,230,"SUB TRK",$black_color);
imagefilledrectangle($image,320,230,330,240,$color[2]);
imagestring($image,2,340,230,"TRK SUB",$black_color);
imagefilledrectangle($image,470,230,480,240,$color[7]);
imagestring($image,2,490,230,"MO",$black_color);
imagefilledrectangle($image,620,230,630,240,$color[8]);
imagestring($image,2,640,230,"MT",$black_color);
imagefilledrectangle($image,760,230,770,240,$color[9]);
imagestring($image,2,780,230,"IN TRK",$black_color);
imagefilledrectangle($image,30,250,40,260,$color[6]);
imagestring($image,2,50,250,"TRK IP",$black_color);
imagefilledrectangle($image,170,250,180,260,$color[3]);
imagestring($image,2,190,250,"TRK TRK",$black_color);
imagefilledrectangle($image,320,250,330,260,$color[4]);
imagestring($image,2,340,250,"INTRA",$black_color);
imagefilledrectangle($image,470,250,480,260,$color[10]);
imagestring($image,2,490,250,"OUT TRK",$black_color);
imagefilledrectangle($image,620,250,630,260,$color[11]);
imagestring($image,2,640,250,"IP",$black_color);
imagefilledrectangle($image,30,270,40,280,$color[5]);
imagestring($image,2,50,270,"SUB IP",$black_color);
imagestring($image,2,55,205,"Success",$black_color);
imagestring($image,2,113,200,"Call",$black_color);
imagestring($image,2,113,212,"Deny",$black_color);
imagestring($image,2,165,200,"Net",$black_color);
imagestring($image,2,163,212,"Busy",$black_color);
imagestring($image,2,202,200,"Caller",$black_color);
imagestring($image,2,204,212,"Clear",$black_color);
imagestring($image,2,260,200,"Sub",$black_color);
imagestring($image,2,258,212,"Busy",$black_color);
imagestring($image,2,310,200,"No",$black_color);
imagestring($image,2,303,212,"Answer",$black_color);
imagestring($image,2,348,200,"Signal",$black_color);
imagestring($image,2,349,212,"Error",$black_color);
imagestring($image,2,445,205,"Success",$black_color);
imagestring($image,2,113+390,200,"Call",$black_color);
imagestring($image,2,113+390,212,"Deny",$black_color);
imagestring($image,2,165+390,200,"Net",$black_color);
imagestring($image,2,163+390,212,"Busy",$black_color);
imagestring($image,2,202+390,200,"Caller",$black_color);
imagestring($image,2,204+390,212,"Clear",$black_color);
imagestring($image,2,260+390,200,"Sub",$black_color);
imagestring($image,2,258+390,212,"Busy",$black_color);
imagestring($image,2,310+390,200,"No",$black_color);
imagestring($image,2,303+390,212,"Answer",$black_color);
imagestring($image,2,348+390,200,"Signal",$black_color);
imagestring($image,2,349+390,212,"Error",$black_color);
//======show the answer failure graphics=====
$tt=time()-2500;
$file_name="ser4_".$tt.".png";
imagepng($image,$file_name);
imagedestroy($image);
echo "";
adjust_content_tail("down");
?>