Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-03-28 03:42:39 +0400
committermattab <matthieu.aubry@gmail.com>2013-03-28 03:42:40 +0400
commitae4b03163792f0b6e933933e5d37df87dc3fd566 (patch)
treed1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/ReportRenderer/Html.php
parent158c2150f5f2e13ece459b8d131244c11b763997 (diff)
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/ReportRenderer/Html.php')
-rw-r--r--core/ReportRenderer/Html.php272
1 files changed, 135 insertions, 137 deletions
diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php
index 1bf56eb341..45c14bffa4 100644
--- a/core/ReportRenderer/Html.php
+++ b/core/ReportRenderer/Html.php
@@ -16,141 +16,139 @@
*/
class Piwik_ReportRenderer_Html extends Piwik_ReportRenderer
{
- const IMAGE_GRAPH_WIDTH = 700;
- const IMAGE_GRAPH_HEIGHT = 200;
-
- const REPORT_TITLE_TEXT_SIZE = 11;
- const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
- const REPORT_TABLE_ROW_TEXT_SIZE = 11;
- const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
-
- const HTML_CONTENT_TYPE = 'text/html';
- const HTML_FILE_EXTENSION = 'html';
-
- protected $renderImageInline = false;
-
- private $rendering = "";
-
- public function setLocale($locale)
- {
- //Nothing to do
- }
-
- /**
- * Currently only used for HTML reports.
- * When sent by mail, images are attached to the mail: renderImageInline = false
- * When downloaded, images are included base64 encoded in the report body: renderImageInline = true
- *
- * @param boolean $renderImageInline
- */
- public function setRenderImageInline($renderImageInline)
- {
- $this->renderImageInline = $renderImageInline;
- }
-
- public function sendToDisk($filename)
- {
- $this->epilogue();
-
- return Piwik_ReportRenderer::writeFile($filename, self::HTML_FILE_EXTENSION, $this->rendering);
- }
-
- public function sendToBrowserDownload($filename)
- {
- $this->epilogue();
-
- Piwik_ReportRenderer::sendToBrowser($filename, self::HTML_FILE_EXTENSION, self::HTML_CONTENT_TYPE, $this->rendering);
- }
-
- public function sendToBrowserInline($filename)
- {
- $this->epilogue();
-
- Piwik_ReportRenderer::inlineToBrowser(self::HTML_CONTENT_TYPE, $this->rendering);
- }
-
- public function getRenderedReport()
- {
- $this->epilogue();
-
- return $this->rendering;
- }
-
- private function epilogue()
- {
- $smarty = new Piwik_Smarty();
- $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_footer.tpl"));
- }
-
- public function renderFrontPage($websiteName, $prettyDate, $description, $reportMetadata)
- {
- $smarty = new Piwik_Smarty();
- $this->assignCommonParameters($smarty);
-
- $smarty->assign("websiteName", $websiteName);
- $smarty->assign("prettyDate", $prettyDate);
- $smarty->assign("description", $description);
- $smarty->assign("reportMetadata", $reportMetadata);
-
- $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_header.tpl"));
- }
-
- private function assignCommonParameters($smarty)
- {
- $smarty->assign("reportTitleTextColor", Piwik_ReportRenderer::REPORT_TITLE_TEXT_COLOR);
- $smarty->assign("reportTitleTextSize", self::REPORT_TITLE_TEXT_SIZE);
- $smarty->assign("reportTextColor", Piwik_ReportRenderer::REPORT_TEXT_COLOR);
- $smarty->assign("tableHeaderBgColor", Piwik_ReportRenderer::TABLE_HEADER_BG_COLOR);
- $smarty->assign("tableHeaderTextColor", Piwik_ReportRenderer::TABLE_HEADER_TEXT_COLOR);
- $smarty->assign("tableCellBorderColor", Piwik_ReportRenderer::TABLE_CELL_BORDER_COLOR);
- $smarty->assign("tableBgColor", Piwik_ReportRenderer::TABLE_BG_COLOR);
- $smarty->assign("reportTableHeaderTextSize", self::REPORT_TABLE_HEADER_TEXT_SIZE);
- $smarty->assign("reportTableRowTextSize", self::REPORT_TABLE_ROW_TEXT_SIZE);
- $smarty->assign("reportBackToTopTextSize", self::REPORT_BACK_TO_TOP_TEXT_SIZE);
- $smarty->assign("currentPath", Piwik::getPiwikUrl());
- $smarty->assign("logoHeader", Piwik_API_API::getInstance()->getHeaderLogoUrl());
- }
-
- public function renderReport($processedReport)
- {
- $smarty = new Piwik_Smarty();
- $this->assignCommonParameters($smarty);
-
- $reportMetadata = $processedReport['metadata'];
- $reportData = $processedReport['reportData'];
- $columns = $processedReport['columns'];
- list($reportData, $columns) = self::processTableFormat($reportMetadata, $reportData, $columns);
-
- $smarty->assign("reportName", $reportMetadata['name']);
- $smarty->assign("reportId", $reportMetadata['uniqueId']);
- $smarty->assign("reportColumns", $columns);
- $smarty->assign("reportRows", $reportData->getRows());
- $smarty->assign("reportRowsMetadata", $processedReport['reportMetadata']->getRows());
- $smarty->assign("displayTable", $processedReport['displayTable']);
-
- $displayGraph = $processedReport['displayGraph'];
- $evolutionGraph = $processedReport['evolutionGraph'];
- $smarty->assign("displayGraph", $displayGraph);
-
- if($displayGraph)
- {
- $smarty->assign("graphWidth", self::IMAGE_GRAPH_WIDTH);
- $smarty->assign("graphHeight", self::IMAGE_GRAPH_HEIGHT);
- $smarty->assign("renderImageInline", $this->renderImageInline);
-
- if($this->renderImageInline)
- {
- $staticGraph = parent::getStaticGraph($reportMetadata, self::IMAGE_GRAPH_WIDTH, self::IMAGE_GRAPH_HEIGHT, $evolutionGraph);
- $smarty->assign("generatedImageGraph", base64_encode($staticGraph));
- unset($generatedImageGraph);
- }
- }
-
- $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_body.tpl"));
- }
-
- private static function prefixTemplatePath($templateFile)
- {
- return PIWIK_USER_PATH . "/plugins/CoreHome/templates/" . $templateFile;
- }
+ const IMAGE_GRAPH_WIDTH = 700;
+ const IMAGE_GRAPH_HEIGHT = 200;
+
+ const REPORT_TITLE_TEXT_SIZE = 11;
+ const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
+ const REPORT_TABLE_ROW_TEXT_SIZE = 11;
+ const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
+
+ const HTML_CONTENT_TYPE = 'text/html';
+ const HTML_FILE_EXTENSION = 'html';
+
+ protected $renderImageInline = false;
+
+ private $rendering = "";
+
+ public function setLocale($locale)
+ {
+ //Nothing to do
+ }
+
+ /**
+ * Currently only used for HTML reports.
+ * When sent by mail, images are attached to the mail: renderImageInline = false
+ * When downloaded, images are included base64 encoded in the report body: renderImageInline = true
+ *
+ * @param boolean $renderImageInline
+ */
+ public function setRenderImageInline($renderImageInline)
+ {
+ $this->renderImageInline = $renderImageInline;
+ }
+
+ public function sendToDisk($filename)
+ {
+ $this->epilogue();
+
+ return Piwik_ReportRenderer::writeFile($filename, self::HTML_FILE_EXTENSION, $this->rendering);
+ }
+
+ public function sendToBrowserDownload($filename)
+ {
+ $this->epilogue();
+
+ Piwik_ReportRenderer::sendToBrowser($filename, self::HTML_FILE_EXTENSION, self::HTML_CONTENT_TYPE, $this->rendering);
+ }
+
+ public function sendToBrowserInline($filename)
+ {
+ $this->epilogue();
+
+ Piwik_ReportRenderer::inlineToBrowser(self::HTML_CONTENT_TYPE, $this->rendering);
+ }
+
+ public function getRenderedReport()
+ {
+ $this->epilogue();
+
+ return $this->rendering;
+ }
+
+ private function epilogue()
+ {
+ $smarty = new Piwik_Smarty();
+ $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_footer.tpl"));
+ }
+
+ public function renderFrontPage($websiteName, $prettyDate, $description, $reportMetadata)
+ {
+ $smarty = new Piwik_Smarty();
+ $this->assignCommonParameters($smarty);
+
+ $smarty->assign("websiteName", $websiteName);
+ $smarty->assign("prettyDate", $prettyDate);
+ $smarty->assign("description", $description);
+ $smarty->assign("reportMetadata", $reportMetadata);
+
+ $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_header.tpl"));
+ }
+
+ private function assignCommonParameters($smarty)
+ {
+ $smarty->assign("reportTitleTextColor", Piwik_ReportRenderer::REPORT_TITLE_TEXT_COLOR);
+ $smarty->assign("reportTitleTextSize", self::REPORT_TITLE_TEXT_SIZE);
+ $smarty->assign("reportTextColor", Piwik_ReportRenderer::REPORT_TEXT_COLOR);
+ $smarty->assign("tableHeaderBgColor", Piwik_ReportRenderer::TABLE_HEADER_BG_COLOR);
+ $smarty->assign("tableHeaderTextColor", Piwik_ReportRenderer::TABLE_HEADER_TEXT_COLOR);
+ $smarty->assign("tableCellBorderColor", Piwik_ReportRenderer::TABLE_CELL_BORDER_COLOR);
+ $smarty->assign("tableBgColor", Piwik_ReportRenderer::TABLE_BG_COLOR);
+ $smarty->assign("reportTableHeaderTextSize", self::REPORT_TABLE_HEADER_TEXT_SIZE);
+ $smarty->assign("reportTableRowTextSize", self::REPORT_TABLE_ROW_TEXT_SIZE);
+ $smarty->assign("reportBackToTopTextSize", self::REPORT_BACK_TO_TOP_TEXT_SIZE);
+ $smarty->assign("currentPath", Piwik::getPiwikUrl());
+ $smarty->assign("logoHeader", Piwik_API_API::getInstance()->getHeaderLogoUrl());
+ }
+
+ public function renderReport($processedReport)
+ {
+ $smarty = new Piwik_Smarty();
+ $this->assignCommonParameters($smarty);
+
+ $reportMetadata = $processedReport['metadata'];
+ $reportData = $processedReport['reportData'];
+ $columns = $processedReport['columns'];
+ list($reportData, $columns) = self::processTableFormat($reportMetadata, $reportData, $columns);
+
+ $smarty->assign("reportName", $reportMetadata['name']);
+ $smarty->assign("reportId", $reportMetadata['uniqueId']);
+ $smarty->assign("reportColumns", $columns);
+ $smarty->assign("reportRows", $reportData->getRows());
+ $smarty->assign("reportRowsMetadata", $processedReport['reportMetadata']->getRows());
+ $smarty->assign("displayTable", $processedReport['displayTable']);
+
+ $displayGraph = $processedReport['displayGraph'];
+ $evolutionGraph = $processedReport['evolutionGraph'];
+ $smarty->assign("displayGraph", $displayGraph);
+
+ if ($displayGraph) {
+ $smarty->assign("graphWidth", self::IMAGE_GRAPH_WIDTH);
+ $smarty->assign("graphHeight", self::IMAGE_GRAPH_HEIGHT);
+ $smarty->assign("renderImageInline", $this->renderImageInline);
+
+ if ($this->renderImageInline) {
+ $staticGraph = parent::getStaticGraph($reportMetadata, self::IMAGE_GRAPH_WIDTH, self::IMAGE_GRAPH_HEIGHT, $evolutionGraph);
+ $smarty->assign("generatedImageGraph", base64_encode($staticGraph));
+ unset($generatedImageGraph);
+ }
+ }
+
+ $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_body.tpl"));
+ }
+
+ private static function prefixTemplatePath($templateFile)
+ {
+ return PIWIK_USER_PATH . "/plugins/CoreHome/templates/" . $templateFile;
+ }
} \ No newline at end of file