diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-28 05:01:33 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-28 05:01:33 +0400 |
commit | 80c4b4604020201d3fff0f232f6fff824ab1cb9b (patch) | |
tree | 33ba78364eff0d9dd09c7312446f055f27629a62 /plugins/CustomVariables/CustomVariables.php | |
parent | d99e37ebc3e98f8eae1a043eb9f94e0a4aa43c9a (diff) |
Refs #4040, converted CustomVariables plugin to use display properties instead of manually calling ViewDataTable functions.
Diffstat (limited to 'plugins/CustomVariables/CustomVariables.php')
-rw-r--r-- | plugins/CustomVariables/CustomVariables.php | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php index 9a402c192f..24a363d136 100644 --- a/plugins/CustomVariables/CustomVariables.php +++ b/plugins/CustomVariables/CustomVariables.php @@ -27,13 +27,14 @@ class Piwik_CustomVariables extends Piwik_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; } @@ -145,4 +146,40 @@ class Piwik_CustomVariables extends Piwik_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')) + ); + } } |