Add CDR limit
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -45,7 +45,7 @@ else {
|
|||||||
//set the csv headers
|
//set the csv headers
|
||||||
$z = 0;
|
$z = 0;
|
||||||
foreach($result[0] as $key => $val) {
|
foreach($result[0] as $key => $val) {
|
||||||
if ($key != "xml_cdr") {
|
if ($key != "xml" && $key != "json") {
|
||||||
if ($z == 0) {
|
if ($z == 0) {
|
||||||
echo '"'.$key.'"';
|
echo '"'.$key.'"';
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ else {
|
|||||||
while(true) {
|
while(true) {
|
||||||
$z = 0;
|
$z = 0;
|
||||||
foreach($result[0] as $key => $val) {
|
foreach($result[0] as $key => $val) {
|
||||||
if ($key != "xml_cdr") {
|
if ($key != "xml" && $key != "json") {
|
||||||
if ($z == 0) {
|
if ($z == 0) {
|
||||||
echo '"'.$result[$x][$key].'"';
|
echo '"'.$result[$x][$key].'"';
|
||||||
}
|
}
|
||||||
@@ -80,4 +80,5 @@ else {
|
|||||||
//$row++;
|
//$row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
Portions created by the Initial Developer are Copyright (C) 2008-2014
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -191,9 +191,14 @@ else {
|
|||||||
if (strlen($order_by) == 0) { $order_by = "start_epoch"; }
|
if (strlen($order_by) == 0) { $order_by = "start_epoch"; }
|
||||||
if (strlen($order) == 0) { $order = "desc"; }
|
if (strlen($order) == 0) { $order = "desc"; }
|
||||||
|
|
||||||
//set the default
|
//set a default number of rows to show
|
||||||
$num_rows = '0';
|
$num_rows = '0';
|
||||||
|
|
||||||
|
//set a default CDR limit
|
||||||
|
if (!isset($_SESSION['cdr']['limit']['numeric'])) {
|
||||||
|
$_SESSION['cdr']['limit']['numeric'] = 800;
|
||||||
|
}
|
||||||
|
|
||||||
//page results if rows_per_page is greater than zero
|
//page results if rows_per_page is greater than zero
|
||||||
if ($rows_per_page > 0) {
|
if ($rows_per_page > 0) {
|
||||||
//get the number of rows in the v_xml_cdr
|
//get the number of rows in the v_xml_cdr
|
||||||
@@ -211,6 +216,14 @@ else {
|
|||||||
}
|
}
|
||||||
unset($prep_statement, $result);
|
unset($prep_statement, $result);
|
||||||
|
|
||||||
|
//limit the number of results
|
||||||
|
if ($num_rows > $_SESSION['cdr']['limit']['numeric']) {
|
||||||
|
$num_rows = $_SESSION['cdr']['limit']['numeric'];
|
||||||
|
}
|
||||||
|
if ($rows_per_page > $_SESSION['cdr']['limit']['numeric']) {
|
||||||
|
$rows_per_page = $_SESSION['cdr']['limit']['numeric'];
|
||||||
|
}
|
||||||
|
|
||||||
//prepare to page the results
|
//prepare to page the results
|
||||||
//$rows_per_page = 150; //set on the page that includes this page
|
//$rows_per_page = 150; //set on the page that includes this page
|
||||||
$page = $_GET['page'];
|
$page = $_GET['page'];
|
||||||
@@ -222,7 +235,10 @@ else {
|
|||||||
//get the results from the db
|
//get the results from the db
|
||||||
$sql = "select * from v_xml_cdr where domain_uuid = '".$domain_uuid."' ".$sql_where;
|
$sql = "select * from v_xml_cdr where domain_uuid = '".$domain_uuid."' ".$sql_where;
|
||||||
if (strlen($order_by)> 0) { $sql .= " order by ".$order_by." ".$order." "; }
|
if (strlen($order_by)> 0) { $sql .= " order by ".$order_by." ".$order." "; }
|
||||||
if ($rows_per_page > 0) {
|
if ($rows_per_page == 0) {
|
||||||
|
$sql .= " limit ".$_SESSION['cdr']['limit']['numeric']." offset 0 ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
$sql .= " limit ".$rows_per_page." offset ".$offset." ";
|
$sql .= " limit ".$rows_per_page." offset ".$offset." ";
|
||||||
}
|
}
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
|||||||
Reference in New Issue
Block a user