If show all is used on the export then remove the domain name from the file name.

This commit is contained in:
markjcrane
2016-02-23 19:33:16 -07:00
parent c0ddb2d857
commit 8b2cb82df7
+16 -6
View File
@@ -42,12 +42,22 @@ else {
$rows_per_page = 0; $rows_per_page = 0;
require_once "xml_cdr_inc.php"; require_once "xml_cdr_inc.php";
$export_format = check_str($_REQUEST['export_format']); //get the format
$export_format = check_str($_REQUEST['export_format']);
if ($export_format == 'csv') { //get the format
$showall = check_str($_REQUEST['showall']);
//exprot the csv
if ($export_format == 'csv') {
//define file name //define file name
if ($_REQUEST['showall'] == 'true') {
$csv_filename = "cdr_".date("Ymd_His").".csv";
}
else {
$csv_filename = "cdr_".$_SESSION['domain_name']."_".date("Ymd_His").".csv"; $csv_filename = "cdr_".$_SESSION['domain_name']."_".date("Ymd_His").".csv";
}
//set the http headers //set the http headers
header('Content-type: application/octet-binary'); header('Content-type: application/octet-binary');
@@ -88,11 +98,11 @@ if ($export_format == 'csv') {
if ($x > ($result_count-1)) { if ($x > ($result_count-1)) {
break; break;
} }
//$row++; }
} }
} //export as a PDF
else if ($export_format == 'pdf') { if ($export_format == 'pdf') {
//load pdf libraries //load pdf libraries
require_once("resources/tcpdf/tcpdf.php"); require_once("resources/tcpdf/tcpdf.php");
@@ -274,6 +284,6 @@ else if ($export_format == 'pdf') {
// push pdf download // push pdf download
$pdf -> Output($pdf_filename, 'D'); // Display [I]nline, Save to [F]ile, [D]ownload $pdf -> Output($pdf_filename, 'D'); // Display [I]nline, Save to [F]ile, [D]ownload
} }
?> ?>