Added Last-Worked to cluster (PHP)

This commit is contained in:
int2001
2025-01-01 17:33:50 +00:00
parent 05c1712e00
commit 1232560ac7
3 changed files with 37 additions and 0 deletions

View File

@@ -78,6 +78,15 @@ class Dxcluster_model extends CI_Model {
$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);
if ($singlespot->worked_call) {
$singlespot->last_wked=$this->logbook_model->last_worked_callsign_in_logbook($singlespot->spotted, $logbooks_locations_array, $singlespot->band)[0];
if ($this->session->userdata('user_date_format')) {
$custom_date_format = $this->session->userdata('user_date_format');
} else {
$custom_date_format = $this->config->item('qso_date_format');
}
$singlespot->last_wked->LAST_QSO = date($custom_date_format, strtotime($singlespot->last_wked->LAST_QSO));
}
array_push($spotsout,$singlespot);
}
} else { // No de continent? No Filter --> Just push

View File

@@ -2325,6 +2325,33 @@ class Logbook_model extends CI_Model {
return $query->num_rows();
}
function last_worked_callsign_in_logbook($callsign, $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_TIME_ON as LAST_QSO,COL_MODE as LAST_MODE');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_CALL', $callsign);
$band = ($band == 'All') ? null : $band;
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->order_by('COL_TIME_ON desc');
$this->db->limit('1');
$query = $this->db->get($this->config->item('table_name'));
return $query->result();
}
function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) {
if ($StationLocationsArray == null) {

View File

@@ -115,6 +115,7 @@
<th><?= __("DXCC"); ?></th>
<th style="width:150px;"><?= __("Spotter"); ?></th>
<th><?= __("Message"); ?></th>
<th><?= __("Last Worked"); ?></th>
</tr>
</thead>