-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystemSettings.php
More file actions
48 lines (41 loc) · 1.55 KB
/
Copy pathSystemSettings.php
File metadata and controls
48 lines (41 loc) · 1.55 KB
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
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\EmailReportExtended;
use Piwik\Piwik;
use Piwik\Plugins\CoreAdminHome\Controller as CoreAdminController;
use Piwik\Settings\Setting;
use Piwik\Settings\FieldConfig;
use Piwik\Validators\NotEmpty;
/**
* Defines Settings for EmailReportExtended.
*
* Usage like this:
* $settings = new SystemSettings();
* $settings->metric->getValue();
* $settings->description->getValue();
*/
class SystemSettings extends \Piwik\Settings\Plugin\SystemSettings
{
/** @var Setting */
public $metric;
protected function init()
{
$isWritable = Piwik::hasUserSuperUserAccess() && CoreAdminController::isGeneralSettingsAdminEnabled();
$this->setting = $this->createMetricSetting();
$this->setting->setIsWritableByCurrentUser($isWritable);
}
private function createMetricSetting()
{
return $this->makeSettingManagedInConfigOnly("General",'scheduled_reports_truncate', $default = '23', FieldConfig::TYPE_INT, function (FieldConfig $field) {
$field->title = 'Number of rows to display';
$field->uiControl = FieldConfig::UI_CONTROL_TEXT;
$field->description = 'Define the number of rows which will be displayed within the email report. This setting override the config.ini.php file. The higher this number is, the bigger your email report will be.';
$field->validators[] = new NotEmpty();
});
}
}