-
Notifications
You must be signed in to change notification settings - Fork 0
/
LibraryAlertAndDay.php
222 lines (211 loc) · 7.28 KB
/
LibraryAlertAndDay.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?php
// Hàm điều hướng trang
class Redirect {
public function __construct($url = null) {
if ($url)
{
echo '<script>location.href="'.$url.'";</script>';
}
}
}
// Hàm làm mới trang
class Reload {
public function __construct($url = null,$time = null) {
if ($url) {
if ($time) {
echo '<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, '.$time.'000); //will call the function after $time secs.
</script>';
} else {
echo '<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
}
}
}
}
// Hàm thông báo công việc thành công
class Success {
public function __construct($url = null,$alert = null) {
if ($url) {
if ($alert) {
echo '<div class="alert alert-success">'.$alert.'</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else echo '<div class="alert alert-success">Thành công</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else if ($alert) {
echo '<div class="alert alert-success" id="Success">'.$alert.'</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#Success').fadeOut(2000);
}, 2000);
</script>";
} else echo '<div class="alert alert-success" id="Success">Thành công</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#Success').fadeOut(2000);
}, 2000);
</script>";
}
}
// Hàm cảnh báo một việc làm nào đó
class Warning {
public function __construct($url = null,$alert = null) {
if ($url) {
if ($alert) {
echo '<div class="alert alert-warning">'.$alert.'</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else echo '<div class="alert alert-warning">Cảnh báo</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else if ($alert) {
echo '<div class="alert alert-warning" id="warning">'.$alert.'</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#warning').fadeOut(2000);
}, 2000);
</script>";
} else echo '<div class="alert alert-warning" id="warning">Cảnh báo</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#warning').fadeOut(2000);
}, 2000);
</script>";
}
}
// Hàm cảnh báo nguy hiểm
class Danger {
public function __construct($url = null,$alert = null) {
if ($url) {
if ($alert) {
echo '<div class="alert alert-danger">'.$alert.'</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else echo '<div class="alert alert-danger">Nguy hiểm</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else if ($alert) {
echo '<div class="alert alert-danger" id="danger">'.$alert.'</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#danger').fadeOut(2000);
}, 2000);
</script>";
} else echo '<div class="alert alert-danger" id="danger">Nguy hiểm</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#danger').fadeOut(2000);
}, 2000);
</script>";
}
}
// Hàm thông báo một mẩu tin
class Info {
public function __construct($url = null,$alert = null) {
if ($url) {
if ($alert) {
echo '<div class="alert alert-info">'.$alert.'</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else echo '<div class="alert alert-info">Thông tin</div>
<script type="text/javascript">
setTimeout(function () {
window.location.href = "'.$url.'"; //will redirect to your blog page (an ex: blog.html)
}, 2000); //will call the function after 2 secs.
</script>';
} else if ($alert) {
echo '<div class="alert alert-info" id="info">'.$alert.'</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#info').fadeOut(2000);
}, 2000);
</script>";
} else echo '<div class="alert alert-info" id="info">Thông tin</div>
<script type="text/javascript">'."
setTimeout(function() {
$('#info').fadeOut(2000);
}, 2000);
</script>";
}
}
//Get day
Function get_day($day,$month,$year) {
$month_array_365 = array('1' => 31,
'2' => 28,
'3' => 31,
'4' => 30,
'5' => 31,
'6' => 30,
'7' => 31,
'8' => 31,
'9' => 30,
'10' => 31,
'11' => 30,
'12' => 31,
);
$month_array_366 = array('1' => 31,
'2' => 29,
'3' => 31,
'4' => 30,
'5' => 31,
'6' => 30,
'7' => 31,
'8' => 31,
'9' => 30,
'10' => 31,
'11' => 30,
'12' => 31,
);
if ($year%4 == 0) {
$year = 366;
$get_day_of_month = $month_array_366;
} else {
$year = 365;
$get_day_of_month = $month_array_365;
}
$day_of_months = 0;
for ($i=1; $i < $month; $i++) {
$get_days = $get_day_of_month[$i];
$day_of_months = $day_of_months + $get_days;
}
return $year + $day_of_months + $day;
}
//Get date
Function get_day_on_date($date) {
return substr($date, 8, 2);
}
Function get_month_on_date($date) {
return substr($date, 5, 2);
}
Function get_year_on_date($date) {
return substr($date, 0, 4);
}
?>