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>2014-01-29 04:55:38 +0400
committermattab <matthieu.aubry@gmail.com>2014-01-29 04:55:38 +0400
commit35487a0b6b4ee8a593afd450779b4189611c5340 (patch)
treebd2e447bd6f025dcd4543cfdbb81e33305f77adb /plugins/CoreHome/DataTableRowAction
parent84eab40445b93ab1516117b6c01f5b9f2949b368 (diff)
When reports set a pretty label in the column label_html, this label will be used in the Row Evolution popover instead of "label"
Diffstat (limited to 'plugins/CoreHome/DataTableRowAction')
-rw-r--r--plugins/CoreHome/DataTableRowAction/RowEvolution.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/plugins/CoreHome/DataTableRowAction/RowEvolution.php b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
index 188d4c61fe..84dbd949ae 100644
--- a/plugins/CoreHome/DataTableRowAction/RowEvolution.php
+++ b/plugins/CoreHome/DataTableRowAction/RowEvolution.php
@@ -14,6 +14,7 @@ use Exception;
use Piwik\API\Request;
use Piwik\API\ResponseBuilder;
use Piwik\Common;
+use Piwik\DataTable;
use Piwik\Date;
use Piwik\Metrics;
use Piwik\Piwik;
@@ -128,9 +129,8 @@ class RowEvolution
$popoverTitle = '';
if ($this->rowLabel) {
$icon = $this->rowIcon ? '<img src="' . $this->rowIcon . '" alt="">' : '';
- $rowLabel = str_replace('/', '<wbr>/', str_replace('&', '<wbr>&', $this->rowLabel));
- $metricsText = sprintf(Piwik::translate('RowEvolution_MetricsFor'), $this->dimension . ': ' . $icon . ' ' . $rowLabel);
- $popoverTitle = $icon . ' ' . $rowLabel;
+ $metricsText = sprintf(Piwik::translate('RowEvolution_MetricsFor'), $this->dimension . ': ' . $icon . ' ' . $this->rowLabel);
+ $popoverTitle = $icon . ' ' . $this->rowLabel;
}
$view->availableMetricsText = $metricsText;
@@ -173,7 +173,7 @@ class RowEvolution
protected function extractEvolutionReport($report)
{
$this->dataTable = $report['reportData'];
- $this->rowLabel = Common::sanitizeInputValue($report['label']);
+ $this->rowLabel = $this->extractPrettyLabel($report);
$this->rowIcon = !empty($report['logo']) ? $report['logo'] : false;
$this->availableMetrics = $report['metadata']['metrics'];
$this->dimension = $report['metadata']['dimension'];
@@ -320,4 +320,26 @@ class RowEvolution
return array($first, $last);
}
+
+ /**
+ * @param $report
+ * @return string
+ */
+ protected function extractPrettyLabel($report)
+ {
+ // By default, use the specified label
+ $rowLabel = Common::sanitizeInputValue($report['label']);
+ $rowLabel = str_replace('/', '<wbr>/', str_replace('&', '<wbr>&', $rowLabel ));
+
+ // If the dataTable specifies a label_html, use this instead
+ /** @var $dataTableMap \Piwik\DataTable\Map */
+ $dataTableMap = $report['reportData'];
+ $labelPretty = $dataTableMap->getColumn('label_html');
+ $labelPretty = array_filter($labelPretty, 'strlen');
+ $labelPretty = current($labelPretty);
+ if(!empty($labelPretty)) {
+ return $labelPretty;
+ }
+ return $rowLabel;
+ }
} \ No newline at end of file