diff options
author | Fabian Becker <halfdan@xnorfz.de> | 2013-06-22 23:47:29 +0400 |
---|---|---|
committer | Fabian Becker <halfdan@xnorfz.de> | 2013-06-22 23:47:29 +0400 |
commit | 165ac7aeec855234e8c60bd758fad39bd6659adf (patch) | |
tree | e42ace9f7f45e420f883245a8df1beefa8eac9b0 /core/ReportRenderer | |
parent | 89d41940a87d449114f529df115b62d3987f88ce (diff) | |
parent | e2e5176279255b7ff2d80f0f511a1ef5f3748ebe (diff) |
Huge merge! Lets see how the tests run..
Merge branch 'master' into 2.x-twig
Conflicts:
core/ReportRenderer/Html.php
core/SmartyPlugins/function.ajaxLoadingDiv.php
plugins/CoreAdminHome/templates/jsTrackingGenerator.tpl
plugins/CoreHome/templates/donate.tpl
plugins/CoreHome/templates/html_report_header.tpl
plugins/CoreHome/templates/menu.tpl
plugins/CoreHome/templates/period_select.tpl
plugins/CoreHome/templates/reports_by_dimension.tpl
plugins/Feedback/templates/index.tpl
plugins/Goals/Controller.php
plugins/Goals/templates/overview.tpl
plugins/Live/API.php
plugins/Live/templates/lastVisits.tpl
plugins/Live/templates/visitorLog.tpl
plugins/MobileMessaging/templates/SMSReport.tpl
plugins/PDFReports/templates/add.tpl
plugins/PDFReports/templates/list.tpl
plugins/PDFReports/templates/report_parameters.tpl
plugins/SEO/templates/index.tpl
plugins/SegmentEditor/templates/selector.twig
plugins/UserCountry/javascripts/userCountry.js
plugins/Zeitgeist/stylesheets/common.css
tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCity_month.xml
tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getCountry_month.xml
tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest__UserCountry.getRegion_month.xml
tests/PHPUnit/Integration/expected/test_ManyVisitorsOneWebsiteTest_segment_continent__UserCountry.getCountry_month.xml
Diffstat (limited to 'core/ReportRenderer')
-rw-r--r-- | core/ReportRenderer/Html.php | 17 | ||||
-rw-r--r-- | core/ReportRenderer/Pdf.php | 29 |
2 files changed, 39 insertions, 7 deletions
diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php index a5baeb26ce..4301fd2aa5 100644 --- a/core/ReportRenderer/Html.php +++ b/core/ReportRenderer/Html.php @@ -82,7 +82,7 @@ class Piwik_ReportRenderer_Html extends Piwik_ReportRenderer $this->rendering .= $view->render(); } - public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata) + public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata, $segment) { $frontPageView = new Piwik_View('@CoreHome/html_report_header'); $this->assignCommonParameters($frontPageView); @@ -93,6 +93,13 @@ class Piwik_ReportRenderer_Html extends Piwik_ReportRenderer $frontPageView->assign("description", $description); $frontPageView->assign("reportMetadata", $reportMetadata); + // segment + $displaySegment = ($segment != null); + $frontPageView->assign("displaySegment", $displaySegment); + if ($displaySegment) { + $frontPageView->assign("segmentName", $segment['name']); + } + $this->rendering .= $frontPageView->render(); } @@ -139,7 +146,13 @@ class Piwik_ReportRenderer_Html extends Piwik_ReportRenderer $reportView->assign("renderImageInline", $this->renderImageInline); if ($this->renderImageInline) { - $staticGraph = parent::getStaticGraph($reportMetadata, self::IMAGE_GRAPH_WIDTH, self::IMAGE_GRAPH_HEIGHT, $evolutionGraph); + $staticGraph = parent::getStaticGraph( + $reportMetadata, + self::IMAGE_GRAPH_WIDTH, + self::IMAGE_GRAPH_HEIGHT, + $evolutionGraph, + $processedReport['segment'] + ); $reportView->assign("generatedImageGraph", base64_encode($staticGraph)); unset($generatedImageGraph); } 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( |