-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetting.php
309 lines (305 loc) · 14.9 KB
/
setting.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?php
require ('config.php');
include ('includes/db.php');
include ('includes/header.php');
include ('includes/sidebar.php');
$setting = $db->query("SELECT * FROM `settings` WHERE `type` = 'site_url'")-> fetch_assoc();
$value = $_GET['value'];
?>
<title>Cài đặt</title>
<link href="dist/css/pages/form-page.css" rel="stylesheet">
<link href="assets/extra-libs/prism/prism.css" rel="stylesheet">
<link href="assets/extra-libs/noui-slider/nouislider.css" rel="stylesheet">
<div class="page-wrapper">
<!-- ============================================================== -->
<!-- Title and breadcrumb -->
<!-- ============================================================== -->
<div class="page-titles">
<div class="d-flex align-items-center">
<h5 class="font-medium m-b-0">Cài đặt</h5>
<div class="custom-breadcrumb ml-auto">
<a href="#!" class="breadcrumb">Trang chủ</a>
<a href="#!" class="breadcrumb">Cài đặt</a>
</div>
</div>
</div>
<?php
switch ($value) {
case 'hethong':
echo '
<div class="container-fluid">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title">Chọn mục cài đặt</h5>
<div class="collection">
<a href="setting.php?value=hethong" class="collection-item active">Cài đặt hệ thống</a>
<a href="setting.php?value=canhbao" class="collection-item">Cài đặt cảnh báo</a>
<a href="setting.php?value=gioihan" class="collection-item">Cài đặt giới hạn</a>
</div>
</div>
</div>
</div>';
echo '
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title activator">Cài đặt hệ thống<i class="material-icons right tooltipped" data-position="left" data-delay="50">more_vert</i></h5>
</div>
<div class="divider"></div>
<form class="h-form b-form striped-rows" name="hethong" action="includes/change-setting.php" method="post">
<input type="text" hidden name="part" value="hethong">
<div class="form-body">
<div class="card-content">
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="full-n">URL của Website</label>
</div>
</div>
<div class="input-field col s9">
<input id="full-n" type="text" name="site-url" placeholder="Nhập URL của hệ thống" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'system_site_url'")-> fetch_assoc()['value'] .'">
</div>
</div>
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="fb-url">Firebase URL</label>
</div>
</div>
<div class="input-field col s9">
<input id="fb-url" name="firebase-url" type="text" placeholder="Firebase URL" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'system_firebase_url'")-> fetch_assoc()['value'] .'">
</div>
</div>
</div>
</div>
<div class="divider"></div>
<div class="card-content">
<div class="form-action">
<button class="btn cyan waves-effect waves-light" type="submit" name="action">Save
</button>
<button class="btn waves-effect waves-light grey darken-4" type="submit" name="action">Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>';
break;
case 'canhbao':
echo '
<div class="container-fluid">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title">Chọn mục cài đặt</h5>
<div class="collection">
<a href="setting.php?value=hethong" class="collection-item">Cài đặt hệ thống</a>
<a href="setting.php?value=canhbao" class="collection-item active">Cài đặt cảnh báo</a>
<a href="setting.php?value=gioihan" class="collection-item">Cài đặt giới hạn</a>
</div>
</div>
</div>
</div>';
echo '
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title activator">Cài đặt cảnh báo<i class="material-icons right tooltipped" data-position="left" data-delay="50">more_vert</i></h5>
</div>
<div class="divider"></div>
<form class="h-form b-form striped-rows" name="hethong" action="includes/change-setting.php" method="post">
<input type="text" hidden name="part" value="canhbao">
<div class="form-body">
<div class="card-content">
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="full-n1">Số điện thoại thứ nhất</label>
</div>
</div>
<div class="input-field col s9">
<input id="full-n1" type="tel" name="phone1" min="10" max="10" placeholder="Nhập số điện thoại phụ huynh 1" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'alert_phone_1'")-> fetch_assoc()['value'] .'">
</div>
</div>
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="full-n2">Số điện thoại thứ hai</label>
</div>
</div>
<div class="input-field col s9">
<input id="full-n2" type="tel" name="phone2" placeholder="Nhập số điện thoại phụ huynh 2" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'alert_phone_2'")-> fetch_assoc()['value'] .'">
</div>
</div>
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="full-n3">Số điện thoại thứ ba</label>
</div>
</div>
<div class="input-field col s9">
<input id="full-n3" type="tel" name="phone3" placeholder="Nhập số điện thoại phụ huynh 3" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'alert_phone_3'")-> fetch_assoc()['value'] .'">
</div>
</div>
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="cooldown">Khoảng cách giữa 2 lần cảnh báo liên tiếp(giây)</label>
</div>
</div>
<div class="input-field col s9">
<input id="full-n3" type="text" name="cooldown" min="0" max="100" placeholder="Nhập thời gian" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'alert_cooldown'")-> fetch_assoc()['value'] .'">
</div>
</div>
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="temp">Nhiệt độ giới hạn</label>
</div>
</div>
<div class="input-field col s9">
<br />
<div id="range-input">
<input type="number" name="Slider_Min" id="Slider_Min" value="" hidden>
<input type="number" name="Slider_Max" id="Slider_Max" value="" hidden>
</div>
</div>
</div>
</div>
</div>
<div class="divider"></div>
<div class="card-content">
<div class="form-action">
<button class="btn cyan waves-effect waves-light" type="submit" name="action">Save
</button>
<button class="btn waves-effect waves-light grey darken-4" type="submit" name="action">Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>';
break;
case 'gioihan':
echo '
<div class="container-fluid">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title">Chọn mục cài đặt</h5>
<div class="collection">
<a href="setting.php?value=hethong" class="collection-item">Cài đặt hệ thống</a>
<a href="setting.php?value=canhbao" class="collection-item">Cài đặt cảnh báo</a>
<a href="setting.php?value=gioihan" class="collection-item active">Cài đặt giới hạn</a>
</div>
</div>
</div>
</div>
';
echo '
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title activator">Cài đặt hệ thống<i class="material-icons right tooltipped" data-position="left" data-delay="50">more_vert</i></h5>
</div>
<div class="divider"></div>
<form class="h-form b-form striped-rows" name="gioihan" action="includes/change-setting.php" method="post">
<input type="text" hidden name="part" value="gioihan">
<div class="form-body">
<div class="card-content">
<div class="row">
<div class="col s3">
<div class="h-form-label">
<label for="tv-limit">Giới hạn thời gian xem TV một ngày</label>
</div>
</div>
<div class="input-field col s9">
<input id="tv-limit" type="number" name="tv-limit" placeholder="Nhập số phút trẻ được xem TV mỗi ngày(phút):" value="'.$db->query("SELECT * FROM `settings` WHERE `type` = 'limit_tv'")-> fetch_assoc()['value'] .'">
</div>
</div>
</div>
</div>
<div class="divider"></div>
<div class="card-content">
<div class="form-action">
<button class="btn cyan waves-effect waves-light" type="submit" name="action">Save
</button>
<button class="btn waves-effect waves-light grey darken-4" type="submit" name="action">Cancel
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>';
break;
default:
echo '
<div class="container-fluid">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content">
<h5 class="card-title">Chọn mục cài đặt</h5>
<div class="collection">
<a href="setting.php?value=hethong" class="collection-item">Cài đặt hệ thống</a>
<a href="setting.php?value=canhbao" class="collection-item">Cài đặt cảnh báo</a>
<a href="setting.php?value=gioihan" class="collection-item">Cài đặt giới hạn</a>
</div>
</div>
</div>
</div>
</div>
</div>';
}?>
<!-- ============================================================== -->
<!-- Container fluid scss in scafholding.scss -->
<!-- ============================================================== -->
<footer class="center-align m-b-30">All Rights Reserved by Hoang Le. Designed and Developed by <a href="https://hzv.io">HZV.io</a>.</footer>
</div>
<script src="assets/extra-libs/prism/prism.js"></script>
<?php include('includes/footer.php');?>
<!-- ============================================================== -->
<!-- This page plugin js -->
<!-- ============================================================== -->
<script src="assets/extra-libs/prism/prism.js"></script>
<script src="assets/extra-libs/noui-slider/nouislider.js"></script>
<script type="text/javascript">
var slider = document.getElementById('range-input');
var tempMin = document.getElementById("tempMin-input");
var tempMax = document.getElementById("tempMax-input");
noUiSlider.create(slider, {
start: [<?php echo $db->query("SELECT * FROM `settings` WHERE `type` = 'alert_tempMin'")-> fetch_assoc()['value'];?>, <?php echo $db->query("SELECT * FROM `settings` WHERE `type` = 'alert_tempMax'")-> fetch_assoc()['value'];?>],
connect: true,
step: 1,
orientation: 'horizontal',
range: {
'min': 10,
'max': 44
},
format: wNumb({
decimals: 0
})
});
slider.noUiSlider.on('update', function (values, handle) {
if (handle) {
tempMax = values[handle];
document.getElementById("Slider_Max").value = values[handle];
} else {
tempMin = values[handle];
document.getElementById("Slider_Min").value = values[handle];
}
});
</script>