-
Notifications
You must be signed in to change notification settings - Fork 3
/
SystemSettings.php
61 lines (52 loc) · 1.62 KB
/
SystemSettings.php
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
<?php
namespace Piwik\Plugins\RerUserDates;
use Piwik\Piwik;
use Piwik\Settings\Setting;
use Piwik\Settings\FieldConfig;
/**
* Defines Settings for RerUserDates.
*
* Usage like this:
* $s = new SystemSettings();
* $s->metric->getValue();
* $s->description->getValue();
*/
class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings
{
/** @var Setting */
public $profiles;
/** @var Setting */
public $calendars;
protected function init()
{
$this->profiles = $this->createProfileSettings();
$this->calendars = $this->createCalendarSettings();
}
/**
* @return \Piwik\Settings\Plugin\SystemSetting
*/
private function createProfileSettings()
{
return $this->makeSetting('profiles',
true, // default value
FieldConfig::TYPE_BOOL,
function (FieldConfig $field){
$field->title = Piwik::translate('RerUserDates_SettingsProfiles');
$field->description = Piwik::translate('RerUserDates_SettingsProfilesDescription');;
});
}
/**
* @return \Piwik\Settings\Plugin\SystemSetting
*/
private function createCalendarSettings()
{
return $this->makeSetting('calendars',
false, // default value
FieldConfig::TYPE_BOOL,
function (FieldConfig $field){
$field->title = Piwik::translate('RerUserDates_SettingsCalendars');
$field->description = Piwik::translate('RerUserDates_SettingsCalendarsDescription');;
$field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX;
});
}
}