diff options
author | Fabian Becker <halfdan@xnorfz.de> | 2013-04-07 21:35:37 +0400 |
---|---|---|
committer | Fabian Becker <halfdan@xnorfz.de> | 2013-04-07 21:35:37 +0400 |
commit | 27c5409302a8c7cfaa14498f98805b485d4b6656 (patch) | |
tree | ee87021c31a73b6f767d113517b8111e0e447ef1 /core/ReportRenderer/Html.php | |
parent | b1abc530f07850cf05973e3f11f759cc01c82bcd (diff) |
Removed dependency to Smarty
Diffstat (limited to 'core/ReportRenderer/Html.php')
-rw-r--r-- | core/ReportRenderer/Html.php | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/core/ReportRenderer/Html.php b/core/ReportRenderer/Html.php index 45c14bffa4..980d623997 100644 --- a/core/ReportRenderer/Html.php +++ b/core/ReportRenderer/Html.php @@ -78,77 +78,72 @@ class Piwik_ReportRenderer_Html extends Piwik_ReportRenderer private function epilogue() { - $smarty = new Piwik_Smarty(); - $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_footer.tpl")); + $view = new Piwik_View('@CoreHome/html_report_footer'); + $this->rendering .= $view->render(); } public function renderFrontPage($websiteName, $prettyDate, $description, $reportMetadata) { - $smarty = new Piwik_Smarty(); - $this->assignCommonParameters($smarty); + $fronPageView = new Piwik_View('@CoreHome/html_report_header'); + $this->assignCommonParameters($fronPageView); - $smarty->assign("websiteName", $websiteName); - $smarty->assign("prettyDate", $prettyDate); - $smarty->assign("description", $description); - $smarty->assign("reportMetadata", $reportMetadata); + $fronPageView->assign("websiteName", $websiteName); + $fronPageView->assign("prettyDate", $prettyDate); + $fronPageView->assign("description", $description); + $fronPageView->assign("reportMetadata", $reportMetadata); - $this->rendering .= $smarty->fetch(self::prefixTemplatePath("html_report_header.tpl")); + $this->rendering .= $fronPageView->render(); } - private function assignCommonParameters($smarty) + private function assignCommonParameters(Piwik_View $view) { - $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()); + $view->assign("reportTitleTextColor", Piwik_ReportRenderer::REPORT_TITLE_TEXT_COLOR); + $view->assign("reportTitleTextSize", self::REPORT_TITLE_TEXT_SIZE); + $view->assign("reportTextColor", Piwik_ReportRenderer::REPORT_TEXT_COLOR); + $view->assign("tableHeaderBgColor", Piwik_ReportRenderer::TABLE_HEADER_BG_COLOR); + $view->assign("tableHeaderTextColor", Piwik_ReportRenderer::TABLE_HEADER_TEXT_COLOR); + $view->assign("tableCellBorderColor", Piwik_ReportRenderer::TABLE_CELL_BORDER_COLOR); + $view->assign("tableBgColor", Piwik_ReportRenderer::TABLE_BG_COLOR); + $view->assign("reportTableHeaderTextSize", self::REPORT_TABLE_HEADER_TEXT_SIZE); + $view->assign("reportTableRowTextSize", self::REPORT_TABLE_ROW_TEXT_SIZE); + $view->assign("reportBackToTopTextSize", self::REPORT_BACK_TO_TOP_TEXT_SIZE); + $view->assign("currentPath", Piwik::getPiwikUrl()); + $view->assign("logoHeader", Piwik_API_API::getInstance()->getHeaderLogoUrl()); } public function renderReport($processedReport) { - $smarty = new Piwik_Smarty(); - $this->assignCommonParameters($smarty); + $reportView = new Piwik_View('@CoreHome/html_report_body'); + $this->assignCommonParameters($reportView); $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']); + $reportView->assign("reportName", $reportMetadata['name']); + $reportView->assign("reportId", $reportMetadata['uniqueId']); + $reportView->assign("reportColumns", $columns); + $reportView->assign("reportRows", $reportData->getRows()); + $reportView->assign("reportRowsMetadata", $processedReport['reportMetadata']->getRows()); + $reportView->assign("displayTable", $processedReport['displayTable']); $displayGraph = $processedReport['displayGraph']; $evolutionGraph = $processedReport['evolutionGraph']; - $smarty->assign("displayGraph", $displayGraph); + $reportView->assign("displayGraph", $displayGraph); if ($displayGraph) { - $smarty->assign("graphWidth", self::IMAGE_GRAPH_WIDTH); - $smarty->assign("graphHeight", self::IMAGE_GRAPH_HEIGHT); - $smarty->assign("renderImageInline", $this->renderImageInline); + $reportView->assign("graphWidth", self::IMAGE_GRAPH_WIDTH); + $reportView->assign("graphHeight", self::IMAGE_GRAPH_HEIGHT); + $reportView->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)); + $reportView->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; + $this->rendering .= $reportView->render(); } }
\ No newline at end of file |