-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.php
517 lines (394 loc) · 16.7 KB
/
info.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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<?php
require_once('config.php');
require_once('head.php');
$m = $_GET['m'];
$id_dslam = $_GET['adsl'];
$id_gpon = $_GET['gpon'];
$err_msg = "<div class=\"error__message error__message--with-icon\"><i class=\"icon-exclamation-sign\"></i> <span>Щось пішло не так...</span></div>";
?>
<div class="container">
<?php
if ($_COOKIE['group']) {
require_once('header.php');
require_once('search-form.php');
// довідник адсл-плат
if ($m == 2) {
$q = mysqli_query($connect, "SELECT *, (nomer_dslam * 1) AS n_dslam FROM name_dslam ORDER BY n_dslam"); ?>
<div class="block">
<div class="d-flex align-content-center justify-content-between">
<h3>Довідник ADSL плат</h3>
<div class="d-flex align-items-center">
<a href="" data-bs-toggle="modal" data-bs-target="#addAdslPlate">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="додати плату">
<i class="fa-solid fa-square-plus fs-4"></i>
</div>
</a>
</div>
</div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-2">Id DSLAM</div>
<div class="head-title head-title--primary col-sm-3">Пазва плати</div>
<div class="head-title head-title--primary col-sm-2">IP-адреса</div>
<div class="head-title head-title--primary col-sm-2">Зайнятих портів</div>
<div class="head-title head-title--primary col-sm-3">Розміщення на КРОСЗі</div>
</div>
<?php
while ($am = mysqli_fetch_assoc($q)) {
$ports = mysqli_num_rows(mysqli_query($connect, "SELECT id_dslam FROM db_ats WHERE id_dslam = '$am[id]'"));
?>
<div class="row row-stripped py-2" style="cursor:pointer" onclick="javascript:document.location.href='info.php?m=3&adsl=<?= $am['id'] ?>'">
<div class="col-sm-2 d-flex align-items-center"><?= $am["nomer_dslam"] ?></div>
<div class="col-sm-3 d-flex align-items-center"><?= $am["name_dslam"] ?></div>
<div class="col-sm-2 d-flex align-items-center"><?= $am["ip_dslam"] ?></div>
<div class="col-sm-2 d-flex align-items-center"><?= $ports ?></div>
<div class="col-sm-3 d-flex align-items-center"><?= $am["cross_name"] ?></a></div>
</div>
<?php } ?>
</div>
<?php
}
// адсл плата із абонентами
if ($m == 3) {
if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM name_dslam WHERE id=$id_dslam")) != 0 && $id_dslam) {
mb_internal_encoding("UTF-8");
$q1 = mysqli_fetch_assoc(mysqli_query($connect, "SELECT * FROM name_dslam WHERE id=$id_dslam"));
$ports = mysqli_num_rows(mysqli_query($connect, "SELECT id_dslam FROM db_ats WHERE id_dslam = '$id_dslam'"));
?>
<div class="block">
<div class="d-flex algn-items-center justify-content-between">
<h3>Плата: <?php echo $q1["name_dslam"] ?> / ip: <?php echo $q1["ip_dslam"] ?></h3>
<div class="d-flex align-items-center">
<a href="" data-bs-toggle="modal" data-bs-target="#edit-dslam" class="<?php if ($ports == 0) {
echo 'me-2';
} ?>">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Редагувати">
<i class="fa-solid fa-pen-to-square fs-4"></i>
</div>
</a>
<?php
if ($group_id == 1 && $ports == 0) {
?>
<a href="" data-bs-toggle="modal" data-bs-target="#delete-dslam">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Видалити плату">
<i class="fa-solid fa-circle-xmark fs-4 text-danger"></i>
</div>
</a>
<?php
}
?>
</div>
</div>
<div class="mb-2" style="font-size: 14px;"><?= $q1["notes"] ?></div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-1">Порт</div>
<div class="head-title head-title--primary col-sm-2">Номер ТЗ</div>
<div class="head-title head-title--primary col-sm-1">Лін.дані</div>
<div class="head-title head-title--primary col-sm-4">Абонент</div>
<div class="head-title head-title--primary col-sm-4">Адреса</div>
</div>
<?php
for ($i = 1; $i <= $q1['total_ports']; $i++) {
$q = mysqli_query($connect, "SELECT *, db_ats.id AS id_ats FROM db_ats
LEFT JOIN name_dslam ON id_dslam = name_dslam.id
LEFT JOIN street ON street.id = id_ul
LEFT JOIN np ON np.id = id_np
WHERE id_dslam='$id_dslam' AND port_number='$i'");
$adsl = mysqli_fetch_assoc($q);
if (mysqli_num_rows($q) == 1) {
?>
<div class="row row-stripped py-2" style="cursor:pointer" onclick="javascript:document.location.href='client.php?id=<?= $adsl['id_ats'] ?>'">
<div class="col-sm-1 d-flex align-items-center"><?= $adsl["port_number"] ?></div>
<div class="col-sm-2 d-flex align-items-center"><?= $adsl["phone"] ?></div>
<div class="col-sm-1 d-flex align-items-center"><?= $adsl["line_data"] ?></div>
<div class="col-sm-4 d-flex align-items-center"><?= $adsl["client"] ?></div>
<div class="col-sm-4 d-flex align-items-center">
<?php
if ($adsl["np_name"]) {
if ($adsl['street_name'] || $adsl['nomer_doma'] || $adsl['korpus'] || $adsl['kv']) {
echo $adsl['np_name'] . ", ";
} else {
echo $adsl['np_name'];
}
}
if ($adsl["street_name"]) {
echo $adsl["street_name"];
if ($adsl["nomer_doma"]) {
echo " " . $adsl["nomer_doma"];
}
if ($adsl["korpus"]) {
echo "/" . $adsl["korpus"];
}
if ($adsl["kv"]) {
echo " КВ." . $adsl["kv"];
}
}
?>
</div>
</div>
<?php } else { ?>
<div class="row row-stripped py-2 bg-teal-300" style="cursor:pointer;">
<div class="col-sm-12">
<?= $i ?>
</div>
</div>
<?php }
} ?>
</div>
<?php
}
}
// виведення списку змін logversion
if ($m == 4) {
$q = mysqli_query($connect, "SELECT * FROM changelog ORDER BY `date` DESC");
?>
<div class="block">
<div class="d-flex align-items-center justify-content-between">
<h3>Історія версій</h3>
<?php
if ($group_id == 1) {
?>
<a href="" data-bs-toggle="modal" data-bs-target="#addChangeLog">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Додати changelog">
<i class="fa-solid fa-clock-rotate-left fs-4"></i>
</div>
</a>
<?php
} ?>
</div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-2">Дата</div>
<div class="head-title head-title--primary col-sm-2">Версія</div>
<div class="head-title head-title--primary col-sm-8">Зміни</div>
</div>
<?php
while ($r = mysqli_fetch_assoc($q)) { ?>
<div class="row row-stripped py-2">
<div class="col-sm-2"><?= date("d.m.Y", $r["date"]); ?></div>
<div class="col-sm-2"><?= $r['version'] ?></div>
<div class="col-sm-8"><?= $r['log'] ?></div>
</div>
<?php }
?>
</div>
<?php }
// таблиця користувачів
if ($m == 5 && $group_id == 1) {
$query = mysqli_query($connect, "SELECT * FROM `users` ORDER BY `user_name`");
?>
<div class="block">
<div class="d-flex align-content-center justify-content-between">
<div class="d-flex align-items-center">
<i class="fa-solid fa-users mb-2 me-2 fs-4 text-primary"></i>
<h3>Довідник користувачів</h3>
</div>
<div class="d-flex align-items-center">
<a href="" data-bs-toggle="modal" data-bs-target="#addNewUser">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="додати користувача">
<i class="fa-solid fa-square-plus fs-4"></i>
</div>
</a>
</div>
</div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-1">№ з/п</div>
<div class="head-title head-title--primary col-sm-2">П.І.Б.</div>
<div class="head-title head-title--primary col-sm-2">Група</div>
<div class="head-title head-title--primary col-sm-2">Посада</div>
<div class="head-title head-title--primary col-sm-2">Логін</div>
<div class="head-title head-title--primary col-sm-2">Дата реєстрації</div>
<div class="head-title head-title--primary col-sm-1">Дії</div>
</div>
<?php
$num = 0;
while ($line = mysqli_fetch_assoc($query)) {
$num++;
?>
<div class="row row-stripped py-2">
<div class="col-sm-1 d-flex align-items-center"><?= $num ?></div>
<div class="col-sm-2 d-flex align-items-center"><?= $line["user_name"] ?></div>
<div class="col-sm-2 d-flex align-items-center">
<?php
switch ($line["group"]) {
case 1:
echo "<span class=\"text-danger\">Адміністратори</span>";
break;
case 2:
echo "<span class=\"text-success\">Чергові зміни</span>";
break;
case 3:
echo "<span class=\"text-primary\">Інженери</span>";
break;
case 4:
echo "<span class=\"text-secondary\">Користувачі</span>";
break;
case 5:
echo "<span class=\"text-warning\">ЦОА</span>";
break;
}
?>
</div>
<div class="col-sm-2 d-flex align-items-center"><?= $line["position"] ?></div>
<div class="col-sm-2 d-flex align-items-center"><?= $line["login"] ?></div>
<div class="col-sm-2 d-flex align-items-center"><?php echo date('d.m.Y', $line["joindate"]); ?></div>
<div class="col-sm-1 d-flex align-items-center">
<a data-bs-toggle="modal" data-bs-target="#edit-user" href="">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Редагувати">
<i class="fa-solid fa-pen-to-square fs-5 me-2"></i>
</div>
</a>
<a data-bs-toggle="modal" data-bs-target="#delete-user" href="">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Видалити">
<i class="fa-solid fa-circle-xmark fs-5 text-danger"></i>
</div>
</a>
</div>
</div>
<?php } ?>
</div>
<?php
}
// таблиця сплітерів
if ($m == 6) {
$q = mysqli_query($connect, "SELECT *, gpon.id AS g_id FROM gpon LEFT JOIN np ON np.id = id_gpon_np LEFT JOIN street ON street.id = id_gpon_street ORDER BY np_name, street_name, gpon_building_number")
?>
<div class="block">
<div class="d-flex align-content-center justify-content-between">
<h3>Довідник GPON-сплітерів</h3>
<div class="d-flex align-items-center">
<a href="" data-bs-toggle="modal" data-bs-target="#addGponLoc">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="додати сплітер">
<i class="fa-solid fa-square-plus fs-4"></i>
</div>
</a>
</div>
</div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-3">Адреса локації</div>
<div class="head-title head-title--primary col-sm-4">Локація</div>
<div class="head-title head-title--primary col-sm-4">Сплітер</div>
<div class="head-title head-title--primary col-sm-1">Портів</div>
</div>
<?php
while ($am = mysqli_fetch_assoc($q)) {
$ports = mysqli_num_rows(mysqli_query($connect, "SELECT id_gpon FROM db_ats WHERE id_gpon = '$am[g_id]'"));
?>
<div class="row row-stripped py-2" data-settlement-id="<?= $am["id_gpon_np"] ?>" style="cursor:pointer" onclick="javascript:document.location.href='info.php?m=7&gpon=<?= $am['g_id'] ?>'">
<div class="col-sm-3 d-flex align-items-center">
<?php
if ($am['gpon_building_korpus']) {
echo $am["np_name"] . ", " . $am["street_name"] . ", б." . $am["gpon_building_number"] . "/" . $am["gpon_building_korpus"];
} else {
echo $am["np_name"] . ", " . $am["street_name"] . ", б." . $am["gpon_building_number"];
}
?></div>
<div class="col-sm-4 d-flex align-items-center text-break text-wrap"><?= $am["gpon_location"] ?></div>
<div class="col-sm-4 d-flex align-items-center text-break text-wrap"><?= $am["gpon_splitter"] ?></div>
<div class="col-sm-1 d-flex align-items-center"><span data-tooltip="tooltip" data-bs-placement="bottom" title="зайнято / всього"><?= $ports . " / " . $am["gpon_slitter_ports"] ?></span></div>
</div>
<?php } ?>
</div>
<?php
}
if ($m == 7) {
if (mysqli_num_rows(mysqli_query($connect, "SELECT * FROM gpon WHERE id=$id_gpon")) != 0 && $id_gpon) {
mb_internal_encoding("UTF-8");
$q1 = mysqli_fetch_assoc(mysqli_query($connect, "SELECT * FROM gpon WHERE id=$id_gpon"));
$ports = mysqli_num_rows(mysqli_query($connect, "SELECT id_gpon FROM db_ats WHERE id_gpon = '$id_gpon'"));
?>
<div class="block">
<div class="d-flex algn-items-center justify-content-between">
<h4>Локація: <?php echo $q1["gpon_location"] ?><br />сплітер: <?php echo $q1["gpon_splitter"] ?></h4>
<div class="d-flex align-items-center">
<a href="" data-bs-toggle="modal" data-bs-target="#edit-gpon" class="<?php if ($ports == 0) { echo 'me-2'; } ?>">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Редагувати">
<i class="fa-solid fa-pen-to-square fs-4"></i>
</div>
</a>
<?php
if ($group_id == 1 && $ports == 0) {
?>
<a href="" data-bs-toggle="modal" data-bs-target="#delete-gpon">
<div data-tooltip="tooltip" data-bs-placement="bottom" title="Видалити плату">
<i class="fa-solid fa-circle-xmark fs-4 text-danger"></i>
</div>
</a>
<?php
}
?>
</div>
</div>
<div class="client__head-row client__head-row--primary row">
<div class="head-title head-title--primary col-sm-1">Порт</div>
<div class="head-title head-title--primary col-sm-3">Номер ТЗ</div>
<div class="head-title head-title--primary col-sm-1">Лін.дані</div>
<div class="head-title head-title--primary col-sm-3">Абонент</div>
<div class="head-title head-title--primary col-sm-4">Адреса</div>
</div>
<?php
for ($i = 1; $i <= $q1['gpon_slitter_ports']; $i++) {
$q = mysqli_query($connect, "SELECT *, db_ats.id AS id_ats FROM db_ats
LEFT JOIN name_dslam ON id_dslam = name_dslam.id
LEFT JOIN street ON street.id = id_ul
LEFT JOIN np ON np.id = id_np
LEFT JOIN gpon ON gpon.id = id_gpon
WHERE id_gpon ='$id_gpon' AND port_number='$i'");
$adsl = mysqli_fetch_assoc($q);
if (mysqli_num_rows($q) == 1) {
?>
<div class="row row-stripped py-2" style="cursor:pointer" onclick="javascript:document.location.href='client.php?id=<?= $adsl['id_ats'] ?>'">
<div class="col-sm-1 d-flex align-items-center"><?= $adsl["port_number"] ?></div>
<div class="col-sm-3 d-flex align-items-center text-wrap text-break"><?= $adsl["phone"] ?></div>
<div class="col-sm-1 d-flex align-items-center"><?= $adsl["line_data"] ?></div>
<div class="col-sm-3 d-flex align-items-center"><?= $adsl["client"] ?></div>
<div class="col-sm-4 d-flex align-items-center">
<?php
if ($adsl["np_name"]) {
if ($adsl['street_name'] || $adsl['nomer_doma'] || $adsl['korpus'] || $adsl['kv']) {
echo $adsl['np_name'] . ", ";
} else {
echo $adsl['np_name'];
}
}
if ($adsl["street_name"]) {
echo $adsl["street_name"];
if ($adsl["nomer_doma"]) {
echo " " . $adsl["nomer_doma"];
}
if ($adsl["korpus"]) {
echo "/" . $adsl["korpus"];
}
if ($adsl["kv"]) {
echo " КВ." . $adsl["kv"];
}
}
?>
</div>
</div>
<?php } else { ?>
<div class="row row-stripped py-2 bg-teal-300" style="cursor:pointer;">
<div class="col-sm-12">
<?= $i ?>
</div>
</div>
<?php }
} ?>
</div>
<?php
}
}
} else {
header('Location: /');
}
?>
<?php
require_once('footer.php');
if ($group_id == 1 || $group_id == 2 || $group_id == 3) {
require_once('edit-modals.php');
}
?>
</div>
<?php
require_once('scripts.php');
?>
</body>
</html>