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:
Diffstat (limited to 'plugins/CustomDimensions/DataTable/Filter/AddSubtableSegmentMetadata.php')
m---------plugins/CustomDimensions0
-rw-r--r--plugins/CustomDimensions/DataTable/Filter/AddSubtableSegmentMetadata.php63
2 files changed, 63 insertions, 0 deletions
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions
deleted file mode 160000
-Subproject 318661a2fb1ef3b3e5d6d999ae8b9628cb5a113
diff --git a/plugins/CustomDimensions/DataTable/Filter/AddSubtableSegmentMetadata.php b/plugins/CustomDimensions/DataTable/Filter/AddSubtableSegmentMetadata.php
new file mode 100644
index 0000000000..a6ecdd779f
--- /dev/null
+++ b/plugins/CustomDimensions/DataTable/Filter/AddSubtableSegmentMetadata.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Matomo - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\CustomDimensions\DataTable\Filter;
+
+use Piwik\DataTable\BaseFilter;
+use Piwik\DataTable\Row;
+use Piwik\DataTable;
+use Piwik\Plugins\CustomDimensions\Archiver;
+use Piwik\Plugins\CustomDimensions\Tracker\CustomDimensionsRequestProcessor;
+use Piwik\Tracker\PageUrl;
+
+class AddSubtableSegmentMetadata extends BaseFilter
+{
+ private $idDimension;
+ private $dimensionValue;
+
+ /**
+ * Constructor.
+ *
+ * @param DataTable $table The table to eventually filter.
+ */
+ public function __construct($table, $idDimension, $dimensionValue)
+ {
+ parent::__construct($table);
+ $this->idDimension = $idDimension;
+ $this->dimensionValue = $dimensionValue;
+ }
+
+ /**
+ * @param DataTable $table
+ */
+ public function filter($table)
+ {
+ if (!$this->dimensionValue) {
+ return;
+ }
+
+ $dimension = CustomDimensionsRequestProcessor::buildCustomDimensionTrackingApiName($this->idDimension);
+
+ if ($this->dimensionValue === Archiver::LABEL_CUSTOM_VALUE_NOT_DEFINED) {
+ $dimensionValue = '';
+ } else {
+ $dimensionValue = urlencode($this->dimensionValue);
+ }
+
+ $conditionAnd = ';';
+ $partDimension = $dimension . '==' . $dimensionValue . $conditionAnd;
+
+ foreach ($table->getRows() as $row) {
+ $label = $row->getColumn('label');
+ if ($label !== false) {
+ $row->setMetadata('segment', $partDimension . 'actionUrl=$' . urlencode($label));
+ $row->setMetadata('url', urlencode($label));
+ }
+ }
+ }
+} \ No newline at end of file