mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
[Quick Lookup] Add info about dxcc for grid
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user