-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalertSetting.php
184 lines (139 loc) · 5.29 KB
/
alertSetting.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
class AlertSetting{
private $notificationEnabled = False;
private $endNotification = False;
private $notificationStartHour = "00";
private $notificationEndHour = "00";
private $alertNotificationOnly ="Alert";
private $indarNotification = False;
private $amerishNotification = False;
private $esamirNotification = False;
private $hossinNotification = False;
function __construct($notificationEnabled,$endNotificationEnabled,$notificationStartTime,$notificationEndTime,$notificationType,$indarNotification,$amerishNotification,$esamirNotification,$hossinNotification){
$this->notificationEnabled = $notificationEnabled;
$this->endNotification = $endNotificationEnabled;
$this->notificationStartHour = $notificationStartTime;
$this->notificationEndHour = $notificationEndTime;
$this->alertNotificationOnly = $notificationType;
$this->indarNotification = $indarNotification;
$this->amerishNotification = $amerishNotification;
$this->esamirNotification = $esamirNotification;
$this->hossinNotification = $hossinNotification;
}
function setNotificationEnabled($state){
$this->notificationEnabled = $state;
}
function convertNotificationEnabled(){
if($this->notificationEnabled == 1){
return "checked";
}
}
function getNotificationEnabled(){
return $this->notificationEnabled;
}
function setAlertNotificationOnly($state){
$this->alertNotificationOnly = $state;
}
function convertAlertNotificationOnly($option){
if($option==$this->alertNotificationOnly){
return "selected='selected'";
}
}
function getAlertNotificationOnly(){
return $this->alertNotificationOnly;
}
//EndNotification
function setEndNotification($state){
$this->endNotification = $state;
}
function convertEndNotification(){
if($this->endNotification == 1){
return "checked";
}
}
function getEndNotification(){
return $this->endNotification;
}
//StartHour
function setNotificationStartHour($hour){
$this->notificationStartHour = $hour;
}
function getNotificationStartHour(){
return $this->notificationStartHour;
}
//EndHour
function setNotificationEndHour($hour){
$this->notificationEndHour = $hour;
}
function getNotificationEndHour(){
return $this->notificationEndHour;
}
//Indar
function setIndarNotification($state){
$this->indarNotification = $state;
}
private function convertIndarNotification(){
if($this->indarNotification == 1){
return "checked";
}
}
function getIndarNotification(){
return $this->indarNotification;
}
//Amerish
function setAmerishNotification($state){
$this->amerishNotification = $state;
}
private function convertAmerishNotification(){
if($this->amerishNotification == 1){
return "checked";
}
}
function getAmerishNotification(){
return $this->amerishNotification;
}
//Esamir
function setEsamirNotification($state){
$this->esamirNotification = $state;
}
private function convertEsamirNotification(){
if($this->esamirNotification == 1){
return "checked";
}
}
function getEsamirNotification(){
return $this->esamirNotification;
}
//Hossin
function setHossinNotification($state){
$this->hossinNotification = $state;
}
private function convertHossinNotification(){
if($this->hossinNotification == 1){
return "checked";
}
}
function getHossinNotification(){
return $this->hossinNotification;
}
function getAlertSettingUI(){
$ui = "<form action='updateAlertSetting' method='POST'>\n";
$ui .= "<p> Planetside 2 Alert Settings:</p>\n";
$ui .= "<p> Enable PS2 Alert notification.<input type='checkbox' name='ps2NotificationState' {$this->convertNotificationEnabled()} /></p>";
$ui .= "<p> Send email when an <select name='eventTypes'>";
$ui .= "<option value='0' title='You will get notified by every game event' {$this->convertAlertNotificationOnly(0)}>Event</option>";
$ui .= "<option value='1' title='You will only get notified when an game alert event is happening '{$this->convertAlertNotificationOnly(1)}>Alert</option>";
$ui .= "</select>";
$ui .= " is happening.</p>";
$ui .= "<p> Only notify when and Event/Alert is happening on Indar<input type='checkbox' name='indar' {$this->convertIndarNotification()} />";
$ui .= "Amerish<input type='checkbox' name='amerish' {$this->convertAmerishNotification()} />";
$ui .= "Esamir<input type='checkbox' name='esamir' {$this->convertEsamirNotification()} />";
$ui .= "Hossin<input type='checkbox' name='hossin' {$this->convertHossinNotification()} /></p>";
$ui .= "<p> Only send those between <input type='number' max='24' id='from' name='from' value='{$this->getNotificationStartHour()}'required/> and <input max='24' type='number' id='until' name='until' value='{$this->getNotificationEndHour()}' required/> o'clock. (24h format) </p>";
$ui .= "<p> Also send an Event/Alert end notification.<input title='If checked you also get a notification when an Event/Alert ended' type='checkbox' name='ps2EndEventNotification' {$this->convertEndNotification()}/></p>";
$ui .= "<p><button>Submit PS2 Alert settings</button></p>";
$ui .= "</form>";
return $ui;
}
}
?>