diff options
author | benakamoorthi <benaka.moorthi@gmail.com> | 2012-12-15 06:45:36 +0400 |
---|---|---|
committer | benakamoorthi <benaka.moorthi@gmail.com> | 2012-12-15 06:45:36 +0400 |
commit | 70097b673f98ae39a19e3e2390cbd212ab25b3f1 (patch) | |
tree | 403ad7338469c06af39274485e6cdf5270369dee /plugins/UserCountry | |
parent | 03161c405d7a20a80422d0c64eb8dbd6c9d51bce (diff) |
Fixes #3529, modify message displayed if no data in region/city reports based on whether geoip is currently working or not.
git-svn-id: http://dev.piwik.org/svn/trunk@7629 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/Controller.php | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php index bf08563637..38fc6e94ff 100644 --- a/plugins/UserCountry/Controller.php +++ b/plugins/UserCountry/Controller.php @@ -437,15 +437,26 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin if ($dataTable->getRowsCount() == 1 && $dataTable->getFirstRow()->getColumn('label') == Piwik_Translate('General_Unknown')) { - $params = array('module' => 'UserCountry', 'action' => 'adminIndex'); - $footerMessage = Piwik_Translate('UserCountry_NoDataForGeoIPReport', array( - '<a target="_blank" href="'.Piwik_Url::getCurrentQueryStringWithParametersModified($params).'">', - '</a>', - '<a target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">', - '</a>', - '<a target="_blank" href="http://piwik.org/faq/how-to/#faq_167">', - '</a>' - )); + $footerMessage = Piwik_Translate('UserCountry_NoDataForGeoIPReport1'); + + // if GeoIP is working, don't display this part of the message + if (!$this->isGeoIPWorking()) + { + $params = array('module' => 'UserCountry', 'action' => 'adminIndex'); + $footerMessage .= ' '.Piwik_Translate('UserCountry_NoDataForGeoIPReport2', array( + '<a target="_blank" href="'.Piwik_Url::getCurrentQueryStringWithParametersModified($params).'">', + '</a>', + '<a target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">', + '</a>' + )); + } + else + { + $footerMessage .= ' '.Piwik_Translate('UserCountry_ToGeolocateOldVisits', array( + '<a target="_blank" href="http://piwik.org/faq/how-to/#faq_167">', + '</a>' + )); + } // HACK! Can't use setFooterMessage because the view gets built in the main function, // so instead we set the property by hand. @@ -479,4 +490,17 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin } return false; } + + /** + * Returns true if a GeoIP provider is installed & working, false if otherwise. + * + * @return bool + */ + private function isGeoIPWorking() + { + $provider = Piwik_UserCountry_LocationProvider::getCurrentProvider(); + return $provider instanceof Piwik_UserCountry_LocationProvider_GeoIp + && $provider->isAvailable() === true + && $provider->isWorking() === true; + } } |