[Quick Lookup] Added continent

This commit is contained in:
Andreas Kristiansen
2025-02-04 11:01:22 +01:00
parent ddf2c4ca96
commit e5a725d6e4
5 changed files with 63 additions and 34 deletions

View File

@@ -45,7 +45,7 @@ class Lookup extends CI_Controller {
} else {
$this->load->model('bands');
if ($this->input->post('type') == 'itu') {
if ($this->input->post('type') == 'itu' || $this->input->post('type') == 'continent') {
$data['bands'] = $this->bands->get_worked_bands();
} else {
$data['bands'] = $this->bands->get_worked_bands(xss_clean($this->input->post('type')));
@@ -63,6 +63,7 @@ class Lookup extends CI_Controller {
$data['cqz'] = xss_clean($this->input->post('cqz'));
$data['wwff'] = xss_clean($this->input->post('wwff'));
$data['ituz'] = xss_clean($this->input->post('ituz'));
$data['continent'] = xss_clean($this->input->post('continent'));
$data['location_list'] = $location_list;
$data['result'] = $this->lookup_model->getSearchResult($data);
@@ -74,22 +75,22 @@ class Lookup extends CI_Controller {
public function scp() {
session_write_close();
$uppercase_callsign = strtoupper($this->input->post('callsign', TRUE) ?? '');
// SCP results from logbook
$this->load->model('logbook_model');
$arCalls = array();
$query = $this->logbook_model->get_callsigns($uppercase_callsign);
foreach ($query->result() as $row) {
$normalized_call = str_replace('0', 'Ø', $row->COL_CALL);
$arCalls[$normalized_call] = true;
}
// SCP results from Club Log master scp db
$file = 'updates/clublog_scp.txt';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
$input = preg_quote($uppercase_callsign, '~');
@@ -107,10 +108,10 @@ class Lookup extends CI_Controller {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
// SCP results from master scp https://www.supercheckpartial.com
$file = 'updates/MASTER.SCP';
if (is_readable($file)) {
$lines = file($file, FILE_IGNORE_NEW_LINES);
$input = preg_quote($uppercase_callsign, '~');
@@ -128,10 +129,10 @@ class Lookup extends CI_Controller {
log_message('error', 'Failed to copy source file ('.$src.') to new location. Check if this path has the right permission: '.$file);
}
}
// Sort and print unique calls
ksort($arCalls);
foreach (array_keys($arCalls) as $strCall) {
echo " " . $strCall . " ";
}

View File

@@ -39,42 +39,53 @@ class Lookup_model extends CI_Model{
/*
* Builds information-where-part of query depending on what we are searching for
*/
private function build_info_query($queryinfo,&$binds) {
private function build_info_query($queryinfo, &$binds) {
$sqlquerytypestring='';
if (strlen($queryinfo['grid']) > 4) {
$fixedgrid = substr($queryinfo['grid'], 0, 4);
}
else {
$fixedgrid = $queryinfo['grid'];
}
switch ($queryinfo['type']) {
case 'dxcc':
case 'dxcc':
$sqlquerytypestring .= " and col_dxcc = ?";
$binds[]=$queryinfo['dxcc'];
$binds[]=$queryinfo['dxcc'];
break;
case 'iota':
case 'iota':
$sqlquerytypestring .= " and col_iota = ?";
$binds[]=$queryinfo['iota'];
$binds[]=$queryinfo['iota'];
break;
case 'vucc':
case 'vucc':
$sqlquerytypestring .= " and (col_gridsquare like ? or col_vucc_grids like ?)";
$binds[]='%'.$fixedgrid.'%';
$binds[]='%'.$fixedgrid.'%';
$binds[]='%'.$fixedgrid.'%';
break;
case 'cq':
case 'cq':
$sqlquerytypestring .= " and col_cqz = ?";
$binds[]=$queryinfo['cqz'];
break;
case 'was':
$sqlquerytypestring .= " and col_state = ? and COL_DXCC in ('291', '6', '110')";
case 'was':
$sqlquerytypestring .= " and col_state = ? and COL_DXCC in ('291', '6', '110')";
$binds[]=$queryinfo['was'];
break;
case 'sota':
case 'sota':
$sqlquerytypestring .= " and col_sota_ref = ?";
$binds[]=$queryinfo['sota'];
break;
case 'wwff':
case 'wwff':
$sqlquerytypestring .= " and col_sig = 'WWFF' and col_sig_info = ?";
$binds[]=$queryinfo['wwff'];
break;
case 'itu':
case 'itu':
$sqlquerytypestring .= " and col_ituz = ?";
$binds[]=$queryinfo['ituz'];
break;
case 'continent':
$sqlquerytypestring .= " and col_cont = ?";
$binds[]=$queryinfo['continent'];
break;
default: break;
}
return $sqlquerytypestring;
@@ -86,12 +97,7 @@ class Lookup_model extends CI_Model{
function getQueryData($queryinfo, $confirmedtype) {
// If user inputs longer grid than 4 chars, we use only the first 4
$binds=[];
if (strlen($queryinfo['grid']) > 4) {
$fixedgrid = substr($queryinfo['grid'], 0, 4);
}
else {
$fixedgrid = $queryinfo['grid'];
}
$sqlquerytypestring = '';

View File

@@ -1,6 +1,7 @@
<form method="post" class="d-flex align-items-center">
<select id="quicklookuptype" name="type" class="form-select w-auto me-2">
<option value="cq"><?= __("CQ Zone"); ?></option>
<option value="continent"><?= __("Continent"); ?></option>
<option value="dxcc"><?= __("DXCC"); ?></option>
<option value="vucc"><?= __("Gridsquare"); ?></option>
<option value="iota"><?= __("IOTA"); ?></option>
@@ -50,6 +51,20 @@
</select>
<!-- Continent -->
<select style="display:none" class="form-select w-auto" id="quicklookupcontinent" name="continent" required>
<option value="af"><?= __("Africa"); ?></option>
<option value="an"><?= __("Antarctica"); ?></option>
<option value="na"><?= __("North America"); ?></option>
<option value="as"><?= __("Asia"); ?></option>
<option value="eu"><?= __("Europe"); ?></option>
<option value="sa"><?= __("South America"); ?></option>
<option value="oc"><?= __("Oceania"); ?></option>
</select>
</div>
</select>
<select style="display:none" class="form-select w-auto" id="quicklookupwas" name="was">
<?php
$CI = &get_instance();

View File

@@ -38,6 +38,7 @@ foreach ($result as $mode => $value) {
case 'sota': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $sota).'","' . $key . '","All","All","' . $mode . '","SOTA")\'>' . $val . '</a>'; break;
case 'wwff': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wwff).'","' . $key . '","All","All","' . $mode . '","WWFF")\'>' . $val . '</a>'; break;
case 'itu': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $ituz).'","' . $key . '","All","All","' . $mode . '","ITU")\'>' . $val . '</a>'; break;
case 'continent': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $continent).'","' . $key . '","All","All","' . $mode . '","WAC")\'>' . $val . '</a>'; break;
}
if ($current_band == $key && strtoupper($current_mode )== strtoupper($mode)) {

View File

@@ -275,8 +275,8 @@ function qso_edit(id) {
if ($('#dxcc_id_edit').val() == '291' || $('#dxcc_id_edit').val() == '110' || $('#dxcc_id_edit').val() == '6') {
$('#location_us_county_edit').show();
} else {
$('#location_us_county_edit').hide();
} else {
$('#location_us_county_edit').hide();
}
var state = $("#stateDropdownEdit option:selected").text();
@@ -744,7 +744,9 @@ function spawnLookupModal(searchphrase, searchtype) {
$('#quicklookuptype').val(searchtype);
if (searchtype == 'dxcc') {
$("#quicklookupdxcc").val(searchphrase);
} else if (searchtype == 'iota') {
} else if (searchtype == 'continent') {
$("#quicklookupcontinent").val(searchphrase);
} else if (searchtype == 'iota') {
$("#quicklookupiota").val(searchphrase);
} else if (searchtype == 'cq') {
$("#quicklookupcqz").val(searchphrase);
@@ -775,6 +777,7 @@ function changeLookupType(type) {
$('#quicklookupituz').hide();
$('#quicklookupwas').hide();
$('#quicklookuptext').hide();
$('#quicklookupcontinent').hide();
if (type == "dxcc") {
$('#quicklookupdxcc').show();
} else if (type == "iota") {
@@ -787,7 +790,9 @@ function changeLookupType(type) {
$('#quicklookupituz').show();
} else if (type == "was") {
$('#quicklookupwas').show();
}
} else if (type == "continent") {
$('#quicklookupcontinent').show();
}
}
// This function executes the call to the backend for fetching queryresult and displays the table in the dialog
@@ -808,6 +813,7 @@ function getLookupResult() {
wwff: $('#quicklookuptext').val(),
lotw: $('#quicklookuptext').val(),
ituz: $('#quicklookupituz').val(),
continent: $('#quicklookupcontinent').val(),
},
success: function (html) {
$('#lookupresulttable').html(html);