Files
agtuser 16a3fd1e1b init
2024-11-11 17:56:00 +08:00

459 lines
11 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// require("../../inc/header.inc");
?>
<head>
<?php
function Getdata($filelist,$startTime,$endTime)
{
//$link=mysql_connect("localhost","administrator","*86#ROtartsinim");
for($j=1;$j<13;$j++)
{
for($k=0;$k<30;$k++)
{
$data[$j][$k]=0;
}
}
for($j=1;$j<13;$j++)
{
if(strcmp($filelist[$j][name]," "))
{
//echo "filelist[$j][name]={$filelist[$j][name]}<br>";
//echo "filelist[$j][type]={$filelist[$j][type]}<br>";
//echo "startTime={$startTime}<br>";
//echo "endTime={$endTime}";
$sql="select Duration,csta_datetime FROM CSTA_DB.mscDetailData where key_type={$filelist[$j][type]} and (csta_datetime >='{$startTime}' and csta_datetime <='{$endTime}')";
//echo "<br>sql=$sql<br>";
$res=@mysqli_query($pubConn,$sql);
if(!($res))
{
$num=0;
}
else
{
$num=mysqli_num_rows($res);
//echo "num=$num<br>";
}
for($i=0;$i<$num;$i++)
{
$row=mysqli_fetch_array($res);
//echo "::: $row <br>";
$start=strtotime($startTime);
//echo "startTime=$startTime start=$start <br>";
$rowt=strtotime($row[1]);
//echo "rowt=$rowt row[1]={$row[1]}<br>";
$dif=$rowt-$start;
//echo "<br>dif=$dif<br>";
$instance=floor($dif/(60*60*24));
//echo "instance={$instance}";
//echo "<br>row[0]={$row[0]}<br>";
$data[$j][$instance] += $row[0]+0;
//echo "<br>data[$j][$instance]={$data[$j][$instance]}<br>";
}
}
}
return $data;
}
?>
</head>
<body onload="javascript:adjust();" onresize="javascript:adjust();" leftmargin="15" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;">
<?php
$slot=$sel_date_from-$sel_date_to+1;
$startTime=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
$endTime=date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-$sel_date_to,date("Y")));
$dataTable="CSTA_DB.mscDetailData";
$start=strtotime($startTime);
$end=strtotime($endTime);
$num=0;
$num1=0;
$data1=Getdata($filelist,$startTime,$endTime);
for($j=1;$j < 13;$j++)
{
if(strcmp($filelist[$j][name]," "))
{
$num++;
$num1++;
}
}
//table <20><><EFBFBD><EFBFBD>
{
$table_title="MT,MO Erlang Statistic&nbsp;&nbsp;Date:";
if($slot>1)
$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")))." to ".date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
else
$table_title.=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
echo "<br><b><center>$table_title</center></b>";
echo "<table width=\"100%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td>&nbsp</td>";
if($num !=0)
{
if($merge==1)
{
$num+=1;
}
}
if($num==0)
{
if($merge==1)
{
$num=1;
}
}
echo "<td colspan=$num align=\"center\">Erlang</td>";
echo "</tr>";
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td align=\"center\" >Time</td>";
for($j=1;$j < 13;$j++)
{
//echo "filelist[$j][name]={$filelist[$j][name]}<br>";
if(strcmp($filelist[$j][name]," "))
{
//echo "55555555555555555555555555555555555<br>";
echo "<td align=\"center\" >{$filelist[$j][name]}</td>";
}
}
if($num1==0)
{
echo "<td align=\"center\" >--</td>";
}
else if($num==1)
{
if($merge!=0)
{
echo "<td align=\"center\" >--</td>";
}
}
else if($merge==1)
{
echo "<td align=\"center\" >total</td>";
}
for($i=$sel_date_to,$k=($slot-1);$i <=($sel_date_to+($slot-1));$i++,$k--)
{
echo "<tr>";
$now=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y")));
echo "<td align=\"center\" width=\"10%\">{$now}</td>";
for($j=1;$j<13;$j++)
{
if(strcmp($filelist[$j][name]," "))
{
echo "<td align=\"center\">{$data1[$j][$k]}</td>";
$total+=$data1[$j][$k];
}
}
if($num==1)
{
if($merge==1)
{
echo "<td align=\"center\" >--</td>";
}
}
else
{
if($merge==1)
{
echo "<td align=\"center\">$total</td>";
$total=0;
}
}
if($num1==0)
{
if($merge==0)
{
echo "<td align=\"center\" >--</td>";
}
}
echo "</tr>";
}
echo "</table>";
}
//ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$day=$sel_date_from-$sel_date_to+1;
$day_num=720/($day+1);
//<2F><>ͼ
//
//=======================================================================================|
//=========== Draw the Graphics =============|
//=======================================================================================|
$sizex=800;
if($csta_type==0)
$sizey=430;
else
$sizey=380;
$bgcolor=F8F8F8;
$fgcolor=000000;
$im = ImageCreate ($sizex, $sizey);
$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)));
$black_color=ImageColorAllocate($im,0,0,0);
$white_color=ImageColorAllocate($im,255,255,255);
//===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);
//===border=====
$xBgn=60;
$yBgn=25;
$xEnd=780;
$yEnd=275;
$unitXPix=30;
ImageLine($im, $xBgn, $yBgn, $xBgn, $yEnd, $text_color);
ImageLine($im, $xBgn, $yBgn, $xEnd, $yBgn, $text_color);
ImageLine($im, $xBgn, $yEnd, $xEnd, $yEnd, $text_color);
ImageLine($im, $xEnd, $yBgn, $xEnd, $yEnd, $text_color);
//===draw the label block====
$color[1]=ImageColorAllocate($im,0x99,0x22,0x33);
$color[2]=ImageColorAllocate($im,0x99,0x00,0xcc);
$color[3]=ImageColorAllocate($im,0x99,0x99,0x00);
$color[4]=ImageColorAllocate($im,0x99,0x99,0x99);
$color[5]=ImageColorAllocate($im,0x99,0xff,0x33);
$color[6]=ImageColorAllocate($im,0xff,0x99,0x66);
$color[7]=ImageColorAllocate($im,0xff,0x00,0x00);
$color[8]=ImageColorAllocate($im,0xff,0xff,0x00);
$color[9]=ImageColorAllocate($im,0x33,0x3,0x33);
$color[10]=ImageColorAllocate($im,0x00,0xcc,0xff);
$color[11]=ImageColorAllocate($im,0x00,0x22,0xcc);
$color[12]=ImageColorAllocate($im,0xEE,0x00,0xff);
for($k=1;$k < 13;$k++)
{
if(strcmp($filelist[$k][name]," "))
{
for($i=0,$j=($slot-1);$i<($slot);$i++,$j--)
{
$out_put[$k][$i][x]=(780-$i*($day_num)-$day_num);
$out_put[$k][$i][y]=(275-$data1[$k][$j]*25);
}
}
}
for($i=$sel_date_to,$k=0;$i<($sel_date_from+1);$i++,$k++)
{
$datestr[$k]=date("m-d",mktime(0,0,0,date("m"),date("d")-$i,date("Y")));
}
//////<2F><><EFBFBD><EFBFBD>
for($i=0;$i<$day;$i++)
{
$style = array($black_color, $black_color, $black_color, $black_color, $red, $w, $w, $w, $w, $w);
imagesetstyle($im, $style);
imageline($im, ($xEnd - $i*($day_num)-$day_num), $yBgn, ($xEnd - $i*($day_num)-$day_num), $yEnd, IMG_COLOR_STYLED);
$xstr=$datestr[$i];
Imagestringup($im, 2, ($xEnd - $i*($day_num)-$day_num) - 4, $yEnd+60, $xstr, $style);
//if($i==29)
//Imagestringup($im, 2, $xBgn + $i*24 - 4, $yEnd+60, $datestr[29], $style);
}
//<2F><><EFBFBD><EFBFBD>
for($i=0,$k=10;$i<10;$i++,$k--)
{
$displayMaxData=$k;
imagesetstyle($im, $style);
//imageline($im,$xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, IMG_COLOR_STYLED);
if($i!=0)
imageline($im,$xBgn , $yBgn+$i*25, $xEnd, $yBgn+$i*25, IMG_COLOR_STYLED);
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "$displayMaxData", $black_color);
}
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, "0", $black_color);
///////////////////////////////////////////////////////////////////////
//<2F><><EFBFBD><EFBFBD>
for($k=1;$k < 13;$k++)
{
if(strcmp($filelist[$k][name]," "))
{
for($i=0;$i<($slot);$i++)
{
if($i > 0)
{
imageline($im,$out_put[$k][$i-1][x],$out_put[$k][$i-1][y],$out_put[$k][$i][x],$out_put[$k][$i][y],$color[$k]);
}
}
}
}
//====graphics title=====
//$graphics_title="Service erlang statistic graphic";
//Imagestring($im, 2, 300,5, $graphics_title, $text_color);
//===draw the label block====
$color[1]=ImageColorAllocate($im,0x99,0x22,0x33);
$color[2]=ImageColorAllocate($im,0x99,0x00,0xcc);
$color[3]=ImageColorAllocate($im,0x99,0x99,0x00);
$color[4]=ImageColorAllocate($im,0x99,0x99,0x99);
$color[5]=ImageColorAllocate($im,0x99,0xff,0x33);
$color[6]=ImageColorAllocate($im,0xff,0x99,0x66);
$color[7]=ImageColorAllocate($im,0xff,0x00,0x00);
$color[8]=ImageColorAllocate($im,0xff,0xff,0x00);
$color[9]=ImageColorAllocate($im,0x33,0x3,0x33);
$color[10]=ImageColorAllocate($im,0x00,0xcc,0xff);
$color[11]=ImageColorAllocate($im,0x00,0x22,0xcc);
$color[12]=ImageColorAllocate($im,0xEE,0x00,0xff);
imagefilledrectangle($im,90,350,100,360,$color[1]);
imagestring($im,2,105,350,"SUB SUB",$text_color);
imagefilledrectangle($im,260,350,270,360,$color[2]);
imagestring($im,2,275,350,"SUB TRK",$text_color);
imagefilledrectangle($im,430,350,440,360,$color[3]);
imagestring($im,2,445,350,"TRK SUB",$text_color);
imagefilledrectangle($im,600,350,610,360,$color[5]);
imagestring($im,2,615,350,"TRK TRK",$text_color);
imagefilledrectangle($im,90,370,100,380,$color[6]);
imagestring($im,2,105,370,"INTRA",$text_color);
imagefilledrectangle($im,260,370,270,380,$color[7]);
imagestring($im,2,275,370,"SUB IP",$text_color);
imagefilledrectangle($im,430,370,440,380,$color[4]);
imagestring($im,2,445,370,"TRK IP",$text_color);
imagefilledrectangle($im,600,370,610,380,$color[9]);
imagestring($im,2,615,370,"MO",$text_color);
imagefilledrectangle($im,90,390,100,400,$color[10]);
imagestring($im,2,105,390,"MT",$text_color);
imagefilledrectangle($im,260,390,270,400,$color[11]);
imagestring($im,2,275,390,"IN TRK",$text_color);
imagefilledrectangle($im,430,390,440,400,$color[12]);
imagestring($im,2,445,390,"OUT TRK",$text_color);
imagefilledrectangle($im,600,390,610,400,$color[8]);
imagestring($im,2,615,390,"IP",$text_color);
//////////////////////////////////////////////////////
////////////////////////////////////////////////////////
//-----<2D><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>
//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);
}
$tt=time()-4000;
$filename=$tt.".png";
if(1)
{
ImagePng ($im,"$filename");
ImageDestroy($im);
}
//-----<2D><>ʾͼƬ
flush();
echo "</form>";
echo "<img src=\"$filename\"></img>";
adjust_content_tail();
?>
</body>