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/API/RowEvolution.php
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/API/RowEvolution.php')
-rw-r--r--plugins/API/RowEvolution.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php
index 53686b2589..c50c136899 100644
--- a/plugins/API/RowEvolution.php
+++ b/plugins/API/RowEvolution.php
@@ -168,7 +168,7 @@ class RowEvolution
// this removes the label as well (which is desired for two reasons: (1) it was passed
// in the request, (2) it would cause the evolution graph to show the label in the legend).
foreach ($row->getColumns() as $column => $value) {
- if (!in_array($column, $metricNames)) {
+ if (!in_array($column, $metricNames) && $column != 'label_html') {
$row->deleteColumn($column);
}
}
@@ -425,6 +425,11 @@ class RowEvolution
$actualLabels[$labelIdx] = $this->getRowUrlForEvolutionLabel(
$labelRow, $apiModule, $apiAction, $labelUseAbsoluteUrl);
+ $prettyLabel = $labelRow->getColumn('label_html');
+ if($prettyLabel !== false) {
+ $actualLabels[$labelIdx] = $prettyLabel;
+ }
+
$logos[$labelIdx] = $labelRow->getMetadata('logo');
if (!empty($actualLabels[$labelIdx])) {
@@ -434,7 +439,8 @@ class RowEvolution
}
if (empty($actualLabels[$labelIdx])) {
- $actualLabels[$labelIdx] = $this->cleanOriginalLabel($label);
+ $cleanLabel = $this->cleanOriginalLabel($label);
+ $actualLabels[$labelIdx] = $cleanLabel;
}
}
@@ -480,7 +486,7 @@ class RowEvolution
$label .= ' (' . $metadata['columns'][$column] . ')';
}
$metricName = $column . '_' . $labelIndex;
- $metadata['metrics'][$metricName] = SafeDecodeLabel::decodeLabelSafe($label);
+ $metadata['metrics'][$metricName] = $label;
if (!empty($logos[$labelIndex])) {
$metadata['logos'][$metricName] = $logos[$labelIndex];
@@ -515,11 +521,12 @@ class RowEvolution
}
/**
- * Returns a prettier, more comprehensible version of a row evolution label
- * for display.
+ * Returns a prettier, more comprehensible version of a row evolution label for display.
*/
private function cleanOriginalLabel($label)
{
- return str_replace(LabelFilter::SEPARATOR_RECURSIVE_LABEL, ' - ', $label);
+ $label = str_replace(LabelFilter::SEPARATOR_RECURSIVE_LABEL, ' - ', $label);
+ $label = SafeDecodeLabel::decodeLabelSafe($label);
+ return $label;
}
}