Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-05-23 03:37:47 +0400
committermattab <matthieu.aubry@gmail.com>2013-05-23 03:37:47 +0400
commitc2f90ff1d136f2b3bb7375b0db93a54419daa672 (patch)
treeb53c891eb4650ef19a3c6c1751b778213544559e /plugins
parent4b3b0f191642ce46daffd0f9eaccd79dfd9d3eae (diff)
fixing real time map
Diffstat (limited to 'plugins')
-rw-r--r--plugins/UserCountryMap/Controller.php29
1 files changed, 17 insertions, 12 deletions
diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php
index 611bd71ef0..ba6a44db94 100644
--- a/plugins/UserCountryMap/Controller.php
+++ b/plugins/UserCountryMap/Controller.php
@@ -66,20 +66,15 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller
'no_data' => Piwik_Translate('CoreHome_ThereIsNoDataForThisReport')
));
- // template for ajax requests
- $params = array(
+ $view->reqParamsJSON = $this->getEnrichedRequest($params = array(
'period' => $period,
'idSite' => $idSite,
'date' => $date,
'token_auth' => $token_auth,
- 'format' => 'json',
- 'segment' => Piwik_ViewDataTable::getRawSegmentFromRequest(),
- 'showRawMetrics' => 1,
'enable_filter_excludelowpop' => 1,
'filter_excludelowpop_value' => -1
- );
- $params = array_filter($params);
- $view->reqParamsJSON = Piwik_Common::json_encode($params);
+ ));
+
$view->metrics = $config['metrics'] = $this->getMetrics($idSite, $period, $date, $token_auth);
$config['svgBasePath'] = 'plugins/UserCountryMap/svg/';
$config['mapCssPath'] = 'plugins/UserCountryMap/css/map.css';
@@ -140,19 +135,29 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller
'goal_conversions' => Piwik_Translate('UserCountryMap_GoalConversions'),
));
- $view->reqParamsJSON = json_encode(array(
+ $view->reqParamsJSON = $this->getEnrichedRequest(array(
'period' => 'range',
'idSite' => $idSite,
'date' => self::REAL_TIME_WINDOW,
'token_auth' => $token_auth,
- 'format' => 'json',
- 'segment' => Piwik_ViewDataTable::getRawSegmentFromRequest(),
- 'showRawMetrics' => 1
));
echo $view->render();
}
+ private function getEnrichedRequest($params)
+ {
+ $params['format'] = 'json';
+ $params['showRawMetrics'] = 1;
+ $segment = Piwik_ViewDataTable::getRawSegmentFromRequest();
+ if(!empty($segment)) {
+ $params['segment'] = $segment;
+ }
+
+ return Piwik_Common::json_encode($params);
+ }
+
+
private function checkUserCountryPluginEnabled()
{
if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {