mirror of
https://github.com/itflow-org/itflow
synced 2026-03-24 14:35:38 +00:00
De-duplicate location
This commit is contained in:
@@ -78,23 +78,35 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- Domains -->
|
<!-- Locations -->
|
||||||
<?php
|
<?php
|
||||||
if($sql_assets){ ?>
|
if($sql_assets){
|
||||||
<h5><i class="nav-icon fas fa-map-marker-alt"></i> Locations</h5>
|
|
||||||
<ul>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
$location_names = [];
|
||||||
mysqli_data_seek($sql_assets, 0);
|
|
||||||
|
|
||||||
// Showing linked locations (from assets)
|
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||||
while($row = mysqli_fetch_array($sql_assets)){
|
mysqli_data_seek($sql_assets, 0);
|
||||||
if(!empty($row['location_name'])){
|
|
||||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=locations&q=$row[location_name]\">$row[location_name]</a></li>";
|
// 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>
|
</ul>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user