forked from itflow-org/itflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_service_view_modal.php
297 lines (258 loc) · 14.9 KB
/
client_service_view_modal.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
<div class="modal" id="viewServiceModal<?php echo $service_id ?>" tabindex="-1">
<div class="modal-dialog modal-xl">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?> </h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body bg-white">
<div class="row">
<!-- Main/Left side -->
<div class="col-8 border-right">
<div class="col-12">
<h4>Service Overview: <?php echo "$service_name $service_importance_display"; ?></h4>
<b>Description:</b> <?php echo $service_description; ?> <br>
<b>Backup Info:</b> <?php echo $service_backup; ?> <br><br>
<h5><i class="nav-icon fas fa-sticky-note"></i> Notes</h5>
<div style="white-space: pre-line"><?php echo $service_notes; ?></div>
<hr>
<!-- Assets -->
<?php
if(mysqli_num_rows($sql_assets) > 0){ ?>
<h5><i class="nav-icon fas fa-desktop"></i> Assets</h5>
<ul>
<?php
// Reset the $sql_assets pointer to the start - as we've already cycled through once
mysqli_data_seek($sql_assets, 0);
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['asset_ip'])){
$ip = '('.$row["asset_ip"].')';
}
else{
$ip = '';
}
echo "<li><a href=\"client.php?client_id=$client_id&tab=assets&q=$row[asset_name]\">$row[asset_name] </a>$ip</li>";
}
?>
</ul>
<?php
}
?>
<!-- Networks -->
<?php
if($sql_assets){
$networks = [];
// Reset the $sql_assets pointer to the start
mysqli_data_seek($sql_assets, 0);
// Get networks linked to assets - push name to array
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['network_name'])){
$network_data = "$row[network_name]:$row[network_vlan]";
array_push($networks, $network_data);
}
}
// Remove duplicates
$networks = array_unique($networks);
// Display
if(!empty($networks)){ ?>
<h5><i class="nav-icon fas fa-network-wired"></i> Networks</h5>
<ul>
<?php
}
foreach($networks as $network){
$network = explode(":", $network);
echo "<li><a href=\"client.php?client_id=$client_id&tab=networks&q=$network[0]\">$network[0] </a>(VLAN $network[1])</li>";
}
// Not showing/haven't added explicitly linked networks - can't see a need for a network that doesn't have an asset on it?
// Can add at a later date if there is a use case for this
?>
</ul>
<?php
}
?>
<!-- Locations -->
<?php
if($sql_assets){
$location_names = [];
// Reset the $sql_assets pointer to the start - as we've already cycled through once
mysqli_data_seek($sql_assets, 0);
// Get locations linked to assets - push their name and vlan to arrays
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['location_name'])){
array_push($location_names, $row['location_name']);
}
}
// Remove duplicates
$location_names = array_unique($location_names);
// Display
if(!empty($location_names)){ ?>
<h5><i class="nav-icon fas fa-map-marker-alt"></i> Locations</h5>
<ul>
<?php
}
foreach($location_names as $location){
echo "<li><a href=\"client.php?client_id=$client_id&tab=locations&q=$location\">$location</a></li>";
}
?>
</ul>
<?php
}
?>
<!-- Domains -->
<?php
if(mysqli_num_rows($sql_domains) > 0){ ?>
<h5><i class="nav-icon fas fa-globe"></i> Domains</h5>
<ul>
<?php
// Reset the $sql_domains pointer to the start
mysqli_data_seek($sql_domains, 0);
// Showing linked domains
while($row = mysqli_fetch_array($sql_domains)){
if(!empty($row['domain_name'])){
echo "<li><a href=\"client.php?client_id=$client_id&tab=domains&q=$row[domain_name]\">$row[domain_name]</a></li>";
}
}
?>
</ul>
<?php
}
?>
<!-- Certificates -->
<?php
if(mysqli_num_rows($sql_certificates) > 0){ ?>
<h5><i class="nav-icon fas fa-lock"></i> Certificates</h5>
<ul>
<?php
// Reset the $sql_certificates pointer to the start
mysqli_data_seek($sql_certificates, 0);
// Showing linked certs
while($row = mysqli_fetch_array($sql_certificates)){
if(!empty($row['certificate_name'])){
echo "<li><a href=\"client.php?client_id=$client_id&tab=certificates&q=$row[certificate_name]\">$row[certificate_name] ($row[certificate_domain])</a></li>";
}
}
?>
</ul>
<?php
}
?>
</div>
</div>
<!-- Right side -->
<div class="col-4">
<div class="col-12">
<h4>Additional Related Items</h4>
<br>
<!-- Vendors -->
<?php
// Reset the $sql_vendors pointer to the start
mysqli_data_seek($sql_vendors, 0);
if(mysqli_num_rows($sql_vendors) > 0){ ?>
<h5><i class="nav-icon fas fa-users"></i> Vendors</h5>
<ul>
<?php
while($row = mysqli_fetch_array($sql_vendors)){
echo "<li><a href=\"client.php?client_id=$client_id&tab=vendors&q=$row[vendor_name]\">$row[vendor_name]</a></li>";
}
?>
</ul>
<?php
}
?>
<!-- Contacts -->
<?php
if(mysqli_num_rows($sql_contacts) > 0){ ?>
<h5><i class="nav-icon fas fa-building"></i> Contacts</h5>
<ul>
<?php
// Reset the $sql_contacts pointer to the start
mysqli_data_seek($sql_contacts, 0);
while($row = mysqli_fetch_array($sql_contacts)){
echo "<li><a href=\"client.php?client_id=$client_id&tab=contacts&q=$row[contact_name]\">$row[contact_name]</a></li>";
}
?>
</ul>
<?php
}
?>
<!-- Logins -->
<?php
if(mysqli_num_rows($sql_assets) > 0 OR mysqli_num_rows($sql_logins) > 0){ ?>
<h5><i class="nav-icon fas fa-key"></i> Logins</h5>
<ul>
<?php
// Reset the $sql_assets/logins pointer to the start
mysqli_data_seek($sql_assets, 0);
mysqli_data_seek($sql_logins, 0);
// Showing logins linked to assets
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['login_name'])){
echo "<li><a href=\"client.php?client_id=$client_id&tab=logins&q=$row[login_name]\">$row[login_name]</a></li>";
}
}
// Showing explicitly linked logins
while($row = mysqli_fetch_array($sql_logins)){
if(!empty($row['login_name'])){
echo "<li><a href=\"client.php?client_id=$client_id&tab=logins&q=$row[login_name]\">$row[login_name]</a></li>";
}
}
?>
</ul>
<?php
}
?>
<!-- URLs -->
<?php
if($sql_logins OR $sql_assets){ ?>
<h5><i class="nav-icon fas fa-link"></i> URLs</h5>
<ul>
<?php
// Reset the $sql_logins pointer to the start
mysqli_data_seek($sql_logins, 0);
// Showing URLs linked to logins
while($row = mysqli_fetch_array($sql_logins)){
if(!empty($row['login_uri'])){
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
}
}
// Reset the $sql_assets pointer to the start
mysqli_data_seek($sql_assets, 0);
// Show URLs linked to assets, that also have logins
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['login_uri'])){
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
}
}
?>
</ul>
<?php
}
?>
<!-- Documents -->
<?php
if(mysqli_num_rows($sql_docs) > 0){ ?>
<h5><i class="nav-icon fas fa-file-alt"></i> Documents</h5>
<ul>
<?php
// Reset the $sql_docs pointer to the start
mysqli_data_seek($sql_docs, 0);
while($row = mysqli_fetch_array($sql_docs)){
echo "<li><a href=\"client.php?client_id=$client_id&tab=documents&q=$row[document_name]\">$row[document_name]</a></li>";
}
?>
</ul>
<?php
}
?>
<!-- <h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>-->
<!-- <ul>-->
<!-- <li>Related Service - Coming soon!</li>-->
<!-- </ul>-->
</div>
</div>
</div>
</div>
</div>
</div>