X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=tofile.php;h=c7f81e5024c7bb36f8b08175eff29aee96284e0c;hb=9caad65374f4a83042c7df04d463448affa3443b;hp=299b4a10452593b2ce95044dadf2557b4b811f3c;hpb=05b0f8e4762b8a2ca2002a8f7545b7ff68cc3925;p=timetracker.git diff --git a/tofile.php b/tofile.php index 299b4a10..c7f81e50 100644 --- a/tofile.php +++ b/tofile.php @@ -62,6 +62,9 @@ if ($totals_only) else $items = ttReportHelper::getItems($bean); +// Build a string to use as filename for the files being downloaded. +$filename = strtolower($i18n->getKey('title.report')).'_'.$bean->mValues['start_date'].'_'.$bean->mValues['end_date']; + header('Pragma: public'); // This is needed for IE8 to download files over https. header('Content-Type: text/html; charset=utf-8'); header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); @@ -74,7 +77,7 @@ header('Cache-Control: private', false); // 1) entries exported to xml if ('xml' == $type) { header('Content-Type: application/xml'); - header('Content-Disposition: attachment; filename="timesheet.xml"'); + header('Content-Disposition: attachment; filename="'.$filename.'.xml"'); print "\n"; print "\n"; @@ -141,7 +144,7 @@ if ('xml' == $type) { // 2) entries exported to csv if ('csv' == $type) { header('Content-Type: application/csv'); - header('Content-Disposition: attachment; filename="timesheet.csv"'); + header('Content-Disposition: attachment; filename="'.$filename.'.csv"'); // Print UTF8 BOM first to identify encoding. $bom = chr(239).chr(187).chr(191); // 0xEF 0xBB 0xBF in the beginning of the file is UTF8 BOM.