Merge pull request #1170 from AndreasK79/quick_lookup_station_logbooks

[Quick Lookup] Updated code to support station logbooks
pull/1172/head
Peter Goodhall 2021-09-11 16:55:01 +01:00 zatwierdzone przez GitHub
commit 38963ce887
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 19 dodań i 18 usunięć

Wyświetl plik

@ -28,12 +28,14 @@ class Lookup extends CI_Controller {
public function search() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$this->load->model('lookup_model');
$data['bands'] = $this->lookup_model->get_Worked_Bands($station_id);
$data['bands'] = $this->lookup_model->get_Worked_Bands($location_list);
$data['type'] = xss_clean($this->input->post('type'));
$data['dxcc'] = xss_clean($this->input->post('dxcc'));
@ -43,7 +45,7 @@ class Lookup extends CI_Controller {
$data['iota'] = xss_clean($this->input->post('iota'));
$data['cqz'] = xss_clean($this->input->post('cqz'));
$data['wwff'] = xss_clean($this->input->post('wwff'));
$data['station_id'] = $station_id;
$data['location_list'] = $location_list;
$data['result'] = $this->lookup_model->getSearchResult($data);

Wyświetl plik

@ -8,7 +8,7 @@ class Lookup_model extends CI_Model{
}
function getSearchResult($queryinfo){
$modes = $this->get_worked_modes($queryinfo['station_id']);
$modes = $this->get_worked_modes($queryinfo['location_list']);
return $this->getResultFromDatabase($queryinfo, $modes);
}
@ -54,7 +54,7 @@ class Lookup_model extends CI_Model{
case 'dxcc': $sqlquerytypestring .= " and col_dxcc = " . $queryinfo['dxcc']; break;
case 'iota': $sqlquerytypestring .= " and col_iota = '" . $queryinfo['iota'] . "'"; break;
case 'grid': $sqlquerytypestring .= " and (col_gridsquare like '%" . $fixedgrid . "%' or col_vucc_grids like '%" . $fixedgrid . "%')" ; break;
case 'cqz': $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; break;
case 'cqz': $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; break;
case 'was': $sqlquerytypestring .= " and col_state = '" . $queryinfo['was'] . "' and COL_DXCC in ('291', '6', '110')";; break;
case 'sota': $sqlquerytypestring .= " and col_sota_ref = '" . $queryinfo['sota'] . "'"; break;
case 'wwff': $sqlquerytypestring .= " and col_sig = 'WWFF' and col_sig_info = '" . $queryinfo['wwff'] . "'"; break;
@ -70,7 +70,7 @@ class Lookup_model extends CI_Model{
// Fetching info for all modes and bands except satellite
$sql = "SELECT distinct col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $queryinfo['station_id'];
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
$sql .= " and coalesce(col_submode, '') = ''";
@ -83,7 +83,7 @@ class Lookup_model extends CI_Model{
// Fetching info for all sub_modes and bands except satellite
$sql .= " union SELECT distinct col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $queryinfo['station_id'];
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
$sql .= " and coalesce(col_submode, '') <> ''";
@ -96,7 +96,7 @@ class Lookup_model extends CI_Model{
// Fetching info for all modes on satellite
$sql .= " union SELECT distinct 'SAT' col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $queryinfo['station_id'];
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
$sql .= " and coalesce(col_submode, '') = ''";
@ -109,7 +109,7 @@ class Lookup_model extends CI_Model{
// Fetching info for all sub_modes on satellite
$sql .= " union SELECT distinct 'SAT' col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $queryinfo['station_id'];
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
$sql .= " and coalesce(col_submode, '') <> ''";
@ -150,11 +150,11 @@ class Lookup_model extends CI_Model{
/*
* Get's the worked bands from the log
*/
function get_worked_bands($station_id)
function get_worked_bands($location_list)
{
// get all worked slots from database
$data = $this->db->query(
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
@ -162,7 +162,7 @@ class Lookup_model extends CI_Model{
}
$SAT_data = $this->db->query(
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
);
foreach ($SAT_data->result() as $row) {
@ -182,11 +182,11 @@ class Lookup_model extends CI_Model{
/*
* Get's the worked modes from the log
*/
function get_worked_modes($station_id)
function get_worked_modes($location_list)
{
// get all worked modes from database
$data = $this->db->query(
"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " order by COL_MODE ASC"
"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") order by COL_MODE ASC"
);
$results = array();
foreach ($data->result() as $row) {
@ -194,7 +194,7 @@ class Lookup_model extends CI_Model{
}
$data = $this->db->query(
"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC"
"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC"
);
foreach ($data->result() as $row) {
if (!in_array($row, $results)) {

Wyświetl plik

@ -154,9 +154,8 @@ $('[data-fancybox]').fancybox({
}
});
// Here we capture ALT-L to invoice the Quick lookup
// Here we capture ALT-L to invoke the Quick lookup
document.onkeyup = function(e) {
// ALT-W wipe
if (e.altKey && e.which == 76) {
spawnLookupModal();
}