-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccess_adm.php
112 lines (110 loc) · 5.02 KB
/
access_adm.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
<div class="row">
<div class="col-md-12">
<table class="table table-bordered">
<tr>
<th>№</th>
<th>Послуга</th>
<th>Статус</th>
<th>Опис проблеми</th>
<th>Вплив</th>
<th>Категорія запиту</th>
<th>Від кого</th>
<th>Коли</th>
<th>Відповідальний</th>
<th>Видалити</th>
</tr>
<?php
$incidents = $db->getAll("SELECT * FROM incidents");
$users = $db->getOne("SELECT id FROM users");
for($i=0;$i<count($incidents);$i++){
echo("<tr>");
echo("<td>".$incidents[$i]['id']."</td>");
$des_service = $db->getOne("SELECT name FROM service WHERE id = ".$incidents[$i]['service']."");
echo("<td>".$des_service."</td>");
$status = $db->getAll("SELECT * FROM status");
echo("<td>");
echo("<form action='status_upd.php' method='POST'>");
echo("<input type='hidden' value='".$incidents[$i]['id']."' name='id'>");
echo("<select class='form-control' name='status'>");
for($y=0;$y<count($status);$y++)
{
echo("<option value='".$status[$y]['id']."'>".$status[$y]['name']."</option>");
}
echo("</select>");
echo("<button type='sumbmit' class='btn btn-primary btn-sm' style='margin: 5px'>Назначити</button>");
echo("</form>");
echo("</td>");
$desc = $incidents[$i]['description'];
echo("<td>".substr(strip_tags($desc), 0, strpos(strip_tags($desc), ' ', 10))."...</td>");
$des_influence = $db->getOne("SELECT name FROM influence WHERE id = ".$incidents[$i]['influence']."");
echo("<td>".$des_influence."</td>");
$des_class = $db->getOne("SELECT name FROM class WHERE id = ".$incidents[$i]['class']."");
echo("<td>".$des_class."</td>");
$des_from_user = $db->getRow("SELECT * FROM users WHERE id = ".$incidents[$i]['from_user']."");
echo("<td>".$des_from_user['first']." ".$des_from_user['last']."</td>");
echo("<td>".$incidents[$i]['date']."</td>");
$responsible = $db->getAll("SELECT * FROM users WHERE access = 5");
echo("<td>");
echo("<form action='responsible_upd.php' method='POST'>");
echo("<input type='hidden' value='".$incidents[$i]['id']."' name='id'>");
echo("<select class='form-control' name='responsible'>");
for($y=0;$y<count($responsible);$y++)
{
echo("<option value='".$responsible[$y]['id']."'>".$responsible[$y]['first']." ".$responsible[$y]['last']."</option>");
}
echo("</select>");
echo("<button type='sumbmit' class='btn btn-primary btn-sm' style='margin: 5px'>Назначити</button>");
echo("</form>");
echo("</td>");
echo("<td>
<button class='btn btn-warning btn-xs' data-toggle='modal' data-target='#Edit'><span class='glyphicon glyphicon-edit'></span></button>
<button class='btn btn-danger btn-xs' data-toggle='modal' data-target='#Delete".$incidents[$i]['id']."'><span class='glyphicon glyphicon-remove'></span></button>
</td>");
echo("</tr>");
}
//<center><a href='remove.php?id=".$incidents[$i]['id']."'><span class='glyphicon glyphicon-remove'></span></a></center>
?>
</table>
</div>
</div>
<!-- Modal Edit -->
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Редагування</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Закрити</button>
<button type="button" class="btn btn-primary">Відправити</button>
</div>
</div>
</div>
</div>
<!-- Modal Delete -->
<?php
$incidents = $db->getAll("SELECT * FROM incidents");
for($i=0;$i<count($incidents);$i++){
echo("<div class='modal fade' id='Delete".$incidents[$i]['id']."' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>");
echo("<div class='modal-dialog'>");
echo("<div class='modal-content'>");
echo("<div class='modal-header'>");
echo("<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>");
echo("<h4 class='modal-title' id='myModalLabel'>Видалення</h4>");
echo("</div>");
echo("<div class='modal-body'>");
echo("Ви впевнені в цьому?");
echo("</div>");
echo("<div class='modal-footer'>");
echo("<button type='button' class='btn btn-default' data-dismiss='modal'>Закрити</button>");
echo("<a class='btn btn-danger' href='remove.php?id=".$incidents[$i]['id']."'>Так</a>");
echo("</div>");
echo("</div>");
echo("</div>");
echo("</div>");
}
?>