diff options
author | Julien Moumné <julien@piwik.org> | 2013-05-19 12:18:32 +0400 |
---|---|---|
committer | Julien Moumné <julien@piwik.org> | 2013-05-19 12:18:32 +0400 |
commit | 8a8ce3eccb13c11037b79112513bcbe6ef7e2ccf (patch) | |
tree | 83792550c0d26696acd9a48a2780fc435b822842 /core/ReportRenderer/Pdf.php | |
parent | 1ec86574db8537a1290043820455205e9863ad64 (diff) |
ref #71, #3934 - segment selection for scheduled html, pdf & sms reports
Diffstat (limited to 'core/ReportRenderer/Pdf.php')
-rw-r--r-- | core/ReportRenderer/Pdf.php | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/core/ReportRenderer/Pdf.php b/core/ReportRenderer/Pdf.php index d14b736507..a7e65d45c0 100644 --- a/core/ReportRenderer/Pdf.php +++ b/core/ReportRenderer/Pdf.php @@ -66,6 +66,7 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer private $displayGraph; private $evolutionGraph; private $displayTable; + private $segment; private $reportColumns; private $reportRowsMetadata; private $currentPage = 0; @@ -142,35 +143,51 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer return $this->TCPDF->Output(null, 'S'); } - public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata) + public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata, $segment) { $reportTitle = $this->formatText($reportTitle); $dateRange = $this->formatText(Piwik_Translate('General_DateRange') . " " . $prettyDate); - //Setup Footer font and data + // footer $this->TCPDF->SetFooterFont(array($this->reportFont, $this->reportFontStyle, $this->reportSimpleFontSize)); $this->TCPDF->SetFooterContent($reportTitle . " | " . $dateRange . " | "); + // add first page $this->TCPDF->setPrintHeader(false); - // $this->SetMargins($left = , $top, $right=-1, $keepmargins=true) $this->TCPDF->AddPage(self::PORTRAIT); $this->TCPDF->AddFont($this->reportFont, '', '', false); $this->TCPDF->SetFont($this->reportFont, $this->reportFontStyle, $this->reportSimpleFontSize); - //Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false) { $this->TCPDF->Bookmark(Piwik_Translate('PDFReports_FrontPage')); + + // logo $this->TCPDF->Image(Piwik_API_API::getInstance()->getLogoUrl(true), $this->logoImagePosition[0], $this->logoImagePosition[1], 180 / $factor = 2, 0, $type = '', $link = '', $align = '', $resize = false, $dpi = 300); $this->TCPDF->Ln(8); + // report title $this->TCPDF->SetFont($this->reportFont, '', $this->reportHeaderFontSize + 5); $this->TCPDF->SetTextColor($this->headerTextColor[0], $this->headerTextColor[1], $this->headerTextColor[2]); $this->TCPDF->Cell(40, 210, $reportTitle); $this->TCPDF->Ln(8 * 4); + // date and period $this->TCPDF->SetFont($this->reportFont, '', $this->reportHeaderFontSize); $this->TCPDF->SetTextColor($this->reportTextColor[0], $this->reportTextColor[1], $this->reportTextColor[2]); $this->TCPDF->Cell(40, 210, $dateRange); $this->TCPDF->Ln(8 * 20); + + // description $this->TCPDF->Write(1, $this->formatText($description)); + + // segment + if ($segment != null) { + + $this->TCPDF->Ln(); + $this->TCPDF->Ln(); + $this->TCPDF->SetFont($this->reportFont, '', $this->reportHeaderFontSize - 2); + $this->TCPDF->SetTextColor($this->headerTextColor[0], $this->headerTextColor[1], $this->headerTextColor[2]); + $this->TCPDF->Write(1, $this->formatText(Piwik_Translate('PDFReports_CustomVisitorSegment') . ' ' . $segment['name'])); + } + $this->TCPDF->Ln(8); $this->TCPDF->SetFont($this->reportFont, '', $this->reportHeaderFontSize); $this->TCPDF->Ln(); @@ -270,6 +287,7 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer $this->displayGraph = $processedReport['displayGraph']; $this->evolutionGraph = $processedReport['evolutionGraph']; $this->displayTable = $processedReport['displayTable']; + $this->segment = $processedReport['segment']; list($this->report, $this->reportColumns) = self::processTableFormat($this->reportMetadata, $processedReport['reportData'], $processedReport['columns']); $this->paintReportHeader(); @@ -388,7 +406,8 @@ class Piwik_ReportRenderer_Pdf extends Piwik_ReportRenderer $this->reportMetadata, $this->orientation == self::PORTRAIT ? self::IMAGE_GRAPH_WIDTH_PORTRAIT : self::IMAGE_GRAPH_WIDTH_LANDSCAPE, self::IMAGE_GRAPH_HEIGHT, - $this->evolutionGraph + $this->evolutionGraph, + $this->segment ); $this->TCPDF->Image( |