Skip to content

Commit

Permalink
Refs matomo-org#4701 Commit pull request proposed file (Just changed …
Browse files Browse the repository at this point in the history
…the icon for csv)
  • Loading branch information
mattab committed Feb 18, 2014
1 parent 8748d98 commit c388463
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/ReportRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
/**
* A Report Renderer produces user friendly renderings of any given Piwik report.
* All new Renderers must be copied in ReportRenderer and added to the $availableReportRenderers.
*
*/
abstract class ReportRenderer
{
Expand All @@ -32,10 +31,12 @@ abstract class ReportRenderer

const HTML_FORMAT = 'html';
const PDF_FORMAT = 'pdf';
const CSV_FORMAT = 'csv';

static private $availableReportRenderers = array(
self::PDF_FORMAT,
self::HTML_FORMAT,
self::CSV_FORMAT,
);

/**
Expand Down
22 changes: 20 additions & 2 deletions plugins/ScheduledReports/ScheduledReports.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Exception;
use Piwik\Common;
use Piwik\Config;
use Piwik\Date;
use Piwik\Db;
use Piwik\DbHelper;
use Piwik\Mail;
Expand Down Expand Up @@ -69,7 +68,8 @@ class ScheduledReports extends \Piwik\Plugin

static private $managedReportFormats = array(
ReportRenderer::HTML_FORMAT => 'plugins/Zeitgeist/images/html_icon.png',
ReportRenderer::PDF_FORMAT => 'plugins/UserSettings/images/plugins/pdf.gif'
ReportRenderer::PDF_FORMAT => 'plugins/UserSettings/images/plugins/pdf.gif',
ReportRenderer::CSV_FORMAT => 'plugins/Morpheus/images/export.png',
);

/**
Expand Down Expand Up @@ -304,6 +304,24 @@ public function sendReport($reportType, $report, $contents, $filename, $prettyDa
$mail->setBodyHtml($message . "<br/><br/>" . $contents);
break;


case 'csv':
$message .= "\n" . Piwik::translate('ScheduledReports_PleaseFindAttachedFile', array($periods[$report['period']], $reportTitle));

if ($displaySegmentInfo) {
$message .= " " . $segmentInfo;
}

$mail->setBodyText($message);
$mail->createAttachment(
$contents,
'application/csv',
Zend_Mime::DISPOSITION_INLINE,
Zend_Mime::ENCODING_BASE64,
$attachmentName . '.csv'
);
break;

default:
case 'pdf':
$message .= "\n" . Piwik::translate('ScheduledReports_PleaseFindAttachedFile', array($periods[$report['period']], $reportTitle));
Expand Down

0 comments on commit c388463

Please sign in to comment.