diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-04-07 03:48:26 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2009-04-07 03:48:26 +0400 |
commit | 871961b4643c247109e9d28afe7679fb0969cdc6 (patch) | |
tree | ab5e641c072fa442199c8748dd397e2c6833a611 /plugins/UserCountry | |
parent | 6139e8532368af2e6b3d3e1ada9f54ca4cdee487 (diff) |
- finishes fixes #640 now unique visitors column won't show for periods in reports and API responses
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/Controller.php | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index e38f090e9e..ecf5c0548f 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -18,33 +18,39 @@ class Piwik_UserCountry_Controller extends Piwik_Controller function getCountry( $fetch = false) { - $view = Piwik_ViewDataTable::factory(); - $view->init( $this->pluginName, __FUNCTION__, "UserCountry.getCountry" ); - $view->disableExcludeLowPopulation(); - - $view->setColumnsToDisplay( array('label','nb_uniq_visitors') ); - $view->setSortedColumn( 1 ); + $view = $this->getStandardDataTableUserCountry(__FUNCTION__, "UserCountry.getCountry"); $view->setLimit( 5 ); - $view->enableShowGoals(); - return $this->renderView($view, $fetch); } function getContinent( $fetch = false) { - $view = Piwik_ViewDataTable::factory( 'graphVerticalBar' ); - $view->init( $this->pluginName, __FUNCTION__, "UserCountry.getContinent" ); - $view->disableExcludeLowPopulation(); + $view = $this->getStandardDataTableUserCountry(__FUNCTION__, "UserCountry.getContinent", 'graphVerticalBar'); $view->disableSearchBox(); $view->disableOffsetInformation(); - $view->disableSort(); - $view->setColumnsToDisplay( array('label','nb_uniq_visitors') ); - $view->setSortedColumn( 1 ); - $view->enableShowGoals(); - return $this->renderView($view, $fetch); } + protected function getStandardDataTableUserCountry( $currentControllerAction, + $APItoCall, + $defaultDatatableType = null ) + { + $view = Piwik_ViewDataTable::factory( $defaultDatatableType ); + $view->init( $this->pluginName, $currentControllerAction, $APItoCall ); + $view->disableExcludeLowPopulation(); + + $this->setPeriodVariablesView($view); + $column = 'nb_visits'; + if($view->period == 'day') + { + $column = 'nb_uniq_visitors'; + } + $view->setColumnsToDisplay( array('label',$column) ); + $view->setSortedColumn( $column ); + $view->enableShowGoals(); + return $view; + } + function getNumberOfDistinctCountries( $fetch = false) { return $this->getNumericValue('UserCountry.getNumberOfDistinctCountries'); |