nothing, 1 => sql result, 2 => boucle checking, 3 other value checking)
$FG_DEBUG = 0;
// The variable FG_TABLE_NAME define the table name to use
$FG_TABLE_NAME=DB_TABLENAME;
// THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE
$FG_TABLE_HEAD_COLOR = "#D1D9E7";
$FG_TABLE_EXTERN_COLOR = "#7F99CC"; //#CC0033 (Rouge)
$FG_TABLE_INTERN_COLOR = "#EDF3FF"; //#FFEAFF (Rose)
// THIS VARIABLE DEFINE THE COLOR OF THE HEAD TABLE
$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#FFFFFF";
$FG_TABLE_ALTERNATE_ROW_COLOR[] = "#F2F8FF";
//$link = DbConnect();
$DBHandle = DbConnect();
// The variable Var_col would define the col that we want show in your table
// First Name of the column in the html page, second name of the field
$FG_TABLE_COL = array();
/*******
Calldate Clid Src Dst Dcontext Channel Dstchannel Lastapp Lastdata Duration Billsec Disposition Amaflags Accountcode Uniqueid Serverid
*******/
$FG_TABLE_COL[]=array ("Calldate", "calldate", "18%", "center", "SORT", "19");
$FG_TABLE_COL[]=array ("Channel", "channel", "13%", "center", "", "30");
$FG_TABLE_COL[]=array ("Source", "src", "10%", "center", "", "30");
$FG_TABLE_COL[]=array ("Clid", "clid", "12%", "center", "", "30");
$FG_TABLE_COL[]=array ("Lastapp", "lastapp", "8%", "center", "", "30");
$FG_TABLE_COL[]=array ("Lastdata", "lastdata", "12%", "center", "", "30");
$FG_TABLE_COL[]=array ("Dst", "dst", "9%", "center", "SORT", "30");
//$FG_TABLE_COL[]=array ("Serverid", "serverid", "10%", "center", "", "30");
$FG_TABLE_COL[]=array ("Disposition", "disposition", "9%", "center", "", "30");
$FG_TABLE_COL[]=array ("Duration", "duration", "6%", "center", "SORT", "30");
$FG_TABLE_DEFAULT_ORDER = "calldate";
$FG_TABLE_DEFAULT_SENS = "DESC";
// This Variable store the argument for the SQL query
$FG_COL_QUERY='calldate, channel, src, clid, lastapp, lastdata, dst, disposition, duration';
//$FG_COL_QUERY='calldate, channel, src, clid, lastapp, lastdata, dst, serverid, disposition, duration';
$FG_COL_QUERY_GRAPH='calldate, duration';
// The variable LIMITE_DISPLAY define the limit of record to display by page
$FG_LIMITE_DISPLAY=25;
// Number of column in the html table
$FG_NB_TABLE_COL=count($FG_TABLE_COL);
// The variable $FG_EDITION define if you want process to the edition of the database record
$FG_EDITION=true;
//This variable will store the total number of column
$FG_TOTAL_TABLE_COL = $FG_NB_TABLE_COL;
if ($FG_DELETION || $FG_EDITION) $FG_TOTAL_TABLE_COL++;
//This variable define the Title of the HTML table
$FG_HTML_TABLE_TITLE=" - Call Logs - ";
//This variable define the width of the HTML table
$FG_HTML_TABLE_WIDTH="90%";
if ($FG_DEBUG == 3) echo "
Table : $FG_TABLE_NAME - Col_query : $FG_COL_QUERY";
$instance_table = new Table($FG_TABLE_NAME, $FG_COL_QUERY);
$instance_table_graph = new Table($FG_TABLE_NAME, $FG_COL_QUERY_GRAPH);
if ( is_null ($order) || is_null($sens) ){
$order = $FG_TABLE_DEFAULT_ORDER;
$sens = $FG_TABLE_DEFAULT_SENS;
}
if ($posted==1){
function do_field($sql,$fld){
$fldtype = $fld.'type';
global $$fld;
global $$fldtype;
if (isset($$fld) && ($$fld!='')){
if (strpos($sql,'WHERE') > 0){
$sql = "$sql AND ";
}else{
$sql = "$sql WHERE ";
}
$sql = "$sql $fld";
if (isset ($$fldtype)){
switch ($$fldtype) {
case 1: $sql = "$sql='".$$fld."'"; break;
case 2: $sql = "$sql LIKE '".$$fld."%'"; break;
case 3: $sql = "$sql LIKE '%".$$fld."%'"; break;
case 4: $sql = "$sql LIKE '%".$$fld."'";
}
}else{ $sql = "$sql LIKE '%".$$fld."%'"; }
}
return $sql;
}
$SQLcmd = '';
if ($_POST['before']) {
if (strpos($SQLcmd, 'WHERE') > 0) { $SQLcmd = "$SQLcmd AND ";
}else{ $SQLcmd = "$SQLcmd WHERE "; }
$SQLcmd = "$SQLcmd calldate<'".addslashes($_POST['before'])."'";
}
if ($_POST['after']) { if (strpos($SQLcmd, 'WHERE') > 0) { $SQLcmd = "$SQLcmd AND ";
} else { $SQLcmd = "$SQLcmd WHERE "; }
$SQLcmd = "$SQLcmd calldate>'".addslashes($_POST['after'])."'";
}
$SQLcmd = do_field($SQLcmd, 'clid');
$SQLcmd = do_field($SQLcmd, 'src');
$SQLcmd = do_field($SQLcmd, 'dst');
$SQLcmd = do_field($SQLcmd, 'channel');
$SQLcmd = do_field($SQLcmd, 'userfield');
$SQLcmd = do_field($SQLcmd, 'accountcode');
}
$date_clause='';
// Period (Month-Day)
if (!isset($fromstatsday_sday)){
$fromstatsday_sday = date("d");
$fromstatsmonth_sday = date("Y-m");
}
//if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND calldate <= '$fromstatsmonth_sday-$fromstatsday_sday+23' AND calldate >= SUBDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL $days_compare DAY)";
if (DB_TYPE == "postgres"){
if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND calldate < date'$fromstatsmonth_sday-$fromstatsday_sday'+ INTERVAL '1 DAY' AND calldate >= date'$fromstatsmonth_sday-$fromstatsday_sday'";
}else{
if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND calldate < ADDDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL 1 DAY) AND calldate >= '$fromstatsmonth_sday-$fromstatsday_sday'";
}
if ($FG_DEBUG == 3) echo "
$date_clause
";
if (strpos($SQLcmd, 'WHERE') > 0) {
$FG_TABLE_CLAUSE = substr($SQLcmd,6).$date_clause;
}elseif (strpos($date_clause, 'AND') > 0){
$FG_TABLE_CLAUSE = substr($date_clause,5);
}
/* --AMP BEGIN-- */
//enforce restrictions for this AMP User
session_start();
$AMP_CLAUSE = $_SESSION['AMP_SQL'];
if (!isset($AMP_CLAUSE)) {
$AMP_CLAUSE = " AND src = 'NeverReturnAnything'";
}
$FG_TABLE_CLAUSE .= $AMP_CLAUSE;
/* --AMP END-- */
if ($_POST['posted']==1){
//> function Get_list ($clause=null, $order=null, $sens=null, $field_order_letter=null, $letters = null, $limite=null, $current_record = NULL)
$list = $instance_table -> Get_list ($FG_TABLE_CLAUSE, $order, $sens, null, null, $FG_LIMITE_DISPLAY, $current_page*$FG_LIMITE_DISPLAY);
$list_total = $instance_table_graph -> Get_list ($FG_TABLE_CLAUSE, null, null, null, null, null, null);
}
if ($FG_DEBUG == 3) echo "
Clause : $FG_TABLE_CLAUSE";
//$nb_record = $instance_table -> Table_count ($FG_TABLE_CLAUSE);
$nb_record = count($list_total);
if ($FG_DEBUG >= 1) var_dump ($list);
if ($nb_record<=$FG_LIMITE_DISPLAY){
$nb_record_max=1;
}else{
$nb_record_max=(intval($nb_record/$FG_LIMITE_DISPLAY)+1);
}
if ($FG_DEBUG == 3) echo "
Nb_record : $nb_record";
if ($FG_DEBUG == 3) echo "
Nb_record_max : $nb_record_max";
?>
0){
$table_graph=array();
$table_graph_hours=array();
$numm=0;
foreach ($list_total as $recordset){
$numm++;
$mydate= substr($recordset[0],0,10);
$mydate_hours= substr($recordset[0],0,13);
//echo "$mydate
";
if (is_array($table_graph_hours[$mydate_hours])){
$table_graph_hours[$mydate_hours][0]++;
$table_graph_hours[$mydate_hours][1]=$table_graph_hours[$mydate_hours][1]+$recordset[1];
}else{
$table_graph_hours[$mydate_hours][0]=1;
$table_graph_hours[$mydate_hours][1]=$recordset[1];
}
if (is_array($table_graph[$mydate])){
$table_graph[$mydate][0]++;
$table_graph[$mydate][1]=$table_graph[$mydate][1]+$recordset[1];
}else{
$table_graph[$mydate][0]=1;
$table_graph[$mydate][1]=$recordset[1];
}
}
$mmax=0;
$totalcall==0;
$totalminutes=0;
foreach ($table_graph as $tkey => $data){
if ($mmax < $data[1]) $mmax=$data[1];
$totalcall+=$data[0];
$totalminutes+=$data[1];
}
?>
|
ASTERISK MINUTES |
| DATE |
DURATION |
GRAPHIC |
CALLS |
ACT |
$data){
$i=($i+1)%2;
$tmc = $data[1]/$data[0];
$tmc_60 = sprintf("%02d",intval($tmc/60)).":".sprintf("%02d",intval($tmc%60));
$minutes_60 = sprintf("%02d",intval($data[1]/60)).":".sprintf("%02d",intval($data[1]%60));
$widthbar= intval(($data[1]/$mmax)*200);
//bgcolor="#336699"
?>
|
|
|
|
|
| TOTAL |
|
|
|
|
Select the hour interval to see the details
No calls in your selection.