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

Settings.php « LeftMenu « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 95811715e493c222e835b952da9d596bfbccd11e (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?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\LeftMenu;

use Piwik\Piwik;
use Piwik\Settings\SystemSetting;
use Piwik\Settings\UserSetting;

/**
 * Defines Settings for LeftMenu.
 */
class Settings extends \Piwik\Plugin\Settings
{
    /** @var SystemSetting */
    public $globalEnabled;

    /** @var UserSetting */
    public $userEnabled;

    protected function init()
    {
        $this->setIntroduction($this->t('SettingsIntroduction'));

        $this->createGlobalEnabledSetting();

        $this->createUserEnabledSetting();
    }

    private function createGlobalEnabledSetting()
    {
        $this->globalEnabled = new SystemSetting('globalEnabled', $this->t('GlobalSettingTitle'));
        $this->globalEnabled->type = static::TYPE_BOOL;
        $this->globalEnabled->description  = $this->t('GlobalSettingDescription');
        $this->globalEnabled->inlineHelp   = $this->t('GlobalSettingInlineHelp');
        $this->globalEnabled->defaultValue = false;
        $this->globalEnabled->readableByCurrentUser = true;

        $this->addSetting($this->globalEnabled);
    }

    private function createUserEnabledSetting()
    {
        $this->userEnabled = new UserSetting('userEnabled', $this->t('UserSettingTitle'));
        $this->userEnabled->type            = static::TYPE_STRING;
        $this->userEnabled->uiControlType   = static::CONTROL_RADIO;
        $this->userEnabled->defaultValue    = 'system';
        $this->userEnabled->inlineHelp      = $this->t('UserSettingInlineHelp');
        $this->userEnabled->availableValues = array(
            'system' => Piwik::translate('General_Default'),
            'yes'    => Piwik::translate('General_Yes'),
            'no'     => Piwik::translate('General_No')
        );

        $this->addSetting($this->userEnabled);
    }

    private function t($key)
    {
        return Piwik::translate('LeftMenu_' . $key);
    }

}