1042 lines
37 KiB
PHP
Executable File
1042 lines
37 KiB
PHP
Executable File
<?php
|
||
require("../../inc/header.inc");
|
||
?>
|
||
|
||
<script language="JavaScript">
|
||
function page_refresh()
|
||
{
|
||
//sel_date_from,sel_date_to,scroll_y,on_top_index
|
||
|
||
var down_date_from=parent.e1_detail_up.document.myform.sel_date_from.value;
|
||
var down_date_to=parent.e1_detail_up.document.myform.sel_date_to.value;
|
||
var e1no=parent.e1_detail_up.document.myform.e1_no.value;
|
||
var in_out=parent.e1_detail_up.document.myform.sel_in_out.value;
|
||
var on_top=document.myform.on_top_index.value;
|
||
var on_top_down=document.myform.on_top_index_down.value;
|
||
var scrolly=document.body.scrollTop;
|
||
if(down_date_from<=down_date_to)
|
||
down_date_to=down_date_from;
|
||
|
||
if(document.myform.answer_checkbox.checked==1)
|
||
answer_check=1;
|
||
else
|
||
answer_check=0;
|
||
|
||
if(document.myform.call_clear_checkbox.checked==1)
|
||
call_clear_check=1;
|
||
else
|
||
call_clear_check=0;
|
||
|
||
if(document.myform.no_answer_checkbox.checked==1)
|
||
no_answer_check=1;
|
||
else
|
||
no_answer_check=0;
|
||
|
||
if(document.myform.sub_busy_checkbox.checked==1)
|
||
sub_busy_check=1;
|
||
else
|
||
sub_busy_check=0;
|
||
|
||
if(document.myform.network_busy_checkbox.checked==1)
|
||
network_busy_check=1;
|
||
else
|
||
network_busy_check=0;
|
||
|
||
if(document.myform.call_barred_checkbox.checked==1)
|
||
call_barred_check=1;
|
||
else
|
||
call_barred_check=0;
|
||
|
||
if(document.myform.signalling_timeout_checkbox.checked==1)
|
||
signalling_timeout_check=1;
|
||
else
|
||
signalling_timeout_check=0;
|
||
var check_group='&answer_check='+answer_check+'&call_clear_check='+call_clear_check+'&no_answer_check='+no_answer_check+'&sub_busy_check='+sub_busy_check+'&network_busy_check='+network_busy_check+'&call_barred_check='+call_barred_check+'&signalling_timeout_check='+signalling_timeout_check;
|
||
|
||
|
||
//alert(ser_type);
|
||
var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&e1_no='+e1no+"&on_top_index="+on_top+"&scroll_y="+scrolly+"&sel_in_out="+in_out+"&on_top_index_down="+on_top_down+check_group;
|
||
window.location.href=urll;
|
||
|
||
}
|
||
</script>
|
||
|
||
|
||
<?php
|
||
//=======scroll the page=====
|
||
if($scroll_y > 0){
|
||
echo "<body style=\"overflow-x:hidden\" topmargin=\"5\" leftmargin=\"12\" onLoad='self.scrollBy(0,$scroll_y)'>";
|
||
}else{
|
||
echo "<body style=\"overflow-x:hidden\" topmargin=\"5\" leftmargin=\"12\">";
|
||
}
|
||
?>
|
||
<form name="myform" action="e1_detail_down.php">
|
||
|
||
<?php
|
||
//========================================================================================|
|
||
//========================Initial The Data From Index Page================================|
|
||
//========================================================================================|
|
||
if(!isset($sel_date_from))
|
||
$sel_date_from=0;
|
||
if(!isset($sel_date_to))
|
||
$sel_date_to=0;
|
||
if(!isset($trunk_no))
|
||
$trunk_no=0;
|
||
if(!isset($sel_in_out))
|
||
$sel_in_out=0;
|
||
if(!isset($on_top_index))
|
||
$on_top_index=0;
|
||
|
||
if(!isset($answer_check))
|
||
$answer_check=1;
|
||
if(!isset($call_clear_check))
|
||
$call_clear_check=1;
|
||
if(!isset($no_answer_check))
|
||
$no_answer_check=1;
|
||
if(!isset($sub_busy_check))
|
||
$sub_busy_check=1;
|
||
if(!isset($network_busy_check))
|
||
$network_busy_check=1;
|
||
if(!isset($call_barred_check))
|
||
$call_barred_check=1;
|
||
if(!isset($signalling_timeout_check))
|
||
$signalling_timeout_check=1;
|
||
//========================================================================================|
|
||
//===========================Define the Data==============================================|
|
||
//========================================================================================|
|
||
$slot=$sel_date_from-$sel_date_to+1;
|
||
for($i=0;$i<9;$i++)
|
||
{
|
||
for($j=0;$j<24*$slot;$j++)
|
||
{
|
||
$csta_e1[$i][$j]=0;
|
||
}
|
||
}
|
||
//========================================================================================|
|
||
//==============================Get the data from DB======================================|
|
||
//========================================================================================|
|
||
$db=$csta_db;
|
||
$slot=$sel_date_from-$sel_date_to+1;
|
||
$time_column="csta_datetime";
|
||
|
||
for($day=0;$day<$slot;$day++)
|
||
{
|
||
$table_name="mscSum";
|
||
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
|
||
$table_name=$table_name."_".$temp;
|
||
$from_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
|
||
$to_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day+1,date("Y")));
|
||
//echo "sel_in_out:$sel_in_out<br>";
|
||
$select="select key_e1_tg,sum(Attempt) as attempt,sum(Normal) as success,sum(CallDeny) as call_deny,sum(NetBusy) as net_busy,sum(CallerClear) as caller_clear,sum(SubBusy) as sub_busy,sum(NoAnswer) as no_answer,sum(SignalErr) as signal_error,sum(Duration) as duration,csta_datetime,key_sys_id,key_subsys_id ";
|
||
$from="from $table_name ";
|
||
|
||
//=====in-e1 data======
|
||
if($sel_in_out==0)
|
||
{
|
||
$e1_where="and key_type=1 ";
|
||
}
|
||
//====out-e1 data=======
|
||
else if($sel_in_out==1)
|
||
{
|
||
$e1_where="and key_type=2 ";
|
||
}
|
||
//===total-e1 data=====
|
||
else if($sel_in_out==2)
|
||
{
|
||
$e1_where="and key_type>0 and key_type<3 ";
|
||
}
|
||
|
||
//echo "e1_no:$e1_no<br>";
|
||
if($e1_no>127)
|
||
{
|
||
$msc_no=1;
|
||
$e1_no_tmp=$e1_no-128;
|
||
}
|
||
else
|
||
{
|
||
$msc_no=0;
|
||
$e1_no_tmp=$e1_no;
|
||
}
|
||
|
||
$where="where $time_column >'$from_time' and $time_column <='$to_time' and key_sys_id=$msc_no and key_e1_tg=$e1_no_tmp ".$e1_where;
|
||
$group="group by csta_datetime ";
|
||
$order="order by csta_datetime ";
|
||
$sql=$select.$from.$where.$group.$order;
|
||
//echo "$sql<br>";
|
||
$result=@mysqli_query($pubConn,$sql);
|
||
$rows=@mysqli_fetch_array($result);
|
||
if(!$rows)
|
||
continue;
|
||
do{
|
||
$datetime=substr($rows[csta_datetime],11,2)+0;
|
||
|
||
for($tt=0;$tt<9;$tt++)
|
||
{
|
||
$csta_e1[$tt][$datetime+$day*24]+=$rows[$tt+1];
|
||
}
|
||
}while($rows=mysqli_fetch_array($result));
|
||
}
|
||
|
||
//========================================================================================|
|
||
//==============================Fake Data for Test========================================|
|
||
//========================================================================================|
|
||
if(0)
|
||
{
|
||
for($i=0;$i<9;$i++)
|
||
{
|
||
for($j=0;$j<24*$slot;$j++)
|
||
{
|
||
if($i==0)
|
||
$csta_e1[$i][$j]=rand(200,300);
|
||
else
|
||
$csta_e1[$i][$j]=rand(10,100);
|
||
}
|
||
}
|
||
}
|
||
//========================================================================================|
|
||
//====================================Test Data===========================================|
|
||
//========================================================================================|
|
||
if(0)
|
||
{
|
||
for($i=0;$i<9;$i++)
|
||
{
|
||
for($j=0;$j<24*$slot;$j++)
|
||
{
|
||
if(!isset($csta_e1[$i][$j]))
|
||
$csta_e1[$i][$j]=0;
|
||
//echo "type-$i-hour-$j:{$csta_e1[$i][$j]}<br>";
|
||
}
|
||
}
|
||
}
|
||
|
||
//========================================================================================|
|
||
//================================Draw the table-1========================================|
|
||
//========================================================================================|
|
||
//==table title===
|
||
if($slot==1)
|
||
{
|
||
$title_date=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
if($sel_in_out==0)
|
||
{
|
||
$table_title="E1 #".$e1_no." (In) statistic Date:".$title_date;
|
||
}
|
||
else if($sel_in_out==1)
|
||
{
|
||
$table_title="E1 #".$e1_no." (Out) statistic Date:".$title_date;
|
||
}
|
||
else if($sel_in_out==2)
|
||
{
|
||
$table_title="E1 #".$e1_no." (In&Out) statistic Date:".$title_date;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$title_date_from=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$title_date_to=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_to,date("Y")));
|
||
if($sel_in_out==0)
|
||
{
|
||
$table_title="E1 #".$e1_no." (In) statistic Date:".$title_date_from." to ".$title_date_to;
|
||
}
|
||
else if($sel_in_out==1)
|
||
{
|
||
$table_title="E1 #".$e1_no." (Out) statistic Date:".$title_date_from." to ".$title_date_to;
|
||
}
|
||
else if($sel_in_out==2)
|
||
{
|
||
$table_title="E1 #".$e1_no." (In&Out) statistic Date:".$title_date_from." to ".$title_date_to;
|
||
}
|
||
}
|
||
|
||
echo "<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>Time</td>";
|
||
echo "<td>Attempt</td>";
|
||
echo "<td>Success</td>";
|
||
echo "<td><nobr>Call deny</td>";
|
||
echo "<td><nobr>Net busy</td>";
|
||
echo "<td>Caller clear</td>";
|
||
echo "<td>Sub busy</td>";
|
||
echo "<td><nobr>No answer</td>";
|
||
echo "<td>Signal error</td>";
|
||
echo "<td>Total call duration</td>";
|
||
echo "<td>Average call<br>duration(s)</td>";
|
||
echo "</tr>";
|
||
|
||
for($i=0;$i<24*$slot;$i++)
|
||
{
|
||
echo "<tr>";
|
||
//===time column===
|
||
echo "<td>";
|
||
$hour_label=$i%24;
|
||
if($hour_label<10)
|
||
$hour_label="0".$hour_label."H";
|
||
else
|
||
$hour_label=$hour_label."H";
|
||
$day_label=floor($i/24);
|
||
$day_label=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day_label,date("Y")));
|
||
echo "$day_label $hour_label";
|
||
echo "</td>";
|
||
//======attempt column======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[0][$i]}";
|
||
echo "</td>";
|
||
//========Success(answer) column======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[1][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[1][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//=====call deny(barred) column==========
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[2][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[2][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//=====Net busy column=======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[3][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[3][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//===caller clear column======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[4][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[4][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//====sub busy column=======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[5][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[5][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//=====no answer column======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[6][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[6][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//====signal error column======
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[7][$i]}";
|
||
if($csta_e1[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_e1[7][$i]/$csta_e1[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
//======total call duration column=====
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_e1[8][$i]}(s)";
|
||
$hour=floor($csta_e1[8][$i]/3600);
|
||
$minute=floor($csta_e1[8][$i]%3600/60);
|
||
$second=$csta_e1[8][$i]%60;
|
||
if($hour==0&&$minute==0&&$second==0)
|
||
echo "<br>";
|
||
else
|
||
echo "<br>$hour:$minute:$second";
|
||
echo "</td>";
|
||
//======average call duration column====
|
||
echo "<td align=\"center\">";
|
||
if($csta_e1[1][$i]!=0)
|
||
$ave=round($csta_e1[8][$i]/$csta_e1[1][$i]);
|
||
else
|
||
$ave=0;
|
||
echo "$ave";
|
||
echo "</td>";
|
||
echo "</tr>";
|
||
}
|
||
echo "</table>";
|
||
?>
|
||
<?php
|
||
//=======================================================================================|
|
||
//=============================The First on top selection(Hide)==========================|
|
||
//=======================================================================================|
|
||
?>
|
||
<p>
|
||
<select style="display:none" name="on_top_index" size="1" onChange="javascript:page_refresh()">
|
||
<?php
|
||
$on_top_label=array("Answer","Call clear","No answer","Subscriber busy","Network busy","Call barred","Signaling timeout");
|
||
for($i=0;$i<7;$i++)
|
||
{
|
||
if($i==$on_top_index)
|
||
echo "<option value=$i selected>$on_top_label[$i]</option>";
|
||
else
|
||
echo "<option value=$i>$on_top_label[$i]</option>";
|
||
}
|
||
?>
|
||
</select>
|
||
<p>
|
||
|
||
<?php
|
||
//=======================================================================================|
|
||
//===========================show line checkbox==========================================|
|
||
//=======================================================================================|
|
||
echo "<table border=0 width=\"100%\">";
|
||
echo "<tr>";
|
||
if($answer_check==1)
|
||
{
|
||
echo "<td><input name=\"answer_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Answer</td>";
|
||
$draw_line_flag[0]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"answer_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Answer</td>";
|
||
$draw_line_flag[0]=0;
|
||
}
|
||
if($call_barred_check==1)
|
||
{
|
||
echo "<td><input name=\"call_barred_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Call barred</td>";
|
||
$draw_line_flag[1]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"call_barred_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Call barred</td>";
|
||
$draw_line_flag[1]=0;
|
||
}
|
||
if($network_busy_check==1)
|
||
{
|
||
echo "<td><input name=\"network_busy_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Network busy</td>";
|
||
$draw_line_flag[2]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"network_busy_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Network busy</td>";
|
||
$draw_line_flag[2]=0;
|
||
}
|
||
if($call_clear_check==1)
|
||
{
|
||
echo "<td><input name=\"call_clear_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Call clear</td>";
|
||
$draw_line_flag[3]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"call_clear_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Call clear</td>";
|
||
$draw_line_flag[3]=0;
|
||
}
|
||
if($sub_busy_check==1)
|
||
{
|
||
echo "<td><input name=\"sub_busy_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Sub busy</td>";
|
||
$draw_line_flag[4]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"sub_busy_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Sub busy</td>";
|
||
$draw_line_flag[4]=0;
|
||
}
|
||
if($no_answer_check==1)
|
||
{
|
||
echo "<td><input name=\"no_answer_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  No answer</td>";
|
||
$draw_line_flag[5]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"no_answer_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  No answer</td>";
|
||
$draw_line_flag[5]=0;
|
||
}
|
||
|
||
if($signalling_timeout_check==1)
|
||
{
|
||
echo "<td><input name=\"signalling_timeout_checkbox\" type=checkbox checked onClick=\"javascript:page_refresh()\">  Signalling timeout</td>";
|
||
$draw_line_flag[6]=1;
|
||
}
|
||
else
|
||
{
|
||
echo "<td><input name=\"signalling_timeout_checkbox\" type=checkbox onClick=\"javascript:page_refresh()\">  Signalling timeout</td>";
|
||
$draw_line_flag[6]=0;
|
||
}
|
||
echo "</tr>";
|
||
echo "</table>";
|
||
//========================================================================================|
|
||
//==============================Draw the Graphics-1=======================================|
|
||
//========================================================================================|
|
||
$sizex=835;
|
||
$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)));
|
||
|
||
//=====get the block legend color=====
|
||
$color[0]=ImageColorAllocate($im,0x66,0xff,0x33);
|
||
$color[1]=ImageColorAllocate($im,0x66,0xff,0xff);
|
||
$color[2]=ImageColorAllocate($im,0,0x66,0x66);
|
||
$color[3]=ImageColorAllocate($im,0x66,0,0xcc);
|
||
$color[4]=ImageColorAllocate($im,0x66,0x33,0);
|
||
$color[5]=ImageColorAllocate($im,0xcc,0,0x66);
|
||
$color[6]=ImageColorAllocate($im,0xff,0,0);
|
||
$white_color=ImageColorAllocate($im,255,255,255);
|
||
$black_color=ImageColorAllocate($im,0,0,0);
|
||
|
||
//====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 vertical line======
|
||
for($i=0;$i<$slot;$i++)
|
||
{
|
||
$datestr[$i]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$i,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++)
|
||
{
|
||
if($i<10)
|
||
$timearray[$i]="0".$i."h";
|
||
else
|
||
$timearray[$i]=$i."h";
|
||
}
|
||
|
||
if($slot==5)
|
||
{
|
||
if(3>1)
|
||
{
|
||
$tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++){
|
||
ImageDashedLine($im, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
$xstr=$tempd[$i]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($im, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color);
|
||
}
|
||
}
|
||
else if($slot==7)
|
||
{
|
||
if(3>1)
|
||
{
|
||
$tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
$tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
$tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++){
|
||
ImageDashedLine($im, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
$xstr=$tempd[$i]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($im, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$tempi=0;
|
||
|
||
for($i=0;$i<24;$i++){
|
||
|
||
ImageDashedLine($im, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
if(($i*$slot)%24==0&&$i!=0)
|
||
$tempi++;
|
||
$xstr=$datestr[$tempi]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($im, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_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=0;$i<10;$i++){
|
||
if($i!=0)
|
||
imageline($im, $xBgn, $yBgn + $i*25, $xEnd, $yBgn + $i*25, IMG_COLOR_STYLED);
|
||
|
||
$tempstr=(10-$i)*10;
|
||
$tempstr=$tempstr."%";
|
||
Imagestring($im, 2, $xBgn - 50, $yBgn + $i*25 - 5, $tempstr, $text_color);
|
||
}
|
||
|
||
//=======draw the block legend======
|
||
imagefilledrectangle($im,90,350,100,360,$color[0]);
|
||
imagestring($im,2,105,350,"Success",$text_color);
|
||
|
||
imagefilledrectangle($im,180,350,190,360,$color[1]);
|
||
imagestring($im,2,195,350,"Call deny",$text_color);
|
||
|
||
imagefilledrectangle($im,270,350,280,360,$color[2]);
|
||
imagestring($im,2,285,350,"Net busy",$text_color);
|
||
|
||
imagefilledrectangle($im,360,350,370,360,$color[3]);
|
||
imagestring($im,2,375,350,"Caller clear",$text_color);
|
||
|
||
imagefilledrectangle($im,450,350,460,360,$color[4]);
|
||
imagestring($im,2,465,350,"Sub busy",$text_color);
|
||
|
||
imagefilledrectangle($im,540,350,550,360,$color[5]);
|
||
imagestring($im,2,555,350,"No answer",$text_color);
|
||
|
||
imagefilledrectangle($im,630,350,640,360,$color[6]);
|
||
imagestring($im,2,645,350,"Signal error",$text_color);
|
||
|
||
//======get the data line scale======
|
||
for($j=0;$j<7;$j++)
|
||
{
|
||
for($i=0;$i<24*$slot;$i++)
|
||
{
|
||
if($csta_e1[0][$i]!=0)
|
||
$points_scale[$j][$i]['y']=floor(250*$csta_e1[$j+1][$i]/$csta_e1[0][$i]);
|
||
else
|
||
$points_scale[$j][$i]['y']=0;
|
||
$points_scale[$j][$i]['y']=25+250-$points_scale[$j][$i]['y'];
|
||
$points_scale[$j][$i]['x']=60+30*$i/$slot;
|
||
//echo "line-$j-point-$i-x:{$points_scale[$j][$i]['x']}<br>";
|
||
//echo "line-$j-point-$i-y:{$points_scale[$j][$i]['y']}<br>";
|
||
}
|
||
}
|
||
|
||
//=====draw the data line======
|
||
for($i=0;$i<7;$i++)
|
||
{
|
||
if($draw_line_flag[$i]!=0)
|
||
{
|
||
for($j=0;$j<24*$slot-1;$j++)
|
||
{
|
||
imageline($im,$points_scale[$i][$j]['x'],$points_scale[$i][$j]['y'],$points_scale[$i][$j+1]['x'],$points_scale[$i][$j+1]['y'],$color[$i]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
//====draw the on top line againg=====
|
||
for($j=0;$j<24*$slot-1;$j++)
|
||
{
|
||
imageline($im,$points_scale[$on_top_index][$j]['x'],$points_scale[$on_top_index][$j]['y'],$points_scale[$on_top_index][$j+1]['x'],$points_scale[$on_top_index][$j+1]['y'],$color[$on_top_index]);
|
||
}
|
||
*/
|
||
|
||
//====show the graphics=====
|
||
//-----<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()+515;
|
||
$filename="e13_".$tt.".png";
|
||
if(!$DEBUG){
|
||
ImagePng ($im,"$filename");
|
||
ImageDestroy($im);
|
||
}
|
||
//-----<2D><>ʾͼƬ
|
||
echo "<img src=\"$filename\"></img>";
|
||
?>
|
||
|
||
<p>
|
||
<select name="on_top_index_down" size="1" onChange="javascript:page_refresh()">
|
||
<?php
|
||
$on_top_label=array("Total call duration","Average call duration");
|
||
for($i=0;$i<2;$i++)
|
||
{
|
||
if($i==$on_top_index_down)
|
||
echo "<option value=$i selected>$on_top_label[$i]</option>";
|
||
else
|
||
echo "<option value=$i>$on_top_label[$i]</option>";
|
||
}
|
||
?>
|
||
</select>on top
|
||
<p>
|
||
|
||
<?php
|
||
//========================================================================================|
|
||
//=============================Draw the Graphics-2========================================|
|
||
//========================================================================================|
|
||
$sizex=835;
|
||
$sizey=380;
|
||
$bgcolor=F8F8F8;
|
||
$fgcolor=000000;
|
||
|
||
$image = ImageCreate ($sizex, $sizey);
|
||
$color[0]=ImageColorAllocate($image,0x66,0xff,0xff);
|
||
$color[1]=ImageColorAllocate($image,0,0x66,0x66);
|
||
$black_color=ImageColorAllocate($image,0,0,0);
|
||
$white_color=ImageColorAllocate($image,255,255,255);
|
||
$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);
|
||
|
||
//====border======
|
||
$xBgn=60;
|
||
$yBgn=25;
|
||
$xEnd=780;
|
||
$yEnd=275;
|
||
$unitXPix=30;
|
||
ImageLine($image, $xBgn, $yBgn, $xBgn, $yEnd, $text_color);
|
||
ImageLine($image, $xBgn, $yBgn, $xEnd, $yBgn, $text_color);
|
||
ImageLine($image, $xBgn, $yEnd, $xEnd, $yEnd, $text_color);
|
||
ImageLine($image, $xEnd, $yBgn, $xEnd, $yEnd, $text_color);
|
||
|
||
//====draw the vertical line========
|
||
for($i=0;$i<$slot;$i++)
|
||
{
|
||
$datestr[$i]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$i,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++)
|
||
{
|
||
if($i<10)
|
||
$timearray[$i]="0".$i."h";
|
||
else
|
||
$timearray[$i]=$i."h";
|
||
}
|
||
if($slot==5)
|
||
{
|
||
if(3>1)
|
||
{
|
||
$tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++){
|
||
ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
$xstr=$tempd[$i]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color);
|
||
}
|
||
}
|
||
else if($slot==7)
|
||
{
|
||
if(3>1)
|
||
{
|
||
$tempd[0]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[1]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[2]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[3]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$tempd[4]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[5]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[6]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+1,date("Y")));
|
||
$tempd[7]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[8]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[9]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[10]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+2,date("Y")));
|
||
$tempd[11]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[12]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[13]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+3,date("Y")));
|
||
$tempd[14]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[15]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[16]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[17]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+4,date("Y")));
|
||
$tempd[18]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[19]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[20]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+5,date("Y")));
|
||
$tempd[21]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
$tempd[22]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
$tempd[23]=date("m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+6,date("Y")));
|
||
}
|
||
for($i=0;$i<24;$i++){
|
||
ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
$xstr=$tempd[$i]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
$tempi=0;
|
||
|
||
for($i=0;$i<24;$i++){
|
||
|
||
ImageDashedLine($image, $xBgn + $i*30, $yBgn, $xBgn + $i*30, $yEnd, $text_color);
|
||
if(($i*$slot)%24==0&&$i!=0)
|
||
$tempi++;
|
||
$xstr=$datestr[$tempi]." ".$timearray[($i*$slot)%24];
|
||
Imagestringup($image, 2, $xBgn + $i*30 - 4, $yEnd+60, $xstr, $text_color);
|
||
}
|
||
}
|
||
|
||
//=======draw the block legend=======
|
||
imagefilledrectangle($image,90,350,100,360,$color[0]);
|
||
imagestring($image,2,105,350,"Total call duration",$text_color);
|
||
|
||
imagefilledrectangle($image,280,350,290,360,$color[1]);
|
||
imagestring($image,2,295,350,"Average call duration",$text_color);
|
||
|
||
imagestring($image,2,10,5,"Total call duration",$text_color);
|
||
imagestring($image,2,700,5,"Average call duration",$text_color);
|
||
|
||
//======get the biggest y scale of left======
|
||
for($i=0;$i<$slot*24;$i++)
|
||
{
|
||
if($maxYNum_left<$csta_e1[8][$i])
|
||
$maxYNum_left=$csta_e1[8][$i];
|
||
if($csta_e1[1][$i]==0)
|
||
$average[$i]=0;
|
||
else
|
||
$average[$i]=round($csta_e1[8][$i]/$csta_e1[1][$i]);
|
||
if($maxYNum_right<$average[$i])
|
||
$maxYNum_right=$average[$i];
|
||
}
|
||
if($maxYNum_left==0)
|
||
$maxYNum_left=100;
|
||
if($maxYNum_right==0)
|
||
$maxYNum_right=10;
|
||
|
||
//======get the data line scale=====
|
||
for($i=0;$i<$slot*24;$i++)
|
||
{
|
||
//get the total call duration scale
|
||
$total_call_duration_scale[$i]['x']=60+30*$i/$slot;
|
||
$total_call_duration_scale[$i]['y']=floor(250*$csta_e1[8][$i]/$maxYNum_left);
|
||
$total_call_duration_scale[$i]['y']=25+250-$total_call_duration_scale[$i]['y'];
|
||
//get the average call duraiton scale
|
||
$average_call_duration_scale[$i]['x']=60+30*$i/$slot;
|
||
$average_call_duration_scale[$i]['y']=floor(250*$average[$i]/$maxYNum_right);
|
||
$average_call_duration_scale[$i]['y']=25+250-$average_call_duration_scale[$i]['y'];
|
||
//echo "hour-$i:{$total_call_duration_scale[$i]['y']}<br>";
|
||
}
|
||
for($j=0;$j<24*$slot-1;$j++)
|
||
{
|
||
//draw the total duration call data line
|
||
imageline($image,$total_call_duration_scale[$j]['x'],$total_call_duration_scale[$j]['y'],$total_call_duration_scale[$j+1]['x'],$total_call_duration_scale[$j+1]['y'],$color[0]);
|
||
//draw the average duration call data line
|
||
imageline($image,$average_call_duration_scale[$j]['x'],$average_call_duration_scale[$j]['y'],$average_call_duration_scale[$j+1]['x'],$average_call_duration_scale[$j+1]['y'],$color[1]);
|
||
}
|
||
|
||
//======draw the on top data line again======
|
||
if(!isset($on_top_index_down))
|
||
$on_top_index_down=0;
|
||
for($j=0;$j<24*$slot-1;$j++)
|
||
{
|
||
if($on_top_index_down==0)
|
||
{
|
||
//draw the total duration call data line
|
||
imageline($image,$total_call_duration_scale[$j]['x'],$total_call_duration_scale[$j]['y'],$total_call_duration_scale[$j+1]['x'],$total_call_duration_scale[$j+1]['y'],$color[0]);
|
||
}
|
||
else
|
||
{
|
||
//draw the average duration call data line
|
||
imageline($image,$average_call_duration_scale[$j]['x'],$average_call_duration_scale[$j]['y'],$average_call_duration_scale[$j+1]['x'],$average_call_duration_scale[$j+1]['y'],$color[1]);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
//====draw the horizonal line===
|
||
//the left y scale label
|
||
$unit=$maxYNum_left/10;
|
||
$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=0;$i<10;$i++){
|
||
if($i!=0)
|
||
imageline($image, $xBgn, $yBgn + $i*25, $xEnd, $yBgn + $i*25, IMG_COLOR_STYLED);
|
||
$over_minute=floor($unit/60);
|
||
$over_hour=floor($unit/3600);
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵС<D6B5><D0A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||
if($over_minute==0)
|
||
{
|
||
$displayMaxData=(10-$i)*$unit;
|
||
$displayMaxData=number_format($displayMaxData,0,"."," ");
|
||
$displayMaxData=$displayMaxData." s";
|
||
}
|
||
else
|
||
{
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӵ<EFBFBD>С<EFBFBD><D0A1>һ<EFBFBD><D2BB>Сʱ
|
||
if($over_hour==0)
|
||
{
|
||
$displayMaxData=(10-$i)*$unit/60;
|
||
$displayMaxData=number_format($displayMaxData,1,"."," ");
|
||
$displayMaxData=$displayMaxData." min";
|
||
}
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Сʱ
|
||
else
|
||
{
|
||
$displayMaxData=(10-$i)*$unit/3600;
|
||
$displayMaxData=number_format($displayMaxData,2,"."," ");
|
||
$displayMaxData=$displayMaxData." h";
|
||
}
|
||
}
|
||
Imagestring($image, 2, $xBgn - 54, $yBgn + $i*25 - 5, "$displayMaxData", $text_color);
|
||
}
|
||
|
||
//=====the right y scale label===
|
||
$unit=$maxYNum_right/10;
|
||
for($i=0;$i<10;$i++){
|
||
$over_minute=floor($unit/60);
|
||
$over_hour=floor($unit/3600);
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵС<D6B5><D0A1>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||
if($over_minute==0)
|
||
{
|
||
$displayMaxData=(10-$i)*$unit;
|
||
$displayMaxData=number_format($displayMaxData,0,"."," ");
|
||
$displayMaxData=$displayMaxData." s";
|
||
}
|
||
else
|
||
{
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ӵ<EFBFBD>С<EFBFBD><D0A1>һ<EFBFBD><D2BB>Сʱ
|
||
if($over_hour==0)
|
||
{
|
||
$displayMaxData=(10-$i)*$unit/60;
|
||
$displayMaxData=number_format($displayMaxData,1,"."," ");
|
||
$displayMaxData=$displayMaxData." m";
|
||
}
|
||
//Y<><59>ÿ<EFBFBD><C3BF><EFBFBD>Ķ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>Сʱ
|
||
else
|
||
{
|
||
$displayMaxData=(10-$i)*$unit/3600;
|
||
$displayMaxData=number_format($displayMaxData,2,"."," ");
|
||
$displayMaxData=$displayMaxData." h";
|
||
}
|
||
}
|
||
Imagestring($image, 2, $xBgn - 50+780, $yBgn + $i*25 - 5, "$displayMaxData", $text_color);
|
||
}
|
||
|
||
//===show the graphics====
|
||
//-----<2D><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
$tt=time()+1500;
|
||
$filename="e14_".$tt.".png";
|
||
if(!$DEBUG){
|
||
ImagePng ($image,"$filename");
|
||
ImageDestroy($image);
|
||
}
|
||
echo "<p><img src=\"$filename\"></img>";
|
||
?>
|