[Quick Lookup] Add info about dxcc for grid

This commit is contained in:
Andreas Kristiansen
2026-01-13 20:45:08 +01:00
parent dce6847f02
commit 62b9d4bce9
3 changed files with 31 additions and 1 deletions

View File

@@ -69,6 +69,10 @@ class Lookup extends CI_Controller {
$data['location_list'] = $location_list;
$data['user_map_custom'] = $this->optionslib->get_map_custom();
if ($data['type'] == 'vucc') {
$data['vuccdxcc'] = $this->lookup_model->getDxccForVucc($data['grid']);
}
$data['result'] = $this->lookup_model->getSearchResult($data);
$this->load->view('lookup/result', $data);
}

View File

@@ -27,6 +27,24 @@ class Lookup_model extends CI_Model{
return $this->getResultFromDatabase($queryinfo, $modes);
}
function getDxccForVucc($grid) {
$fixedgrid = (strlen($grid) > 4) ? substr($grid, 0, 4) : $grid;
$sql = "select name from dxcc_entities
join vuccgrids on dxcc_entities.adif = vuccgrids.adif
where gridsquare = ?";
$binds[] = $fixedgrid;
$query = $this->db->query($sql, $binds);
$dxccArray = [];
foreach ($query->result() as $row) {
$dxccArray[] = ucwords(strtolower($row->name), "- (/");
}
return $dxccArray;
}
function getResultFromDatabase($queryinfo, $modes) {
// Creating an empty array with all the bands and modes from the database
foreach ($modes as $mode) {

View File

@@ -9,7 +9,15 @@
}
</style>
<?php if (isset($vuccdxcc) && is_array($vuccdxcc) && count($vuccdxcc) > 0) {
echo '<div class="alert alert-success w-auto d-inline-block" role="alert">';
echo '<div style="display: flex; align-items: center; gap: 10px;">';
echo '<span class="fas fa-info-circle fa-2x"></span>';
echo '<div><strong>' . __("This gridsquare exists in the following DXCC(s):") . '</strong><br>';
echo implode(', ', $vuccdxcc) . '</div>';
echo '</div>';
echo '</div>';
} ?>
<?php echo '
<table style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center">