1725 lines
57 KiB
PHP
Executable File
1725 lines
57 KiB
PHP
Executable File
<?php
|
||
require("../../inc/header.inc");
|
||
?>
|
||
|
||
<script language="JavaScript">
|
||
function sel_date_from_change()
|
||
{
|
||
//sel_date_from,sel_date_to,scroll_y,on_top_index1,on_top_index2
|
||
var down_date_from=parent.service_detail_up.document.myform.sel_date_from.value;
|
||
var down_date_to=parent.service_detail_up.document.myform.sel_date_to.value;
|
||
var ser_type=parent.service_detail_up.document.myform.service_type.value;
|
||
var on_top=document.myform.on_top_index.value;
|
||
var on_top_down=document.myform.on_top_index_down.value;
|
||
var scrolly=document.getElementById('content_down').scrollTop;
|
||
if(down_date_from<=down_date_to)
|
||
down_date_to=down_date_from;
|
||
|
||
var check_group;
|
||
|
||
if(ser_type == 1)
|
||
{
|
||
if(document.myform.lu_normal_checkbox.checked==1)
|
||
lu_normal_check=1;
|
||
else
|
||
lu_normal_check=0;
|
||
|
||
if(document.myform.lu_nores_checkbox.checked==1)
|
||
lu_nores_check=1;
|
||
else
|
||
lu_nores_check=0;
|
||
|
||
if(document.myform.lu_noser_checkbox.checked==1)
|
||
lu_noser_check=1;
|
||
else
|
||
lu_noser_check=0;
|
||
|
||
if(document.myform.lu_invser_checkbox.checked==1)
|
||
lu_invser_check=1;
|
||
else
|
||
lu_invser_check=0;
|
||
|
||
if(document.myform.lu_invmsg_checkbox.checked==1)
|
||
lu_invmsg_check=1;
|
||
else
|
||
lu_invmsg_check=0;
|
||
|
||
if(document.myform.lu_sigerr_checkbox.checked==1)
|
||
lu_sigerr_check=1;
|
||
else
|
||
lu_sigerr_check=0;
|
||
|
||
check_group='&lu_normal_check='+lu_normal_check+'&lu_nores_check='+lu_nores_check+'&lu_noser_check='+lu_noser_check+'&lu_invser_check='+lu_invser_check+'&lu_invmsg_check='+lu_invmsg_check+'&lu_sigerr_check='+lu_sigerr_check;
|
||
}
|
||
else if(ser_type == 2 || ser_type == 3)
|
||
{
|
||
if(document.myform.cc_normal_checkbox.checked==1)
|
||
cc_normal_check=1;
|
||
else
|
||
cc_normal_check=0;
|
||
|
||
if(document.myform.cc_calldeny_checkbox.checked==1)
|
||
cc_calldeny_check=1;
|
||
else
|
||
cc_calldeny_check=0;
|
||
|
||
if(document.myform.cc_netbusy_checkbox.checked==1)
|
||
cc_netbusy_check=1;
|
||
else
|
||
cc_netbusy_check=0;
|
||
|
||
if(document.myform.cc_callerclear_checkbox.checked==1)
|
||
cc_callerclear_check=1;
|
||
else
|
||
cc_callerclear_check=0;
|
||
|
||
if(document.myform.cc_subbusy_checkbox.checked==1)
|
||
cc_subbusy_check=1;
|
||
else
|
||
cc_subbusy_check=0;
|
||
|
||
if(document.myform.cc_noanswer_checkbox.checked==1)
|
||
cc_noanswer_check=1;
|
||
else
|
||
cc_noanswer_check=0;
|
||
|
||
if(document.myform.cc_sigerr_checkbox.checked==1)
|
||
cc_sigerr_check=1;
|
||
else
|
||
cc_sigerr_check=0;
|
||
|
||
check_group='&cc_normal_check='+cc_normal_check+'&cc_calldeny_check='+cc_calldeny_check+'&cc_netbusy_check='+cc_netbusy_check+'&cc_callerclear_check='+cc_callerclear_check+'&cc_subbusy_check='+cc_subbusy_check+'&cc_noanswer_check='+cc_noanswer_check+'&cc_sigerr_check='+cc_sigerr_check;
|
||
}
|
||
else if(ser_type == 4 || ser_type == 5)
|
||
{
|
||
if(document.myform.sm_normal_checkbox.checked==1)
|
||
sm_normal_check=1;
|
||
else
|
||
sm_normal_check=0;
|
||
|
||
if(document.myform.sm_suberr_checkbox.checked==1)
|
||
sm_suberr_check=1;
|
||
else
|
||
sm_suberr_check=0;
|
||
|
||
if(document.myform.sm_noser_checkbox.checked==1)
|
||
sm_noser_check=1;
|
||
else
|
||
sm_noser_check=0;
|
||
|
||
if(document.myform.sm_netbusy_checkbox.checked==1)
|
||
sm_netbusy_check=1;
|
||
else
|
||
sm_netbusy_check=0;
|
||
|
||
if(document.myform.sm_msgerr_checkbox.checked==1)
|
||
sm_msgerr_check=1;
|
||
else
|
||
sm_msgerr_check=0;
|
||
|
||
if(document.myform.sm_sigerr_checkbox.checked==1)
|
||
sm_sigerr_check=1;
|
||
else
|
||
sm_sigerr_check=0;
|
||
|
||
if(document.myform.sm_nores_checkbox.checked==1)
|
||
sm_nores_check=1;
|
||
else
|
||
sm_nores_check=0;
|
||
|
||
check_group='&sm_normal_check='+sm_normal_check+'&sm_suberr_check='+sm_suberr_check+'&sm_noser_check='+sm_noser_check+'&sm_netbusy_check='+sm_netbusy_check+'&sm_msgerr_check='+sm_msgerr_check+'&sm_sigerr_check='+sm_sigerr_check+'&sm_nores_check='+sm_nores_check;
|
||
}
|
||
|
||
var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&service_type='+ser_type+"&on_top_index="+on_top+"&scroll_y="+scrolly+"&on_top_index_down="+on_top_down+check_group;
|
||
|
||
window.location.href=urll;
|
||
}
|
||
|
||
function line_select(item,lineOnTop)
|
||
{
|
||
|
||
var down_date_from=parent.service_detail_up.document.myform.sel_date_from.value;
|
||
var down_date_to=parent.service_detail_up.document.myform.sel_date_to.value;
|
||
var ser_type=parent.service_detail_up.document.myform.service_type.value;
|
||
var on_top=document.myform.on_top_index.value;
|
||
var on_top_down=document.myform.on_top_index_down.value;
|
||
var scrolly=document.getElementById('content_down').scrollTop;
|
||
if(down_date_from<=down_date_to)
|
||
down_date_to=down_date_from;
|
||
|
||
lu_normal_check=0;
|
||
lu_nores_check=0;
|
||
lu_noser_check=0;
|
||
lu_invser_check=0;
|
||
lu_invmsg_check=0;
|
||
lu_sigerr_check=0;
|
||
|
||
cc_normal_check=0;
|
||
cc_calldeny_check=0;
|
||
cc_netbusy_check=0;
|
||
cc_callerclear_check=0;
|
||
cc_subbusy_check=0;
|
||
cc_noanswer_check=0;
|
||
cc_sigerr_check=0;
|
||
|
||
sm_normal_check=0;
|
||
sm_suberr_check=0;
|
||
sm_noser_check=0;
|
||
sm_netbusy_check=0;
|
||
sm_msgerr_check=0;
|
||
sm_sigerr_check=0;
|
||
sm_nores_check=0;
|
||
|
||
if(ser_type == 1)
|
||
{
|
||
if(document.myform.lu_normal_checkbox.checked==1)
|
||
lu_normal_check=1;
|
||
else
|
||
lu_normal_check=0;
|
||
|
||
if(document.myform.lu_nores_checkbox.checked==1)
|
||
lu_nores_check=1;
|
||
else
|
||
lu_nores_check=0;
|
||
|
||
if(document.myform.lu_noser_checkbox.checked==1)
|
||
lu_noser_check=1;
|
||
else
|
||
lu_noser_check=0;
|
||
|
||
if(document.myform.lu_invser_checkbox.checked==1)
|
||
lu_invser_check=1;
|
||
else
|
||
lu_invser_check=0;
|
||
|
||
if(document.myform.lu_invmsg_checkbox.checked==1)
|
||
lu_invmsg_check=1;
|
||
else
|
||
lu_invmsg_check=0;
|
||
|
||
if(document.myform.lu_sigerr_checkbox.checked==1)
|
||
lu_sigerr_check=1;
|
||
else
|
||
lu_sigerr_check=0;
|
||
}
|
||
else if(ser_type == 2 || ser_type == 3)
|
||
{
|
||
if(document.myform.cc_normal_checkbox.checked==1)
|
||
cc_normal_check=1;
|
||
else
|
||
cc_normal_check=0;
|
||
|
||
if(document.myform.cc_calldeny_checkbox.checked==1)
|
||
cc_calldeny_check=1;
|
||
else
|
||
cc_calldeny_check=0;
|
||
|
||
if(document.myform.cc_netbusy_checkbox.checked==1)
|
||
cc_netbusy_check=1;
|
||
else
|
||
cc_netbusy_check=0;
|
||
|
||
if(document.myform.cc_callerclear_checkbox.checked==1)
|
||
cc_callerclear_check=1;
|
||
else
|
||
cc_callerclear_check=0;
|
||
|
||
if(document.myform.cc_subbusy_checkbox.checked==1)
|
||
cc_subbusy_check=1;
|
||
else
|
||
cc_subbusy_check=0;
|
||
|
||
if(document.myform.cc_noanswer_checkbox.checked==1)
|
||
cc_noanswer_check=1;
|
||
else
|
||
cc_noanswer_check=0;
|
||
|
||
if(document.myform.cc_sigerr_checkbox.checked==1)
|
||
cc_sigerr_check=1;
|
||
else
|
||
cc_sigerr_check=0;
|
||
}
|
||
else if(ser_type == 4 || ser_type == 5)
|
||
{
|
||
if(document.myform.sm_normal_checkbox.checked==1)
|
||
sm_normal_check=1;
|
||
else
|
||
sm_normal_check=0;
|
||
|
||
if(document.myform.sm_suberr_checkbox.checked==1)
|
||
sm_suberr_check=1;
|
||
else
|
||
sm_suberr_check=0;
|
||
|
||
if(document.myform.sm_noser_checkbox.checked==1)
|
||
sm_noser_check=1;
|
||
else
|
||
sm_noser_check=0;
|
||
|
||
if(document.myform.sm_netbusy_checkbox.checked==1)
|
||
sm_netbusy_check=1;
|
||
else
|
||
sm_netbusy_check=0;
|
||
|
||
if(document.myform.sm_msgerr_checkbox.checked==1)
|
||
sm_msgerr_check=1;
|
||
else
|
||
sm_msgerr_check=0;
|
||
|
||
if(document.myform.sm_sigerr_checkbox.checked==1)
|
||
sm_sigerr_check=1;
|
||
else
|
||
sm_sigerr_check=0;
|
||
|
||
if(document.myform.sm_nores_checkbox.checked==1)
|
||
sm_nores_check=1;
|
||
else
|
||
sm_nores_check=0;
|
||
}
|
||
|
||
var check_group='&lineTop='+lineOnTop+'&lu_normal_check='+lu_normal_check+'&lu_nores_check='+lu_nores_check+'&lu_noser_check='+lu_noser_check+'&lu_invser_check='+lu_invser_check+'&lu_invmsg_check='+lu_invmsg_check+'&lu_sigerr_check='+lu_sigerr_check+'&cc_normal_check='+cc_normal_check+'&cc_calldeny_check='+cc_calldeny_check+'&cc_netbusy_check='+cc_netbusy_check+'&cc_callerclear_check='+cc_callerclear_check+'&cc_subbusy_check='+cc_subbusy_check+'&cc_noanswer_check='+cc_noanswer_check+'&cc_sigerr_check='+cc_sigerr_check+'&sm_normal_check='+sm_normal_check+'&sm_suberr_check='+sm_suberr_check+'&sm_noser_check='+sm_noser_check+'&sm_netbusy_check='+sm_netbusy_check+'&sm_msgerr_check='+sm_msgerr_check+'&sm_sigerr_check='+sm_sigerr_check+'&sm_nores_check='+sm_nores_check;
|
||
var urll='<?php echo"$PHP_SELF";?>?sel_date_from='+down_date_from+'&sel_date_to='+down_date_to+'&service_type='+ser_type+"&on_top_index="+on_top+"&scroll_y="+scrolly+"&on_top_index_down="+on_top_down+check_group;
|
||
|
||
window.location.href=urll;
|
||
}
|
||
|
||
|
||
</script>
|
||
|
||
|
||
<?php
|
||
if($scroll_y > 0){
|
||
//echo "<body style=\"overflow-x:hidden\" topmargin=\"5\" leftmargin=\"12\" onLoad='self.scrollBy(0,$scroll_y)'>";
|
||
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:scroll_div('$scroll_y');javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
|
||
}else{
|
||
echo "<body leftmargin=\"15\" rightmargin=\"10\" onload=\"javascript:adjust_frame('down');\" onresize=\"javascript:adjust_frame('down');\" style=\"overflow:hidden;overflow-x:hidden;overflow-y:hidden;\">";
|
||
}
|
||
?>
|
||
<form name="myform">
|
||
<?php
|
||
adjust_head_frame("down");
|
||
adjust_title_head_frame("down");
|
||
adjust_title_tail_frame("down");
|
||
|
||
adjust_content_head_frame("down");
|
||
echo "<br>";
|
||
|
||
//LU
|
||
if($service_type == 1)
|
||
{
|
||
if(!isset($lu_normal_check))
|
||
$lu_normal_check=0;
|
||
if(!isset($lu_nores_check))
|
||
$lu_nores_check=0;
|
||
if(!isset($lu_noser_check))
|
||
$lu_noser_check=0;
|
||
if(!isset($lu_invser_check))
|
||
$lu_invser_check=0;
|
||
if(!isset($lu_invmsg_check))
|
||
$lu_invmsg_check=0;
|
||
if(!isset($lu_sigerr_check))
|
||
$lu_sigerr_check=0;
|
||
}
|
||
//mo mt
|
||
else if($service_type == 2 || $service_type == 3)
|
||
{
|
||
if(!isset($cc_normal_check))
|
||
$cc_normal_check=0;
|
||
if(!isset($cc_calldeny_check))
|
||
$cc_calldeny_check=0;
|
||
if(!isset($cc_netbusy_check))
|
||
$cc_netbusy_check=0;
|
||
if(!isset($cc_callerclear_check))
|
||
$cc_callerclear_check=0;
|
||
if(!isset($cc_subbusy_check))
|
||
$cc_subbusy_check=0;
|
||
if(!isset($cc_noanswer_check))
|
||
$cc_noanswer_check=0;
|
||
if(!isset($cc_sigerr_check))
|
||
$cc_sigerr_check=0;
|
||
}
|
||
//smo smt
|
||
else if($service_type == 4 || $service_type == 5)
|
||
{
|
||
if(!isset($sm_normal_check))
|
||
$sm_normal_check=0;
|
||
if(!isset($sm_suberr_check))
|
||
$sm_suberr_check=0;
|
||
if(!isset($sm_noser_check))
|
||
$sm_noser_check=0;
|
||
if(!isset($sm_netbusy_check))
|
||
$sm_netbusy_check=0;
|
||
if(!isset($sm_msgerr_check))
|
||
$sm_msgerr_check=0;
|
||
if(!isset($sm_sigerr_check))
|
||
$sm_sigerr_check=0;
|
||
if(!isset($sm_nores_check))
|
||
$sm_nores_check=0;
|
||
|
||
}
|
||
$slot=$sel_date_from-$sel_date_to+1;
|
||
$DEBUG=0;
|
||
|
||
//========================================================================================|
|
||
//========================Data From General Page==========================================|
|
||
//========================================================================================|
|
||
/*
|
||
service_type
|
||
value type
|
||
1 lu
|
||
2 mo
|
||
3 mt
|
||
4 smo
|
||
5 smt
|
||
*/
|
||
if(0)
|
||
{
|
||
echo "sel_date_from:$sel_date_from<br>";
|
||
echo "sel_date_to:$sel_date_to<br>";
|
||
echo "service_type:$service_type<br>";
|
||
}
|
||
//========================================================================================|
|
||
//==========================Define the Data===============================================|
|
||
//========================================================================================|
|
||
for($i=0;$i<23;$i++)
|
||
{
|
||
for($j=0;$j<24*$slot;$j++)
|
||
{
|
||
$csta_data[$i][$j]=0;
|
||
}
|
||
}
|
||
|
||
//========================================================================================|
|
||
//===========================Get The Data From DB=========================================|
|
||
//========================================================================================|
|
||
$detailTableFields=array("Attempt",
|
||
"Success",
|
||
"Duration",
|
||
"lu_normal",
|
||
"lu_res_not_ok",
|
||
"lu_ser_not_ok",
|
||
"lu_ser_no_imp",
|
||
"lu_msg_error",
|
||
"lu_pro_error",
|
||
"cc_normal",
|
||
"cc_call_deny",
|
||
"cc_net_busy",
|
||
"cc_caller_clear",
|
||
"cc_sub_busy",
|
||
"cc_no_answer",
|
||
"cc_sig_error",
|
||
"sm_normal",
|
||
"sm_error_sub",
|
||
"sm_ser_not_ok",
|
||
"sm_net_busy",
|
||
"sm_msg_error",
|
||
"sm_pro_error",
|
||
"sm_res_not_ok"
|
||
);
|
||
$detailTableFieldsSql="";
|
||
for($i=0;$i<sizeof($detailTableFields);$i++)
|
||
{
|
||
$detailTableFieldsSql.="sum(".$detailTableFields[$i].") as ".$detailTableFields[$i];
|
||
if($i<sizeof($detailTableFields)-1)
|
||
$detailTableFieldsSql.=",";
|
||
}
|
||
//echo "$detailTableFieldsSql<br>";
|
||
|
||
$db=$csta_db;
|
||
|
||
for($day=0;$day<$slot;$day++)
|
||
{
|
||
$table_name="ipalimSum";
|
||
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
|
||
$table_name=$table_name."_".$temp;
|
||
//echo "table_name:$table_name<br>";
|
||
$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")));
|
||
|
||
$select="select $detailTableFieldsSql,csta_datetime ";
|
||
$from="from $table_name ";
|
||
$service_where="and key_type=$service_type ";
|
||
$where="where csta_datetime >'$from_time' and csta_datetime <='$to_time' ".$service_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;
|
||
if($datetime==23)
|
||
continue;
|
||
//echo "datetime=$datetime<br>";
|
||
|
||
for($tt=0;$tt<23;$tt++)
|
||
{
|
||
$csta_data[$tt][$datetime+1+$day*24]+=$rows[$tt];
|
||
}
|
||
}while($rows=mysqli_fetch_array($result));
|
||
}
|
||
|
||
//Get the 0-hour of the day
|
||
for($day=0;$day<$slot;$day++)
|
||
{
|
||
$table_name="ipalimSum";
|
||
$temp=date("d",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
|
||
$table_name=$table_name."_".$temp;
|
||
//echo "table_name:$table_name<br>";
|
||
$from_time=date("Y-m-d H:i:s",mktime(23,0,0,date("m"),date("d")-$sel_date_from+$day-1,date("Y")));
|
||
$to_time=date("Y-m-d H:i:s",mktime(0,0,0,date("m"),date("d")-$sel_date_from+$day,date("Y")));
|
||
|
||
//echo "from_time=$from_time,to_time=$to_time<br>";
|
||
$select="select $detailTableFieldsSql,csta_datetime ";
|
||
$from="from $table_name ";
|
||
$service_where="and key_type=$service_type ";
|
||
$where="where csta_datetime >'$from_time' and csta_datetime <='$to_time' ".$service_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);
|
||
//echo "this datetime=$datetime<br>";
|
||
|
||
for($tt=0;$tt<23;$tt++)
|
||
{
|
||
$csta_data[$tt][$day*24]+=$rows[$tt];
|
||
//echo "csta_data[$tt][$day*24]+=rows[$tt]({$rows[$tt]})<br>";
|
||
}
|
||
}while($rows=mysqli_fetch_array($result));
|
||
|
||
}
|
||
|
||
//=======================================================================================|
|
||
//=============================Test the Data=============================================|
|
||
//=======================================================================================|
|
||
$test_label=array("Attempt",
|
||
"Success",
|
||
"Duration",
|
||
"lu_normal",
|
||
"lu_res_not_ok",
|
||
"lu_ser_not_ok",
|
||
"lu_ser_no_imp",
|
||
"lu_msg_error",
|
||
"lu_pro_error",
|
||
"cc_normal",
|
||
"cc_call_deny",
|
||
"cc_net_busy",
|
||
"cc_caller_clear",
|
||
"cc_sub_busy",
|
||
"cc_no_answer",
|
||
"cc_sig_error",
|
||
"sm_normal",
|
||
"sm_error_sub",
|
||
"sm_ser_not_ok",
|
||
"sm_net_busy",
|
||
"sm_msg_error",
|
||
"sm_pro_error",
|
||
"sm_res_not_ok");
|
||
|
||
if(0)
|
||
{
|
||
for($i=0;$i<23;$i++)
|
||
{
|
||
for($j=0;$j<24*$slot;$j++)
|
||
{
|
||
echo "{$test_label[$i]}--Hour-$j--{$csta_data[$i][$j]}<br>";
|
||
}
|
||
}
|
||
}
|
||
|
||
//=======================================================================================|
|
||
//==========================Draw The Table-1=============================================|
|
||
//=======================================================================================|
|
||
|
||
//=====table title======
|
||
$table_name_label=array(
|
||
1=>"LU",
|
||
"Call MO",
|
||
"Call MT",
|
||
"SM MO",
|
||
"SM MT"
|
||
);
|
||
if($slot==1)
|
||
{
|
||
$title_date=date("Y-m-d",mktime(0,0,0,date("m"),date("d")-$sel_date_from,date("Y")));
|
||
$table_title=$table_name_label[$service_type]." 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")));
|
||
$table_title=$table_name_label[$service_type]." statistic Date:".$title_date_from." to ".$title_date_to;
|
||
}
|
||
|
||
echo "<b><center>$table_title</center></b>";
|
||
$LU_TableTitleName=array("Time","Attempt","Success","Normal","No Resource","No Service","Invalid Service","Invalid Message","Signal Error","Duration","Average Duration");
|
||
$CC_TableTitleName=array("Time","Attempt","Success","Normal","Call Deny","Net Busy","Caller Clear","Sub Busy","No Answer","Signal Error","Duration","Average Duration");
|
||
$SM_TableTitleName=array("Time","Attempt","Success","Normal","Sub Error","No Service","Net Busy","Message Error","Signal Error","No Resource","Duration","Average Duration");
|
||
$LU_DataRelation=array(0,1,3,4,5,6,7,8,2);
|
||
$CC_DataRelation=array(0,1,9,10,11,12,13,14,15,2);
|
||
$SM_DataRelation=array(0,1,16,17,18,19,20,21,22,2);
|
||
echo "<table width=\"100%\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\" bgcolor=\"#FFFFFF\">";
|
||
echo "<tr bgcolor=\"#E6E6E6\">";
|
||
//LU
|
||
if($service_type == 1)
|
||
{
|
||
for($i=0;$i<sizeof($LU_TableTitleName);$i++)
|
||
{
|
||
echo "<td align=center>{$LU_TableTitleName[$i]}</td>";
|
||
}
|
||
}
|
||
//Call
|
||
else if($service_type == 2 || $service_type == 3)
|
||
{
|
||
for($i=0;$i<sizeof($CC_TableTitleName);$i++)
|
||
{
|
||
echo "<td align=center>{$CC_TableTitleName[$i]}</td>";
|
||
}
|
||
}
|
||
else if($service_type == 4 || $service_type == 5)
|
||
{
|
||
for($i=0;$i<sizeof($SM_TableTitleName);$i++)
|
||
{
|
||
echo "<td align=center>{$SM_TableTitleName[$i]}</td>";
|
||
}
|
||
}
|
||
echo "</tr>";
|
||
|
||
for($i=0;$i<24*$slot;$i++)
|
||
{
|
||
echo "<tr>";
|
||
//=========time column==============
|
||
echo "<td><nobr>";
|
||
$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>";
|
||
|
||
//LU
|
||
if($service_type == 1)
|
||
{
|
||
for($di=0;$di<sizeof($LU_DataRelation);$di++)
|
||
{
|
||
|
||
//Attempt
|
||
if($di == 0)
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[0][$i]}";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
//Duration
|
||
if($LU_DataRelation[$di] == 2)
|
||
{
|
||
//======total call duration column=====
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[2][$i]}(s)";
|
||
$hour=floor($csta_data[2][$i]/3600);
|
||
$minute=floor($csta_data[2][$i]%3600/60);
|
||
$second=$csta_data[2][$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_data[1][$i]!=0)
|
||
$ave=round($csta_data[2][$i]/$csta_data[1][$i]);
|
||
else
|
||
$ave=0;
|
||
echo "$ave";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[$LU_DataRelation[$di]][$i]}";
|
||
if($csta_data[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_data[$LU_DataRelation[$di]][$i]/$csta_data[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
//Call
|
||
else if($service_type == 2 || $service_type == 3)
|
||
{
|
||
for($di=0;$di<sizeof($CC_DataRelation);$di++)
|
||
{
|
||
|
||
//Attempt
|
||
if($di == 0)
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[0][$i]}";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
//Duration
|
||
if($CC_DataRelation[$di] == 2)
|
||
{
|
||
//======total call duration column=====
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[2][$i]}(s)";
|
||
$hour=floor($csta_data[2][$i]/3600);
|
||
$minute=floor($csta_data[2][$i]%3600/60);
|
||
$second=$csta_data[2][$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_data[1][$i]!=0)
|
||
$ave=round($csta_data[2][$i]/$csta_data[1][$i]);
|
||
else
|
||
$ave=0;
|
||
echo "$ave";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[$CC_DataRelation[$di]][$i]}";
|
||
if($csta_data[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_data[$CC_DataRelation[$di]][$i]/$csta_data[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
echo "</td>";
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
//SM
|
||
else if($service_type == 4 || $service_type == 5)
|
||
{
|
||
for($di=0;$di<sizeof($SM_DataRelation);$di++)
|
||
{
|
||
|
||
//Attempt
|
||
if($di == 0)
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[0][$i]}";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
//Duration
|
||
if($SM_DataRelation[$di] == 2)
|
||
{
|
||
//======total call duration column=====
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[2][$i]}(s)";
|
||
$hour=floor($csta_data[2][$i]/3600);
|
||
$minute=floor($csta_data[2][$i]%3600/60);
|
||
$second=$csta_data[2][$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_data[1][$i]!=0)
|
||
$ave=round($csta_data[2][$i]/$csta_data[1][$i]);
|
||
else
|
||
$ave=0;
|
||
echo "$ave";
|
||
echo "</td>";
|
||
}
|
||
else
|
||
{
|
||
echo "<td align=\"center\">";
|
||
echo "{$csta_data[$CC_DataRelation[$di]][$i]}";
|
||
if($csta_data[0][$i]==0)
|
||
$rate=0;
|
||
else
|
||
{
|
||
$rate=$csta_data[$SM_DataRelation[$di]][$i]/$csta_data[0][$i];
|
||
$rate=$rate*100;
|
||
if($rate!=0&&$rate!=100)
|
||
$rate=number_format($rate, 2, '.', '');
|
||
}
|
||
echo "<br>$rate%";
|
||
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:sel_date_from_change()">
|
||
<?php
|
||
$on_top_label=array("Success","Call clear","No answer","Subscriber busy","Network busy","Call deny","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><!--on top-->
|
||
<p>
|
||
|
||
<?
|
||
//=======================================================================================|
|
||
//===========================show line checkbox==========================================|
|
||
//=======================================================================================|
|
||
echo "<table border=0 width=\"100%\">";
|
||
echo "<tr>";
|
||
|
||
if($service_type == 1)
|
||
{
|
||
//----------Normal
|
||
$index=0;
|
||
if($lu_normal_check == 1)
|
||
{
|
||
echo "<td><input name=\"lu_normal_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Normal</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_normal_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Normal</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
|
||
//----------No Resource
|
||
$index++;
|
||
if($lu_nores_check==1)
|
||
{
|
||
echo "<td><input name=\"lu_nores_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> No Resource</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_nores_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> No Resource</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------No Service
|
||
$index++;
|
||
if($lu_noser_check==1)
|
||
{
|
||
echo "<td><input name=\"lu_noser_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> No Service</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_noser_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> No Service</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Invalid Service
|
||
$index++;
|
||
if($lu_invser_check==1)
|
||
{
|
||
echo "<td><input name=\"lu_invser_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Invalid Service</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_invser_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Invalid Service</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Invalid Message
|
||
$index++;
|
||
if($lu_invmsg_check==1)
|
||
{
|
||
echo "<td><input name=\"lu_invmsg_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Invalid Message</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_invmsg_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Invalid Message</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//---------Signal Error
|
||
$index++;
|
||
if($lu_sigerr_check==1)
|
||
{
|
||
echo "<td><input name=\"lu_sigerr_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"lu_sigerr_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
|
||
}
|
||
else if($service_type == 2 || $service_type == 3)
|
||
{
|
||
//----------Normal
|
||
$index=0;
|
||
if($cc_normal_check == 1)
|
||
{
|
||
echo "<td><input name=\"cc_normal_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Normal</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_normal_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Normal</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
|
||
//----------Call Deny
|
||
$index++;
|
||
if($cc_calldeny_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_calldeny_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Call Deny</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_calldeny_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Call Deny</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Net Busy
|
||
$index++;
|
||
if($cc_netbusy_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_netbusy_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Net Busy</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_netbusy_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Net Busy</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Caller Clear
|
||
$index++;
|
||
if($cc_callerclear_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_callerclear_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Caller Clear</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_callerclear_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Caller Clear</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Sub Busy
|
||
$index++;
|
||
if($cc_subbusy_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_subbusy_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Sub Busy</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_subbusy_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Sub Busy</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//---------No Answer
|
||
$index++;
|
||
if($cc_noanswer_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_noanswer_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> No Answer</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_noanswer_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> No Answer</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//---------Signal Error
|
||
$index++;
|
||
if($cc_sigerr_check==1)
|
||
{
|
||
echo "<td><input name=\"cc_sigerr_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"cc_sigerr_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
}
|
||
else if($service_type == 4 || $service_type == 5)
|
||
{
|
||
//----------Normal
|
||
$index=0;
|
||
if($sm_normal_check == 1)
|
||
{
|
||
echo "<td><input name=\"sm_normal_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Normal</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_normal_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Normal</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Sub Error
|
||
$index++;
|
||
if($sm_suberr_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_suberr_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Sub Error</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_suberr_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Sub Error</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------No Service
|
||
$index++;
|
||
if($sm_noser_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_noser_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> No Service</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_noser_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> No Service</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Net Busy
|
||
$index++;
|
||
if($sm_netbusy_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_netbusy_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Net Busy</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_netbusy_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Net Busy</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//----------Message Error
|
||
$index++;
|
||
if($sm_msgerr_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_msgerr_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Message Error</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_msgerr_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Message Error</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//---------Signal Error
|
||
$index++;
|
||
if($sm_sigerr_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_sigerr_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_sigerr_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> Signal Error</td>";
|
||
$draw_line_flag[$index]=0;
|
||
}
|
||
//---------No Resource
|
||
$index++;
|
||
if($sm_nores_check==1)
|
||
{
|
||
echo "<td><input name=\"sm_nores_checkbox\" type=checkbox checked onClick=\"javascript:line_select(this,0)\"> No Resource</td>";
|
||
$draw_line_flag[$index]=1;
|
||
}
|
||
else
|
||
{
|
||
$lineOnTop=$index;
|
||
echo "<td><input name=\"sm_nores_checkbox\" type=checkbox onClick=\"javascript:line_select(this,$lineOnTop)\"> No Resource</td>";
|
||
$draw_line_flag[$index]=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======
|
||
$black_color=ImageColorAllocate($im,06,0,0);
|
||
$white_color=ImageColorAllocate($im,0xff,0xff,0xff);
|
||
$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);
|
||
//======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 dash 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 dash 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========
|
||
//LU
|
||
if($service_type == 1)
|
||
{
|
||
imagefilledrectangle($im,90,350,100,360,$color[0]);
|
||
imagestring($im,2,105,350,"Normal",$text_color);
|
||
|
||
imagefilledrectangle($im,180,350,190,360,$color[1]);
|
||
imagestring($im,2,195,350,"No Resource",$text_color);
|
||
|
||
imagefilledrectangle($im,270,350,280,360,$color[2]);
|
||
imagestring($im,2,285,350,"No Service",$text_color);
|
||
|
||
imagefilledrectangle($im,360,350,370,360,$color[3]);
|
||
imagestring($im,2,375,350,"Invalid Service",$text_color);
|
||
|
||
imagefilledrectangle($im,470,350,480,360,$color[4]);
|
||
imagestring($im,2,485,350,"Invalid Message",$text_color);
|
||
|
||
imagefilledrectangle($im,580,350,590,360,$color[5]);
|
||
imagestring($im,2,595,350,"Signal Error",$text_color);
|
||
}
|
||
else if($service_type == 2 || $service_type == 3)
|
||
{
|
||
imagefilledrectangle($im,90,350,100,360,$color[0]);
|
||
imagestring($im,2,105,350,"Normal",$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);
|
||
}
|
||
else if($service_type == 4 || $service_type == 5)
|
||
{
|
||
imagefilledrectangle($im,90,350,100,360,$color[0]);
|
||
imagestring($im,2,105,350,"Normal",$text_color);
|
||
|
||
imagefilledrectangle($im,180,350,190,360,$color[1]);
|
||
imagestring($im,2,195,350,"Sub Error",$text_color);
|
||
|
||
imagefilledrectangle($im,270,350,280,360,$color[2]);
|
||
imagestring($im,2,285,350,"No Service",$text_color);
|
||
|
||
imagefilledrectangle($im,360,350,370,360,$color[3]);
|
||
imagestring($im,2,375,350,"Net Busy",$text_color);
|
||
|
||
imagefilledrectangle($im,450,350,460,360,$color[4]);
|
||
imagestring($im,2,465,350,"Message Error",$text_color);
|
||
|
||
imagefilledrectangle($im,545,350,555,360,$color[5]);
|
||
imagestring($im,2,560,350,"Signal Error",$text_color);
|
||
|
||
imagefilledrectangle($im,635,350,645,360,$color[6]);
|
||
imagestring($im,2,650,350,"No Resource",$text_color);
|
||
}
|
||
|
||
//========get the data line scale========
|
||
$LU_DataRelation=array(0,1,3,4,5,6,7,8,2);
|
||
$CC_DataRelation=array(0,1,9,10,11,12,13,14,15,2);
|
||
$SM_DataRelation=array(0,1,16,17,18,19,20,21,22,2);
|
||
|
||
if($service_type == 1)
|
||
$DataReleation=array(3,4,5,6,7,8);
|
||
else if($service_type == 2 || $service_type == 3)
|
||
$DataReleation=array(9,10,11,12,13,14,15);
|
||
else if($service_type == 4 || $service_type == 5)
|
||
$DataReleation=array(16,17,18,19,20,21,22);
|
||
|
||
$csta_count=sizeof($DataReleation);
|
||
|
||
for($j=0;$j<$csta_count;$j++)
|
||
{
|
||
$m_j=$DataReleation[$j];
|
||
for($i=0;$i<24*$slot;$i++)
|
||
{
|
||
if($csta_data[0][$i]!=0)
|
||
$points_scale[$j][$i]['y']=floor(250*$csta_data[$m_j][$i]/$csta_data[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=======
|
||
//echo "on_top_index:$on_top_index<br>";
|
||
for($i=0;$i<$csta_count;$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=========
|
||
//echo "lineTop=$lineTop<br>";
|
||
if($draw_line_flag[$lineTop]==1)
|
||
{
|
||
for($i=0;$i<24*$slot-1;$i++)
|
||
{
|
||
imageline($im,$points_scale[$lineTop][$i]['x'],$points_scale[$lineTop][$i]['y'],$points_scale[$lineTop][$i+1]['x'],$points_scale[$lineTop][$i+1]['y'],$color[$lineTop]);
|
||
imageline($im,$points_scale[$lineTop][$i]['x'],$points_scale[$lineTop][$i]['y']+1,$points_scale[$lineTop][$i+1]['x'],$points_scale[$lineTop][$i+1]['y']+1,$color[$lineTop]);
|
||
imageline($im,$points_scale[$lineTop][$i]['x'],$points_scale[$lineTop][$i]['y']+2,$points_scale[$lineTop][$i+1]['x'],$points_scale[$lineTop][$i+1]['y']+2,$color[$lineTop]);
|
||
|
||
}
|
||
}
|
||
|
||
|
||
//======draw 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()-5500;
|
||
$filename="ser1_".$tt.".png";
|
||
if(1){
|
||
ImagePng ($im,"$filename");
|
||
ImageDestroy($im);
|
||
}
|
||
//-----<2D><>ʾͼƬ
|
||
echo "<img src=\"$filename\"></img>";
|
||
?>
|
||
|
||
|
||
<?php
|
||
//=======================================================================================|
|
||
//======================The second on top selection======================================|
|
||
//=======================================================================================|
|
||
?>
|
||
<p>
|
||
<select name="on_top_index_down" size="1" onChange="javascript:sel_date_from_change()">
|
||
<?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
|
||
|
||
<?php
|
||
//=======================================================================================|
|
||
//===========================Draw The Graphics-2=========================================|
|
||
//=======================================================================================|
|
||
//=====draw the backgroup========
|
||
$sizex=835;
|
||
$sizey=380;
|
||
$bgcolor=F8F8F8;
|
||
$fgcolor=000000;
|
||
|
||
$image = ImageCreate ($sizex, $sizey);
|
||
|
||
$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)));
|
||
|
||
|
||
//=====get the block legend color========
|
||
$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,0xff,0xff,0xff);
|
||
|
||
//====draw the 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);
|
||
|
||
//========draw the 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_data[2][$i])
|
||
$maxYNum_left=$csta_data[2][$i];
|
||
if($csta_data[1][$i]==0)
|
||
$average[$i]=0;
|
||
else
|
||
$average[$i]=round($csta_data[2][$i]/$csta_data[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;
|
||
|
||
|
||
//===draw the horizonal dash line====
|
||
$style = array($black_color,$black_color,$black_color,$black_color,$black_color,$white_color,$white_color,$white_color,$white_color,$white_color);
|
||
$res=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);
|
||
}
|
||
|
||
|
||
//=====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_data[2][$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]);
|
||
}
|
||
}
|
||
|
||
//=======the left y scale label===========
|
||
$unit=$maxYNum_left/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." 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);
|
||
}
|
||
|
||
|
||
//=====draw the graphics======
|
||
//-----<2D><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
$tt=time()+4500;
|
||
$filename="ser2_".$tt.".png";
|
||
if(1){
|
||
ImagePng ($image,"$filename");
|
||
ImageDestroy($image);
|
||
}
|
||
echo "<p><img src=\"$filename\"></img>";
|
||
adjust_content_tail("down");
|
||
?>
|
||
</form>
|