-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
CustomAlerts.php
executable file
·109 lines (93 loc) · 2.34 KB
/
CustomAlerts.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id$
*
* @category Piwik_Plugins
* @package Piwik_Alerts
*/
namespace Piwik\Plugins\CustomAlerts;
use Piwik;
use Piwik\Db;
use Piwik\Menu\MenuTop;
use Piwik\ScheduledTask;
use Piwik\ScheduledTime;
/**
*
* @package Piwik_Alerts
*/
class CustomAlerts extends \Piwik\Plugin
{
public function getListHooksRegistered()
{
return array(
'Menu.Top.addItems' => 'addTopMenu',
'TaskScheduler.getScheduledTasks' => 'getScheduledTasks',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'AssetManager.getStylesheetFiles' => 'getCssFiles',
);
}
public function getJsFiles(&$jsFiles)
{
$jsFiles[] = "plugins/CustomAlerts/javascripts/ui.dropdownchecklist.js";
}
public function getCssFiles(&$cssFiles)
{
$cssFiles[] = "plugins/CustomAlerts/stylesheets/ui.dropdownchecklist.css";
}
public function install()
{
Model::install();
}
public function uninstall()
{
Model::uninstall();
}
public function addTopMenu()
{
MenuTop::addEntry("Alerts", array("module" => "CustomAlerts", "action" => "index"), true, 9);
}
public function getScheduledTasks(&$tasks)
{
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Processor',
'processAlerts',
'day',
ScheduledTime::factory('daily')
);
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Notifier',
'sendNewAlerts',
'day',
ScheduledTime::factory('daily')
);
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Processor',
'processAlerts',
'week',
ScheduledTime::factory('weekly')
);
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Notifier',
'sendNewAlerts',
'week',
ScheduledTime::factory('weekly')
);
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Processor',
'processAlerts',
'month',
ScheduledTime::factory('monthly')
);
$tasks[] = new ScheduledTask(
'Piwik\Plugins\CustomAlerts\Notifier',
'sendNewAlerts',
'month',
ScheduledTime::factory('monthly')
);
}
}
?>