Added lotw and dxcc-work-cnfm-state to DXCluster // PHPPart

This commit is contained in:
int2001
2024-01-30 15:34:45 +00:00
parent afbcfe3d08
commit fa50204d44
3 changed files with 95 additions and 7 deletions

View File

@@ -614,13 +614,13 @@ class API extends CI_Controller {
$this->load->library('DxccFlag');
$return['dxcc_flag']=$this->dxccflag->get($return['dxcc_id']);
}
/*
*
* Check if callsign is active on LoTW
*
*/
$lotw_days=$this->logbook_model->check_last_lotw($lookup_callsign);
if ($lotw_days != null) {
$return['lotw_member']=$lotw_days;
} else {
$lotw_member="";
}
/*
*
* Output Returned data

View File

@@ -62,6 +62,8 @@ class Dxcluster_model extends CI_Model {
}
if ( ($de != '') && ($de != 'Any') && (property_exists($singlespot->dxcc_spotter,'cont')) ){ // If we have a "de continent" and a filter-wish filter on that
if (strtolower($de) == strtolower($singlespot->dxcc_spotter->cont ?? '')) {
$singlespot->worked_dxcc = ($this->logbook_model->check_if_dxcc_worked_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1);
$singlespot->cnfmd_dxcc = ($this->logbook_model->check_if_dxcc_cnfmd_in_logbook($singlespot->dxcc_spotted->dxcc_id, $logbooks_locations_array, $singlespot->band) >= 1);
$singlespot->worked_call = ($this->logbook_model->check_if_callsign_worked_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1);
$singlespot->cnfmd_call = ($this->logbook_model->check_if_callsign_cnfmd_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band) >= 1);
array_push($spotsout,$singlespot);

View File

@@ -1855,7 +1855,6 @@ class Logbook_model extends CI_Model {
}
function check_if_callsign_cnfmd_in_logbook($callsign, $StationLocationsArray = null, $band = null) {
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
if($StationLocationsArray == null) {
$this->load->model('logbooks_model');
@@ -1864,6 +1863,7 @@ class Logbook_model extends CI_Model {
$logbooks_locations_array = $StationLocationsArray;
}
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
$extrawhere='';
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) {
$extrawhere="COL_QSL_RCVD='Y'";
@@ -1937,6 +1937,92 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
}
function check_if_dxcc_worked_in_logbook($dxcc, $StationLocationsArray = null, $band = null) {
if($StationLocationsArray == null) {
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
$this->db->select('COL_DXCC');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_DXCC', $dxcc);
if($band != null && $band != 'SAT') {
$this->db->where('COL_BAND', $band);
} else if($band == 'SAT') {
// Where col_sat_name is not empty
$this->db->where('COL_SAT_NAME !=', '');
}
$this->db->limit('2');
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
}
function check_if_dxcc_cnfmd_in_logbook($dxcc, $StationLocationsArray = null, $band = null) {
if($StationLocationsArray == null) {
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
$extrawhere='';
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) {
$extrawhere="COL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_LOTW_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_EQSL_QSL_RCVD='Y'";
}
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) {
if ($extrawhere!='') {
$extrawhere.=" OR";
}
$extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'";
}
$this->db->select('COL_DXCC');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_DXCC', $dxcc);
if($band != null && $band != 'SAT') {
$this->db->where('COL_BAND', $band);
} else if($band == 'SAT') {
// Where col_sat_name is not empty
$this->db->where('COL_SAT_NAME !=', '');
}
if ($extrawhere != '') {
$this->db->where('('.$extrawhere.')');
} else {
$this->db->where("1=0");
}
$this->db->limit('2');
$query = $this->db->get($this->config->item('table_name'));
return $query->num_rows();
}
function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null) {
if($StationLocationsArray == null) {