diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-12-09 00:51:40 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-09 00:51:40 +0300 |
commit | 33f074e63e06bd1ac1d5608b040af49bb19104b9 (patch) | |
tree | 60d21aee8b4a675389d3ed1e0e145fe55c8b0f00 /core/Plugin/Report.php | |
parent | df062ae092d6b44f319582d7d567db1ec42cc29e (diff) |
Keep flattened columns as extra columns (#12199)
* Add reports dimensions to metadata of report and rows
* translate dimension columns
* updates test files
* fix possible error when no report is available
* update tests
* Improve subdimension detection
* Adjust tests for labelX logic
* Makes flattener compatible with 3 dimensions
* Adds new method getThirdLeveltableDimension to report class
* Do not ask for 2fa authentication code when CoreUpdater is being requested (#13796)
Could fix an edge case where user is logged in, but hasn't confirmed the auth code (so the user is not actually logged in), and then an update appears.
* Added Fallback Method for Alexa in SEO Plugin (#13552)
* added fallback method for Alexa, fixes issue #13427
* do not use short array syntax for consistency with other methods
* use mini link for Alexa, use DomXPath to filter out the global ranking instead of regex
* Use db sessions by default, deprecate file session handler (#13540)
* use db sessions by default, deprecate file session handler
* trying to fix tests
* Prevent trigger errors on demand for instances that are opened to anonymous (#13535)
fix #13513
* Remove the previous exception in base validator so the same error is not printed twice (#13801)
* Fixing build (#13802)
* update submodule
* Update screenshots and try to get test to pass.
* Get SingleMetricView to pass. (#13803)
* Quickform2 throws warnings with PHP7.2 (#13463)
fixes #13272
Haven't actually tested it but should fix the issue. If tests pass, the logic would be still the same. I don't have a PHP 7.2 running here otherwise at the moment
* Send bulk requests in chunks when needed (#13444)
* send bulk requests in chunks
* send requests correctly
* Make log and report data screen less technical (#13464)
* When you are logged out, the URL gets lost when you log in (#13441)
It won't remember any hash as the hash won't be visible in the referrer etc but it would work for most other pages.
To make it work for hash it would get likely way more complicated like we would need to persist it through JS, temporarily store it somewhere and redirect accordingly. It fixes the case mentioned in the issue.
fix https://github.com/matomo-org/matomo/issues/13328
* show full information of URL only on extra click (#13585)
* Add option to opt in to use send beacon (#13451)
* Add option to opt in to use send beacon
* Fix JS tracker test.
* do not overrwite existing subrow metadata
* update test files
Diffstat (limited to 'core/Plugin/Report.php')
-rw-r--r-- | core/Plugin/Report.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index 626f837daf..04145a2d40 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -594,6 +594,12 @@ class Report $report['isSubtableReport'] = $this->isSubtableReport; } + $dimensions = $this->getDimensions(); + + if (count($dimensions) > 1) { + $report['dimensions'] = $dimensions; + } + $report['metrics'] = $this->getMetrics(); $report['metricsDocumentation'] = $this->getMetricsDocumentation(); $report['processedMetrics'] = $this->getProcessedMetrics(); @@ -746,6 +752,34 @@ class Report } /** + * Get dimensions used for current report and its subreports + * + * @return array [dimensionId => dimensionName] + * @ignore + */ + public function getDimensions() + { + $dimensions = []; + + if (!empty($this->getDimension())) { + $dimensionId = str_replace('.', '_', $this->getDimension()->getId()); + $dimensions[$dimensionId] = $this->getDimension()->getName(); + } + + if (!empty($this->getSubtableDimension())) { + $subDimensionId = str_replace('.', '_', $this->getSubtableDimension()->getId()); + $dimensions[$subDimensionId] = $this->getSubtableDimension()->getName(); + } + + if (!empty($this->getThirdLeveltableDimension())) { + $subDimensionId = str_replace('.', '_', $this->getThirdLeveltableDimension()->getId()); + $dimensions[$subDimensionId] = $this->getThirdLeveltableDimension()->getName(); + } + + return $dimensions; + } + + /** * Returns the order of the report * @return int * @ignore @@ -789,6 +823,36 @@ class Report } /** + * Returns the Dimension instance of the subtable report of this report's subtable report. + * + * @return Dimension|null The subtable report's dimension or null if there is no subtable report or + * no dimension for the subtable report. + * @api + */ + public function getThirdLeveltableDimension() + { + if (empty($this->actionToLoadSubTables)) { + return null; + } + + list($subtableReportModule, $subtableReportAction) = $this->getSubtableApiMethod(); + + $subtableReport = ReportsProvider::factory($subtableReportModule, $subtableReportAction); + if (empty($subtableReport) || empty($subtableReport->actionToLoadSubTables)) { + return null; + } + + list($subSubtableReportModule, $subSubtableReportAction) = $subtableReport->getSubtableApiMethod(); + + $subSubtableReport = ReportsProvider::factory($subSubtableReportModule, $subSubtableReportAction); + if (empty($subSubtableReport)) { + return null; + } + + return $subSubtableReport->getDimension(); + } + + /** * Returns true if the report is for another report's subtable, false if otherwise. * * @return bool |