diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-07-31 01:31:17 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-07-31 01:31:17 +0400 |
commit | c35e613b7ff66c6c86a712f0fd3250692ed9d8a9 (patch) | |
tree | 4e56d45743fc85f80014518e5c5bd419cc4a8f7b /plugins/CustomVariables | |
parent | 765be0dc8f92a6d4bb3e678a0c23f2d4b95e0e18 (diff) | |
parent | 13f657ccfa6b58864291a173a0849d7169b031b2 (diff) |
Merge branch 'master' into php-5.3-namespaces
Conflicts:
core/Access.php
core/Config.php
core/EventDispatcher.php
core/JqplotDataGenerator/Evolution.php
core/Piwik.php
core/Plugin/MetadataLoader.php
core/ViewDataTable.php
core/ViewDataTable/Cloud.php
core/ViewDataTable/GenerateGraphHTML.php
core/ViewDataTable/HtmlTable.php
core/ViewDataTable/HtmlTable/AllColumns.php
core/ViewDataTable/HtmlTable/Goals.php
plugins/Actions/Controller.php
plugins/CoreHome/Controller.php
plugins/CoreHome/DataTableRowAction/RowEvolution.php
plugins/CoreHome/templates/_dataTable.twig
plugins/CustomVariables/Controller.php
plugins/DBStats/Controller.php
plugins/DevicesDetection/Controller.php
plugins/ExampleUI/Controller.php
plugins/Goals/Controller.php
plugins/Live/Controller.php
plugins/Provider/Controller.php
plugins/Referers/Controller.php
plugins/UserCountry/Controller.php
plugins/UserCountryMap/Controller.php
plugins/UserSettings/Archiver.php
plugins/UserSettings/Controller.php
plugins/VisitTime/Controller.php
plugins/VisitTime/VisitTime.php
plugins/VisitorInterest/Controller.php
plugins/VisitsSummary/Controller.php
tests/PHPUnit/proxy/index.php
Diffstat (limited to 'plugins/CustomVariables')
-rw-r--r-- | plugins/CustomVariables/Controller.php | 31 | ||||
-rw-r--r-- | plugins/CustomVariables/CustomVariables.php | 51 |
2 files changed, 46 insertions, 36 deletions
diff --git a/plugins/CustomVariables/Controller.php b/plugins/CustomVariables/Controller.php index 6c6054f418..9734c0883b 100644 --- a/plugins/CustomVariables/Controller.php +++ b/plugins/CustomVariables/Controller.php @@ -26,39 +26,12 @@ class Piwik_CustomVariables_Controller extends Controller public function getCustomVariables($fetch = false) { - $view = ViewDataTable::factory(); - $view->init($this->pluginName, __FUNCTION__, "CustomVariables.getCustomVariables", "getCustomVariablesValuesFromNameId"); - - $this->setPeriodVariablesView($view); - $this->setMetricsVariablesView($view); - - $this->configureView($view); - $view->setColumnTranslation('label', Piwik_Translate('CustomVariables_ColumnCustomVariableName')); - - $view->setFooterMessage(Piwik_Translate('CustomVariables_TrackingHelp', array('<a target="_blank" href="http://piwik.org/docs/custom-variables/">', '</a>'))); - - return $this->renderView($view, $fetch); + return Piwik_ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } public function getCustomVariablesValuesFromNameId($fetch = false) { - $view = ViewDataTable::factory(); - $view->init($this->pluginName, __FUNCTION__, 'CustomVariables.getCustomVariablesValuesFromNameId'); - - $this->configureView($view); - $view->disableSearchBox(); - $view->disableExcludeLowPopulation(); - $view->setColumnTranslation('label', Piwik_Translate('CustomVariables_ColumnCustomVariableValue')); - return $this->renderView($view, $fetch); - } - - protected function configureView($view) - { - $view->setColumnsToDisplay(array('label', 'nb_actions', 'nb_visits')); - $view->setSortedColumn('nb_actions'); - $view->enableShowGoals(); + return Piwik_ViewDataTable::renderReport($this->pluginName, __FUNCTION__, $fetch); } - - } diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index 055ce64993..30ebb6b580 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -31,13 +31,14 @@ class Piwik_CustomVariables extends Plugin public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessing_Day.compute' => 'archiveDay', - 'ArchiveProcessing_Period.compute' => 'archivePeriod', - 'WidgetsList.add' => 'addWidgets', - 'Menu.add' => 'addMenus', - 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', - 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'ArchiveProcessing_Day.compute' => 'archiveDay', + 'ArchiveProcessing_Period.compute' => 'archivePeriod', + 'WidgetsList.add' => 'addWidgets', + 'Menu.add' => 'addMenus', + 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', + 'API.getReportMetadata' => 'getReportMetadata', + 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'ViewDataTable.getReportDisplayProperties' => 'getReportDisplayProperties', ); return $hooks; } @@ -149,4 +150,40 @@ class Piwik_CustomVariables extends Plugin $archiving->archivePeriod(); } } + + public function getReportDisplayProperties(&$properties) + { + $properties['CustomVariables.getCustomVariables'] = $this->getDisplayPropertiesForGetCustomVariables(); + $properties['CustomVariables.getCustomVariablesValuesFromNameId'] = + $this->getDisplayPropertiesForGetCustomVariablesValuesFromNameId(); + } + + private function getDisplayPropertiesForGetCustomVariables() + { + $footerMessage = Piwik_Translate('CustomVariables_TrackingHelp', + array('<a target="_blank" href="http://piwik.org/docs/custom-variables/">', '</a>')); + + return array( + 'columns_to_display' => array('label', 'nb_actions', 'nb_visits'), + 'filter_sort_column' => 'nb_actions', + 'filter_sort_order' => 'desc', + 'show_goals' => true, + 'subtable_controller_action' => 'getCustomVariablesValuesFromNameId', + 'translations' => array('label' => Piwik_Translate('CustomVariables_ColumnCustomVariableName')), + 'show_footer_message' => $footerMessage + ); + } + + private function getDisplayPropertiesForGetCustomVariablesValuesFromNameId() + { + return array( + 'columns_to_display' => array('label', 'nb_actions', 'nb_visits'), + 'filter_sort_column' => 'nb_actions', + 'filter_sort_order' => 'desc', + 'show_goals' => true, + 'show_search' => false, + 'show_exclude_low_population' => false, + 'translations' => array('label' => Piwik_Translate('CustomVariables_ColumnCustomVariableValue')) + ); + } } |