|
1
|
|
|
<?php |
|
2
|
|
|
namespace dukt\analytics\models; |
|
3
|
|
|
|
|
4
|
|
|
use craft\base\Model; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class Settings |
|
8
|
|
|
* |
|
9
|
|
|
* @package dukt\analytics\models |
|
10
|
|
|
*/ |
|
11
|
|
|
class Settings extends Model |
|
12
|
|
|
{ |
|
13
|
|
|
// Properties |
|
14
|
|
|
// ========================================================================= |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var string The amount of time cache should last. The value should be set as a [PHP date interval](http://www.php.net/manual/en/dateinterval.construct.php). |
|
18
|
|
|
*/ |
|
19
|
|
|
public $cacheDuration = 'PT10M'; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var bool Whether requests to APIs should be cached or not. |
|
23
|
|
|
*/ |
|
24
|
|
|
public $enableCache = true; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var bool Whether the Report field type is enabled or not. |
|
28
|
|
|
*/ |
|
29
|
|
|
public $enableFieldtype = true; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var bool Whether the Realtime widget is enabled or not. |
|
33
|
|
|
*/ |
|
34
|
|
|
public $enableRealtime = false; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var bool Whether Analytics widgets are enabled or disabled. |
|
38
|
|
|
*/ |
|
39
|
|
|
public $enableWidgets = true; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var string|null Google Maps API key. Used by the Geo chart. |
|
43
|
|
|
*/ |
|
44
|
|
|
public $mapsApiKey; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var string|null The Google API application’s OAuth client ID. |
|
48
|
|
|
*/ |
|
49
|
|
|
public $oauthClientId; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string|null The Google API application’s OAuth client Secret. |
|
53
|
|
|
*/ |
|
54
|
|
|
public $oauthClientSecret; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @var array OAuth provider options. |
|
58
|
|
|
*/ |
|
59
|
|
|
public $oauthProviderOptions = []; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @var int Interval at which the realtime widget should refresh its data (in seconds). |
|
63
|
|
|
*/ |
|
64
|
|
|
public $realtimeRefreshInterval = 60; |
|
65
|
|
|
|
|
66
|
|
|
// Public Methods |
|
67
|
|
|
// ========================================================================= |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @inheritdoc |
|
71
|
|
|
*/ |
|
72
|
|
|
public function rules() |
|
73
|
|
|
{ |
|
74
|
|
|
return [ |
|
75
|
|
|
[['realtimeRefreshInterval'], 'number', 'integerOnly' => true], |
|
76
|
|
|
[['realtimeRefreshInterval'], 'required'], |
|
77
|
|
|
]; |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|