PDF rausgenommen
This commit is contained in:
64
msd2/tracking/piwik/plugins/UserCountry/Reports/Base.php
Normal file
64
msd2/tracking/piwik/plugins/UserCountry/Reports/Base.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\UserCountry\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\UserCountry\UserCountry;
|
||||
use Piwik\Url;
|
||||
|
||||
abstract class Base extends \Piwik\Plugin\Report
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
$this->categoryId = 'General_Visitors';
|
||||
}
|
||||
|
||||
protected function getGeoIPReportDocSuffix()
|
||||
{
|
||||
return Piwik::translate('UserCountry_GeoIPDocumentationSuffix',
|
||||
array('<a rel="noreferrer noopener" target="_blank" href="http://www.maxmind.com/?rId=piwik">',
|
||||
'</a>',
|
||||
'<a rel="noreferrer noopener" target="_blank" href="http://www.maxmind.com/en/city_accuracy?rId=piwik">',
|
||||
'</a>')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a datatable for a view is empty and if so, displays a message in the footer
|
||||
* telling users to configure GeoIP.
|
||||
*/
|
||||
protected function checkIfNoDataForGeoIpReport(ViewDataTable $view)
|
||||
{
|
||||
$view->config->filters[] = function ($dataTable) use ($view) {
|
||||
// if there's only one row whose label is 'Unknown', display a message saying there's no data
|
||||
if ($dataTable->getRowsCount() == 1
|
||||
&& $dataTable->getFirstRow()->getColumn('label') == Piwik::translate('General_Unknown')
|
||||
) {
|
||||
$footerMessage = Piwik::translate('UserCountry_NoDataForGeoIPReport1');
|
||||
|
||||
$userCountry = new UserCountry();
|
||||
// if GeoIP is working, don't display this part of the message
|
||||
if (!$userCountry->isGeoIPWorking()) {
|
||||
$params = array('module' => 'UserCountry', 'action' => 'adminIndex');
|
||||
$footerMessage .= ' ' . Piwik::translate('UserCountry_NoDataForGeoIPReport2',
|
||||
array('<a target="_blank" href="' . Url::getCurrentQueryStringWithParametersModified($params) . '">',
|
||||
'</a>',
|
||||
'<a rel="noreferrer noopener" target="_blank" href="http://dev.maxmind.com/geoip/geolite?rId=piwik">',
|
||||
'</a>'));
|
||||
} else {
|
||||
$footerMessage .= ' ' . Piwik::translate('UserCountry_ToGeolocateOldVisits',
|
||||
array('<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/faq/how-to/#faq_167">', '</a>'));
|
||||
}
|
||||
|
||||
$view->config->show_footer_message = $footerMessage;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
40
msd2/tracking/piwik/plugins/UserCountry/Reports/GetCity.php
Normal file
40
msd2/tracking/piwik/plugins/UserCountry/Reports/GetCity.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\UserCountry\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\UserCountry\Columns\City;
|
||||
|
||||
class GetCity extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new City();
|
||||
$this->name = Piwik::translate('UserCountry_City');
|
||||
$this->documentation = Piwik::translate('UserCountry_getCityDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix();
|
||||
$this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions');
|
||||
$this->hasGoalMetrics = true;
|
||||
$this->order = 10;
|
||||
$this->subcategoryId = 'UserCountry_SubmenuLocations';
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->documentation = $this->documentation;
|
||||
$view->config->addTranslation('label', $this->dimension->getName());
|
||||
|
||||
$view->requestConfig->filter_limit = 5;
|
||||
|
||||
$this->checkIfNoDataForGeoIpReport($view);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\UserCountry\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\UserCountry\Columns\Continent;
|
||||
use Piwik\Report\ReportWidgetFactory;
|
||||
use Piwik\Widget\WidgetContainerConfig;
|
||||
use Piwik\Widget\WidgetsList;
|
||||
|
||||
class GetContinent extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new Continent();
|
||||
$this->name = Piwik::translate('UserCountry_Continent');
|
||||
$this->documentation = Piwik::translate('UserCountry_getContinentDocumentation');
|
||||
$this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions');
|
||||
$this->hasGoalMetrics = true;
|
||||
$this->order = 6;
|
||||
|
||||
$this->subcategoryId = 'UserCountry_SubmenuLocations';
|
||||
}
|
||||
|
||||
public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
|
||||
{
|
||||
$widgetsList->addWidgetConfig($factory->createContainerWidget('Continent'));
|
||||
|
||||
$widgetsList->addToContainerWidget('Continent', $factory->createWidget());
|
||||
|
||||
$widget = $factory->createWidget()->setAction('getDistinctCountries')->setName('');
|
||||
$widgetsList->addToContainerWidget('Continent', $widget);
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->show_search = false;
|
||||
$view->config->show_offset_information = false;
|
||||
$view->config->show_pagination_control = false;
|
||||
$view->config->show_limit_control = false;
|
||||
$view->config->documentation = $this->documentation;
|
||||
$view->config->addTranslation('label', $this->dimension->getName());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\UserCountry\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\UserCountry\Columns\Country;
|
||||
use Piwik\Plugins\UserCountry\LocationProvider;
|
||||
|
||||
class GetCountry extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new Country();
|
||||
$this->name = Piwik::translate('UserCountry_Country');
|
||||
$this->documentation = Piwik::translate('UserCountry_getCountryDocumentation');
|
||||
$this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions');
|
||||
$this->hasGoalMetrics = true;
|
||||
$this->order = 5;
|
||||
$this->subcategoryId = 'UserCountry_SubmenuLocations';
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->addTranslation('label', $this->dimension->getName());
|
||||
$view->config->documentation = $this->documentation;
|
||||
|
||||
$view->requestConfig->filter_limit = 5;
|
||||
|
||||
if (LocationProvider::getCurrentProviderId() == LocationProvider\DefaultProvider::ID) {
|
||||
// if we're using the default location provider, add a note explaining how it works
|
||||
$footerMessage = Piwik::translate("General_Note") . ': '
|
||||
. Piwik::translate('UserCountry_DefaultLocationProviderExplanation',
|
||||
array('<a rel="noreferrer noopener" target="_blank" href="https://matomo.org/docs/geo-locate/">', '</a>'));
|
||||
|
||||
$view->config->show_footer_message = $footerMessage;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\UserCountry\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\UserCountry\Columns\Region;
|
||||
|
||||
class GetRegion extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->dimension = new Region();
|
||||
$this->name = Piwik::translate('UserCountry_Region');
|
||||
$this->documentation = Piwik::translate('UserCountry_getRegionDocumentation') . '<br/>' . $this->getGeoIPReportDocSuffix();
|
||||
$this->metrics = array('nb_visits', 'nb_uniq_visitors', 'nb_actions');
|
||||
$this->hasGoalMetrics = true;
|
||||
$this->order = 7;
|
||||
|
||||
$this->subcategoryId = 'UserCountry_SubmenuLocations';
|
||||
}
|
||||
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
$view->config->show_exclude_low_population = false;
|
||||
$view->config->documentation = $this->documentation;
|
||||
$view->config->addTranslation('label', $this->dimension->getName());
|
||||
|
||||
$view->requestConfig->filter_limit = 5;
|
||||
|
||||
$this->checkIfNoDataForGeoIpReport($view);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user