X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=tofile.php;h=c7f81e5024c7bb36f8b08175eff29aee96284e0c;hb=70f38eea57095a6895fd727799a0c90ebeeb6cf9;hp=26d1cbaee563216014fb65a6f26d032007b83375;hpb=b027832862272283d9203c994ec8fd39f6196887;p=timetracker.git diff --git a/tofile.php b/tofile.php index 26d1cbae..c7f81e50 100644 --- a/tofile.php +++ b/tofile.php @@ -38,7 +38,7 @@ if (!ttAccessCheck(right_view_reports)) { } // Use custom fields plugin if it is enabled. -if (in_array('cf', explode(',', $user->plugins))) { +if ($user->isPluginEnabled('cf')) { require_once('plugins/CustomFields.class.php'); $custom_fields = new CustomFields($user->team_id); } @@ -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.