diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2016-04-06 06:29:18 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2016-04-06 06:29:18 +0300 |
commit | 3eb0cf055146c0b77b592cf9ef4bf2eb2e2f1ca3 (patch) | |
tree | 99817781db0a0626fa4d14f96697f6e04e66f983 /plugins/CoreVisualizations | |
parent | 1854f5c456a76af807431d52bcb19ad207ba658e (diff) | |
parent | 0f38083969261b95a00c59f1f5596d35365506cd (diff) |
Merge branch 'master' into 3.0-m03
Conflicts:
core/Version.php
core/WidgetsList.php
plugins/CustomDimensions
plugins/Goals/templates/getGoalReportView.twig
plugins/Goals/templates/getOverviewView.twig
tests/UI/expected-ui-screenshots
Diffstat (limited to 'plugins/CoreVisualizations')
4 files changed, 30 insertions, 55 deletions
diff --git a/plugins/CoreVisualizations/CoreVisualizations.php b/plugins/CoreVisualizations/CoreVisualizations.php index 9a5f88e7ec..0aec35fb3e 100644 --- a/plugins/CoreVisualizations/CoreVisualizations.php +++ b/plugins/CoreVisualizations/CoreVisualizations.php @@ -29,8 +29,7 @@ class CoreVisualizations extends \Piwik\Plugin 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', - 'UsersManager.deleteUser' => 'deleteUser', - 'ViewDataTable.addViewDataTable' => 'addViewDataTable' + 'UsersManager.deleteUser' => 'deleteUser' ); } @@ -39,23 +38,6 @@ class CoreVisualizations extends \Piwik\Plugin ViewDataTableManager::clearUserViewDataTableParameters($userLogin); } - public function addViewDataTable(&$viewDataTable) - { - // Both are the same HtmlTable, just the Pivot one has some extra logic in case Pivot is used. - // We don't want to use the same HtmlTable twice in the UI. Therefore we always need to remove one. - if (Common::getRequestVar('pivotBy', '')) { - $tableToRemove = 'Visualizations\HtmlTable'; - } else { - $tableToRemove = 'HtmlTable\PivotBy'; - } - - foreach ($viewDataTable as $index => $table) { - if (Common::stringEndsWith($table, $tableToRemove)) { - unset($viewDataTable[$index]); - } - } - } - public function getStylesheetFiles(&$stylesheets) { $stylesheets[] = "plugins/CoreVisualizations/stylesheets/dataTableVisualizations.less"; diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable.php b/plugins/CoreVisualizations/Visualizations/HtmlTable.php index 66cb4c26e9..dff8aa3e7a 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable.php @@ -70,6 +70,25 @@ class HtmlTable extends Visualization $dataTable = $request->process(); $this->assignTemplateVar('siteSummary', $dataTable); } + + if ($this->isPivoted()) { + $this->config->columns_to_display = $this->dataTable->getColumns(); + } + } + + public function beforeGenericFiltersAreAppliedToLoadedDataTable() + { + if ($this->isPivoted()) { + $this->config->columns_to_display = $this->dataTable->getColumns(); + + $this->dataTable->applyQueuedFilters(); + } + + parent::beforeGenericFiltersAreAppliedToLoadedDataTable(); } + protected function isPivoted() + { + return $this->requestConfig->pivotBy || Common::getRequestVar('pivotBy', ''); + } } diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php index 5acf9b50be..959aa0d57b 100644 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php +++ b/plugins/CoreVisualizations/Visualizations/HtmlTable/AllColumns.php @@ -64,4 +64,14 @@ class AllColumns extends HtmlTable $properties->columns_to_display = $columnsToDisplay; }); } + + public function beforeLoadDataTable() + { + $this->requestConfig->request_parameters_to_modify['pivotBy'] = null; // always unset pivotBy + } + + protected function isPivoted() + { + return false; // Pivot not supported + } } diff --git a/plugins/CoreVisualizations/Visualizations/HtmlTable/PivotBy.php b/plugins/CoreVisualizations/Visualizations/HtmlTable/PivotBy.php deleted file mode 100644 index 1703988599..0000000000 --- a/plugins/CoreVisualizations/Visualizations/HtmlTable/PivotBy.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Piwik - free/libre analytics platform - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ - -namespace Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; - -use Piwik\DataTable; -use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; -use Piwik\View; - -/** - * DataTable Visualization that derives from HtmlTable and sets show_extra_columns to true. - */ -class PivotBy extends HtmlTable -{ - public function beforeGenericFiltersAreAppliedToLoadedDataTable() - { - $this->config->columns_to_display = $this->dataTable->getColumns(); - - $this->dataTable->applyQueuedFilters(); - - parent::beforeGenericFiltersAreAppliedToLoadedDataTable(); - } - - public function beforeRender() - { - parent::beforeRender(); - - $this->config->columns_to_display = $this->dataTable->getColumns(); - } -} |