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

Country.php « Columns « UserCountry « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a84106ecd670714e67f281d3516786958f9af2c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */
namespace Piwik\Plugins\UserCountry\Columns;

use Piwik\Piwik;
use Piwik\Plugin\VisitDimension;
use Piwik\Plugins\UserCountry\Segment;

class Country extends VisitDimension
{    
    protected $fieldName = 'location_country';

    protected function init()
    {
        $segment = new Segment();
        $segment->setSegment('countryCode');
        $segment->setName('UserCountry_Country');
        $segment->setAcceptValues('de, us, fr, in, es, etc.');
        $this->addSegment($segment);

        $segment = new Segment();
        $segment->setSegment('continentCode');
        $segment->setName('UserCountry_Continent');
        $segment->setSqlFilter('Piwik\Plugins\UserCountry\UserCountry::getCountriesForContinent');
        $segment->setAcceptValues('eur, asi, amc, amn, ams, afr, ant, oce');
        $this->addSegment($segment);
    }

    public function getName()
    {
        return Piwik::translate('UserCountry_Country');
    }
}