diff options
author | sgiehl <stefan@piwik.org> | 2015-12-25 21:47:55 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-12-25 21:47:55 +0300 |
commit | b22dee447834c12f1095ba8ecf356970b2312dbf (patch) | |
tree | 46a966716922f3d44734929486c43a26d37230f7 /plugins/Events/Events.php | |
parent | 72fa5107adcdbe1f4b8850f89c95dd3d5f5e6f4a (diff) | |
parent | 611316e743d17d819b511d008da0e80e6425b686 (diff) |
Merge branch 'master' into 3.0
Conflicts:
core/Version.php
plugins/CoreConsole/Commands/ManagePlugin.php
plugins/CoreHome/angularjs/siteselector/siteselector.directive.js
plugins/CoreHome/javascripts/corehome.js
plugins/Ecommerce/Menu.php
plugins/Events/Events.php
plugins/Goals/Goals.php
plugins/Live/templates/index.twig
plugins/UserCountryMap/UserCountryMap.php
plugins/UsersManager/stylesheets/usersManager.less
plugins/VisitsSummary/Controller.php
plugins/VisitsSummary/Reports/Get.php
tests/UI/expected-ui-screenshots
Diffstat (limited to 'plugins/Events/Events.php')
-rw-r--r-- | plugins/Events/Events.php | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/plugins/Events/Events.php b/plugins/Events/Events.php index d18bb32f05..06a7b5b081 100644 --- a/plugins/Events/Events.php +++ b/plugins/Events/Events.php @@ -9,10 +9,12 @@ namespace Piwik\Plugins\Events; use Piwik\Common; +use Piwik\DataTable; use Piwik\Piwik; use Piwik\Plugin\Report; use Piwik\Plugin\ViewDataTable; use Piwik\Plugin\Reports; +use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable\AllColumns; class Events extends \Piwik\Plugin { @@ -25,7 +27,8 @@ class Events extends \Piwik\Plugin 'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations', 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations', 'ViewDataTable.configure' => 'configureViewDataTable', - 'Live.getAllVisitorDetails' => 'extendVisitorDetails' + 'Live.getAllVisitorDetails' => 'extendVisitorDetails', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', ); } @@ -146,9 +149,30 @@ class Events extends \Piwik\Plugin } $view->config->show_flatten_table = true; - $view->config->show_table_all_columns = false; $view->requestConfig->filter_sort_column = 'nb_events'; + if ($view->isViewDataTableId(AllColumns::ID)) { + $view->config->filters[] = function (DataTable $table) use ($view) { + $columsToDisplay = array('label'); + + $columns = $table->getColumns(); + if (in_array('nb_visits', $columns)) { + $columsToDisplay[] = 'nb_visits'; + } + + if (in_array('nb_uniq_visitors', $columns)) { + $columsToDisplay[] = 'nb_uniq_visitors'; + } + + $view->config->columns_to_display = array_merge($columsToDisplay, array('nb_events', 'sum_event_value', 'avg_event_value', 'min_event_value', 'max_event_value')); + + if (!in_array($view->requestConfig->filter_sort_column, $view->config->columns_to_display)) { + $view->requestConfig->filter_sort_column = 'nb_events'; + } + }; + $view->config->show_pivot_by_subtable = false; + } + $labelTranslation = $this->getColumnTranslation($apiMethod); $view->config->addTranslation('label', $labelTranslation); $view->config->addTranslations($this->getMetricTranslations()); @@ -235,4 +259,9 @@ class Events extends \Piwik\Plugin { return Common::getRequestVar('secondaryDimension', false, 'string'); } + + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = "plugins/Events/stylesheets/datatable.less"; + } } |