📄 call-last-month.php
字号:
<?php /* $Id: call-last-month.php 2413 2006-09-14 03:37:03Z qldrob $ */include_once(dirname(__FILE__) . "/lib/defines.php");include_once(dirname(__FILE__) . "/lib/Class.Table.php");getpost_ifset(array('months_compare', 'current_page', 'fromstatsday_sday', 'fromstatsmonth_sday', 'days_compare', 'min_call', 'posted', 'dsttype', 'sourcetype', 'clidtype', 'channel', 'resulttype', 'stitle', 'atmenu', 'current_page', 'order', 'sens', 'dst', 'src', 'clid', 'userfieldtype', 'userfield', 'accountcodetype', 'accountcode'));if (!isset ($current_page) || ($current_page == "")){ $current_page=0; }// this variable specifie the debug type (0 => 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 "<br>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 ($_POST['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<'".$_POST['before']."'"; } if ($_POST['after']) { if (strpos($SQLcmd, 'WHERE') > 0) { $SQLcmd = "$SQLcmd AND "; } else { $SQLcmd = "$SQLcmd WHERE "; } $SQLcmd = "$SQLcmd calldate>'".mysql_real_escape_string($_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($months_compare)){ $months_compare=2;}//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' - INTERVAL '$days_compare DAY'";}else{ if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) $date_clause.=" AND calldate < ADDDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL 1 DAY) AND calldate >= SUBDATE('$fromstatsmonth_sday-$fromstatsday_sday',INTERVAL $days_compare DAY)"; }if ($FG_DEBUG == 3) echo "<br>$date_clause<br>";/*Monthfromday todayfrommonth tomonth (true)fromstatsmonth tostatsmonthfromstatsday_sdayfromstatsmonth_sdaytostatsday_sdaytostatsmonth_sday*/ 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 Usersession_start();$AMP_CLAUSE = $HTTP_SESSION_VARS['AMP_SQL'];if (!isset($AMP_CLAUSE)) { $AMP_CLAUSE = " AND src = 'NeverReturnAnything'";}$FG_TABLE_CLAUSE .= $AMP_CLAUSE;/* --AMP END-- */if ($FG_DEBUG == 3) echo "<br>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 "<br>Nb_record : $nb_record";if ($FG_DEBUG == 3) echo "<br>Nb_record_max : $nb_record_max";?><script language="JavaScript" type="text/JavaScript"><!--function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features);}//--></script><!-- ** ** ** ** ** Part for the research ** ** ** ** ** --> <center> <FORM METHOD=POST ACTION="<?php echo $_SERVER['PHP_SELF']?>?s=<?php echo $s?>&t=<?php echo $t?>&order=<?php echo $order?>&sens=<?php echo $sens?>¤t_page=<?php echo $current_page?>"> <INPUT TYPE="hidden" NAME="posted" value=1> <table class="bar-status" width="75%" border="0" cellspacing="1" cellpadding="2" align="center"> <tbody> <tr> <td align="left" bgcolor="#000033"> <font face="verdana" size="1" color="#ffffff"><b>Select the Month</b></font> </td> <td align="left" bgcolor="#acbdee"> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#acbdee"><tr><td> <b>From : </b> <select name="fromstatsmonth_sday"> <?php $year_actual = date("Y"); for ($i=$year_actual;$i >= $year_actual-1;$i--) { $monthname = array( "January", "February","March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); if ($year_actual==$i){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -