Improved callbook error when not defined

这个提交包含在:
Peter Goodhall 2025-04-14 20:10:11 +01:00
父节点 13f102bee2
当前提交 b1a68d6c61

查看文件

@ -1,7 +1,8 @@
<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); <?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Logbook extends CI_Controller { class Logbook extends CI_Controller
{
function __construct() function __construct()
{ {
@ -77,12 +78,14 @@ class Logbook extends CI_Controller {
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('view_log/index'); $this->load->view('view_log/index');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
function jsonentity($adif) { function jsonentity($adif)
{
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$return['dxcc'] = $this->getentity($adif); $return['dxcc'] = $this->getentity($adif);
header('Content-Type: application/json'); header('Content-Type: application/json');
@ -99,7 +102,9 @@ class Logbook extends CI_Controller {
$station_id = $this->security->xss_clean($tempstation_id); $station_id = $this->security->xss_clean($tempstation_id);
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
// Convert - in Callsign to / Used for URL processing // Convert - in Callsign to / Used for URL processing
$callsign = str_replace("-", "/", $callsign); $callsign = str_replace("-", "/", $callsign);
@ -183,7 +188,8 @@ class Logbook extends CI_Controller {
return; return;
} }
function get_plaincall($callsign) { function get_plaincall($callsign)
{
$split_callsign = explode('/', $callsign); $split_callsign = explode('/', $callsign);
if (count($split_callsign) == 1) { // case F0ABC --> return cel 0 // if (count($split_callsign) == 1) { // case F0ABC --> return cel 0 //
$lookupcall = $split_callsign[0]; $lookupcall = $split_callsign[0];
@ -202,11 +208,13 @@ class Logbook extends CI_Controller {
} }
// Returns $val2 first if it has value, even if it is null or empty string, if not return $val1. // Returns $val2 first if it has value, even if it is null or empty string, if not return $val1.
function nval($val1, $val2) { function nval($val1, $val2)
{
return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? "")); return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? ""));
} }
function confirmed_grid_before($gridsquare, $type, $band, $mode) { function confirmed_grid_before($gridsquare, $type, $band, $mode)
{
if (strlen($gridsquare) < 4) if (strlen($gridsquare) < 4)
return false; return false;
@ -290,7 +298,6 @@ class Logbook extends CI_Controller {
$this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode));
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', 'SAT'); $this->db->where('COL_PROP_MODE !=', 'SAT');
} }
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
@ -301,8 +308,7 @@ class Logbook extends CI_Controller {
$query = $this->db->get($this->config->item('table_name')); $query = $this->db->get($this->config->item('table_name'));
foreach ($query->result() as $workedBeforeRow) foreach ($query->result() as $workedBeforeRow) {
{
return true; return true;
} }
} }
@ -316,7 +322,8 @@ class Logbook extends CI_Controller {
* the $type variable is only used for satellites, set this to SAT. * the $type variable is only used for satellites, set this to SAT.
* *
*/ */
function jsonlookupgrid($gridsquare, $type, $band, $mode) { function jsonlookupgrid($gridsquare, $type, $band, $mode)
{
$return = [ $return = [
"workedBefore" => false, "workedBefore" => false,
"confirmed" => false, "confirmed" => false,
@ -332,15 +339,13 @@ class Logbook extends CI_Controller {
$this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode));
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', 'SAT'); $this->db->where('COL_PROP_MODE !=', 'SAT');
} }
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$query = $this->db->get($this->config->item('table_name'), 1, 0); $query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow) foreach ($query->result() as $workedBeforeRow) {
{
$return['workedBefore'] = true; $return['workedBefore'] = true;
} }
@ -402,7 +407,8 @@ class Logbook extends CI_Controller {
return; return;
} }
function jsonlookupdxcc($country, $type, $band, $mode) { function jsonlookupdxcc($country, $type, $band, $mode)
{
$return = [ $return = [
"workedBefore" => false, "workedBefore" => false,
@ -421,15 +427,13 @@ class Logbook extends CI_Controller {
$this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode));
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', 'SAT'); $this->db->where('COL_PROP_MODE !=', 'SAT');
} }
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY', urldecode($country)); $this->db->where('COL_COUNTRY', urldecode($country));
$query = $this->db->get($this->config->item('table_name'), 1, 0); $query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow) foreach ($query->result() as $workedBeforeRow) {
{
$return['workedBefore'] = true; $return['workedBefore'] = true;
} }
@ -500,7 +504,8 @@ class Logbook extends CI_Controller {
} }
} }
function jsonlookupcallsign($callsign, $type, $band, $mode) { function jsonlookupcallsign($callsign, $type, $band, $mode)
{
// Convert - in Callsign to / Used for URL processing // Convert - in Callsign to / Used for URL processing
$callsign = str_replace("-", "/", $callsign); $callsign = str_replace("-", "/", $callsign);
@ -522,15 +527,13 @@ class Logbook extends CI_Controller {
$this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode));
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', 'SAT'); $this->db->where('COL_PROP_MODE !=', 'SAT');
} }
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_CALL', strtoupper($callsign)); $this->db->where('COL_CALL', strtoupper($callsign));
$query = $this->db->get($this->config->item('table_name'), 1, 0); $query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow) foreach ($query->result() as $workedBeforeRow) {
{
$return['workedBefore'] = true; $return['workedBefore'] = true;
} }
@ -597,11 +600,14 @@ class Logbook extends CI_Controller {
} }
} }
function view($id) { function view($id)
{
$this->load->library('DxccFlag'); $this->load->library('DxccFlag');
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->library('qra'); $this->load->library('qra');
$this->load->library('subdivisions'); $this->load->library('subdivisions');
@ -612,8 +618,7 @@ class Logbook extends CI_Controller {
if ($this->session->userdata('user_measurement_base') == NULL) { if ($this->session->userdata('user_measurement_base') == NULL) {
$data['measurement_base'] = $this->config->item('measurement_base'); $data['measurement_base'] = $this->config->item('measurement_base');
} } else {
else {
$data['measurement_base'] = $this->session->userdata('user_measurement_base'); $data['measurement_base'] = $this->session->userdata('user_measurement_base');
} }
@ -629,9 +634,12 @@ class Logbook extends CI_Controller {
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
function partial($id) { function partial($id)
{
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -658,8 +666,7 @@ class Logbook extends CI_Controller {
$query = $this->db->get(); $query = $this->db->get();
} }
if (!empty($logbooks_locations_array) && $query->num_rows() > 0) if (!empty($logbooks_locations_array) && $query->num_rows() > 0) {
{
$html .= "<div class=\"table-responsive\">"; $html .= "<div class=\"table-responsive\">";
$html .= "<table class=\"table\">"; $html .= "<table class=\"table\">";
$html .= "<tr>"; $html .= "<tr>";
@ -698,8 +705,7 @@ class Logbook extends CI_Controller {
$custom_date_format = $this->config->item('qso_date_format'); $custom_date_format = $this->config->item('qso_date_format');
} }
foreach ($query->result() as $row) foreach ($query->result() as $row) {
{
$timestamp = strtotime($row->COL_TIME_ON); $timestamp = strtotime($row->COL_TIME_ON);
@ -884,10 +890,10 @@ class Logbook extends CI_Controller {
$callsign['error'] = $callsign['callsign']['error']; $callsign['error'] = $callsign['callsign']['error'];
} }
} else { } else {
$callsign['error'] = 'Lookup not configured. Please review configuration.'; // No callbook type set, return error message
$callsign['error'] = 'Online callbook not configured. Go to <a href="' . site_url('user/edit/' . $this->session->userdata('user_id')) . '" class="alert-link">Account Settings</a> and select either QRZ or HamQTH in the "Callbook" section.';
} }
if (isset($callsign['callsign']['gridsquare'])) { if (isset($callsign['callsign']['gridsquare'])) {
$this->load->model('logbook_model'); $this->load->model('logbook_model');
$callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'], 0, 4)), 0, $this->session->userdata('user_default_band')); $callsign['grid_worked'] = $this->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($callsign['callsign']['gridsquare'], 0, 4)), 0, $this->session->userdata('user_default_band'));
@ -901,10 +907,13 @@ class Logbook extends CI_Controller {
} }
} }
function search_result($id="", $id2="") { function search_result($id = "", $id2 = "")
{
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$fixedid = $id; $fixedid = $id;
@ -924,14 +933,12 @@ class Logbook extends CI_Controller {
if ($query->num_rows() > 0) { if ($query->num_rows() > 0) {
$data['results'] = $query; $data['results'] = $query;
$this->load->view('view_log/partial/log_ajax.php', $data); $this->load->view('view_log/partial/log_ajax.php', $data);
} } else {
else {
$this->load->model('search'); $this->load->model('search');
$iota_search = $this->search->callsign_iota($id); $iota_search = $this->search->callsign_iota($id);
if ($iota_search->num_rows() > 0) if ($iota_search->num_rows() > 0) {
{
$data['results'] = $iota_search; $data['results'] = $iota_search;
$this->load->view('view_log/partial/log_ajax.php', $data); $this->load->view('view_log/partial/log_ajax.php', $data);
@ -1019,7 +1026,8 @@ class Logbook extends CI_Controller {
} }
} }
function querydb($id) { function querydb($id)
{
$this->db->from($this->config->item('table_name')); $this->db->from($this->config->item('table_name'));
$this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id');
$this->db->join('dxcc_entities', 'dxcc_entities.adif = ' . $this->config->item('table_name') . '.COL_DXCC', 'left outer'); $this->db->join('dxcc_entities', 'dxcc_entities.adif = ' . $this->config->item('table_name') . '.COL_DXCC', 'left outer');
@ -1034,12 +1042,15 @@ class Logbook extends CI_Controller {
return $this->db->get(); return $this->db->get();
} }
function search_duplicates($station_id) { function search_duplicates($station_id)
{
$station_id = $this->security->xss_clean($station_id); $station_id = $this->security->xss_clean($station_id);
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -1064,15 +1075,17 @@ class Logbook extends CI_Controller {
$data['qsos'] = $query; $data['qsos'] = $query;
$this->load->view('search/duplicates_result.php', $data); $this->load->view('search/duplicates_result.php', $data);
} }
function search_lotw_unconfirmed($station_id) { function search_lotw_unconfirmed($station_id)
{
$station_id = $this->security->xss_clean($station_id); $station_id = $this->security->xss_clean($station_id);
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -1099,15 +1112,17 @@ class Logbook extends CI_Controller {
$data['qsos'] = $query; $data['qsos'] = $query;
$this->load->view('search/lotw_unconfirmed_result.php', $data); $this->load->view('search/lotw_unconfirmed_result.php', $data);
} }
function search_incorrect_cq_zones($station_id) { function search_incorrect_cq_zones($station_id)
{
$station_id = $this->security->xss_clean($station_id); $station_id = $this->security->xss_clean($station_id);
$this->load->model('user_model'); $this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } if (!$this->user_model->authorize($this->config->item('auth_mode'))) {
return;
}
$this->load->model('logbooks_model'); $this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -1137,7 +1152,8 @@ class Logbook extends CI_Controller {
/* /*
* Provide a dxcc search, returning results json encoded * Provide a dxcc search, returning results json encoded
*/ */
function local_find_dxcc($call = "", $date = "") { function local_find_dxcc($call = "", $date = "")
{
$this->load->model("logbook_model"); $this->load->model("logbook_model");
if ($date == '') { if ($date == '') {
$date = date("Y-m-d"); $date = date("Y-m-d");
@ -1146,7 +1162,8 @@ class Logbook extends CI_Controller {
print json_encode($ans); print json_encode($ans);
} }
function dxcheck($call = "", $date = "") { function dxcheck($call = "", $date = "")
{
$this->load->model("logbook_model"); $this->load->model("logbook_model");
if ($date == '') { if ($date == '') {
$date = date("Y-m-d"); $date = date("Y-m-d");
@ -1155,7 +1172,8 @@ class Logbook extends CI_Controller {
return $ans; return $ans;
} }
function getentity($adif) { function getentity($adif)
{
$this->load->model("logbook_model"); $this->load->model("logbook_model");
$entity = $this->logbook_model->get_entity($adif); $entity = $this->logbook_model->get_entity($adif);
@ -1164,7 +1182,8 @@ class Logbook extends CI_Controller {
/* return station bearing */ /* return station bearing */
function searchbearing() { function searchbearing()
{
$locator = xss_clean($this->input->post('grid')); $locator = xss_clean($this->input->post('grid'));
$station_id = xss_clean($this->input->post('stationProfile')); $station_id = xss_clean($this->input->post('stationProfile'));
$this->load->library('Qra'); $this->load->library('Qra');
@ -1190,8 +1209,7 @@ class Logbook extends CI_Controller {
if ($this->session->userdata('user_measurement_base') == NULL) { if ($this->session->userdata('user_measurement_base') == NULL) {
$measurement_base = $this->config->item('measurement_base'); $measurement_base = $this->config->item('measurement_base');
} } else {
else {
$measurement_base = $this->session->userdata('user_measurement_base'); $measurement_base = $this->session->userdata('user_measurement_base');
} }
@ -1203,7 +1221,8 @@ class Logbook extends CI_Controller {
} }
/* return distance */ /* return distance */
function searchdistance() { function searchdistance()
{
$locator = xss_clean($this->input->post('grid')); $locator = xss_clean($this->input->post('grid'));
$station_id = xss_clean($this->input->post('stationProfile')); $station_id = xss_clean($this->input->post('stationProfile'));
$this->load->library('Qra'); $this->load->library('Qra');
@ -1235,7 +1254,8 @@ class Logbook extends CI_Controller {
} }
/* return station bearing */ /* return station bearing */
function bearing($locator, $unit = 'M', $station_id = null) { function bearing($locator, $unit = 'M', $station_id = null)
{
$this->load->library('Qra'); $this->load->library('Qra');
if ($locator != null) { if ($locator != null) {
@ -1265,7 +1285,8 @@ class Logbook extends CI_Controller {
} }
/* return distance */ /* return distance */
function distance($locator, $station_id = null) { function distance($locator, $station_id = null)
{
$distance = 0; $distance = 0;
$this->load->library('Qra'); $this->load->library('Qra');
@ -1289,25 +1310,27 @@ class Logbook extends CI_Controller {
} }
$distance = $this->qra->distance($mylocator, $locator, 'K'); $distance = $this->qra->distance($mylocator, $locator, 'K');
} }
return $distance; return $distance;
} }
function qralatlng($qra) { function qralatlng($qra)
{
$this->load->library('Qra'); $this->load->library('Qra');
$latlng = $this->qra->qra2latlong($qra); $latlng = $this->qra->qra2latlong($qra);
return $latlng; return $latlng;
} }
function qralatlngjson() { function qralatlngjson()
{
$qra = xss_clean($this->input->post('qra')); $qra = xss_clean($this->input->post('qra'));
$this->load->library('Qra'); $this->load->library('Qra');
$latlng = $this->qra->qra2latlong($qra); $latlng = $this->qra->qra2latlong($qra);
print json_encode($latlng); print json_encode($latlng);
} }
function get_qsos($num, $offset) { function get_qsos($num, $offset)
{
$this->db->select('' . $this->config->item('table_name') . '.COL_CALL, ' . $this->config->item('table_name') . '.COL_BAND, ' . $this->config->item('table_name') . '.COL_TIME_ON, ' . $this->config->item('table_name') . '.COL_RST_RCVD, ' . $this->config->item('table_name') . '.COL_RST_SENT, ' . $this->config->item('table_name') . '.COL_MODE, ' . $this->config->item('table_name') . '.COL_SUBMODE, ' . $this->config->item('table_name') . '.COL_NAME, ' . $this->config->item('table_name') . '.COL_COUNTRY, ' . $this->config->item('table_name') . '.COL_PRIMARY_KEY, ' . $this->config->item('table_name') . '.COL_SAT_NAME, ' . $this->config->item('table_name') . '.COL_GRIDSQUARE, ' . $this->config->item('table_name') . '.COL_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_EQSL_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_EQSL_QSL_SENT, ' . $this->config->item('table_name') . '.COL_QSL_SENT, ' . $this->config->item('table_name') . '.COL_STX, ' . $this->config->item('table_name') . '.COL_STX_STRING, ' . $this->config->item('table_name') . '.COL_SRX, ' . $this->config->item('table_name') . '.COL_SRX_STRING, ' . $this->config->item('table_name') . '.COL_LOTW_QSL_SENT, ' . $this->config->item('table_name') . '.COL_LOTW_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_VUCC_GRIDS, station_profile.*'); $this->db->select('' . $this->config->item('table_name') . '.COL_CALL, ' . $this->config->item('table_name') . '.COL_BAND, ' . $this->config->item('table_name') . '.COL_TIME_ON, ' . $this->config->item('table_name') . '.COL_RST_RCVD, ' . $this->config->item('table_name') . '.COL_RST_SENT, ' . $this->config->item('table_name') . '.COL_MODE, ' . $this->config->item('table_name') . '.COL_SUBMODE, ' . $this->config->item('table_name') . '.COL_NAME, ' . $this->config->item('table_name') . '.COL_COUNTRY, ' . $this->config->item('table_name') . '.COL_PRIMARY_KEY, ' . $this->config->item('table_name') . '.COL_SAT_NAME, ' . $this->config->item('table_name') . '.COL_GRIDSQUARE, ' . $this->config->item('table_name') . '.COL_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_EQSL_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_EQSL_QSL_SENT, ' . $this->config->item('table_name') . '.COL_QSL_SENT, ' . $this->config->item('table_name') . '.COL_STX, ' . $this->config->item('table_name') . '.COL_STX_STRING, ' . $this->config->item('table_name') . '.COL_SRX, ' . $this->config->item('table_name') . '.COL_SRX_STRING, ' . $this->config->item('table_name') . '.COL_LOTW_QSL_SENT, ' . $this->config->item('table_name') . '.COL_LOTW_QSL_RCVD, ' . $this->config->item('table_name') . '.COL_VUCC_GRIDS, station_profile.*');
$this->db->from($this->config->item('table_name')); $this->db->from($this->config->item('table_name'));
@ -1320,28 +1343,58 @@ class Logbook extends CI_Controller {
return $this->db->get(); return $this->db->get();
} }
function part_table_header_col($ctx, $name) { function part_table_header_col($ctx, $name)
{
$ret = ''; $ret = '';
switch ($name) { switch ($name) {
case 'Mode': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_mode').'</th>'; break; case 'Mode':
case 'RSTS': $ret.= '<th class="d-none d-sm-table-cell">'.$ctx->lang->line('gen_hamradio_rsts').'</th>'; break; $ret .= '<th>' . $ctx->lang->line('gen_hamradio_mode') . '</th>';
case 'RSTR': $ret.= '<th class="d-none d-sm-table-cell">'.$ctx->lang->line('gen_hamradio_rstr').'</th>'; break; break;
case 'Country': $ret.= '<th>'.$ctx->lang->line('general_word_country').'</th>'; break; case 'RSTS':
case 'IOTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_iota').'</th>'; break; $ret .= '<th class="d-none d-sm-table-cell">' . $ctx->lang->line('gen_hamradio_rsts') . '</th>';
case 'SOTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_sota').'</th>'; break; break;
case 'WWFF': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_wwff').'</th>'; break; case 'RSTR':
case 'POTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_pota').'</th>'; break; $ret .= '<th class="d-none d-sm-table-cell">' . $ctx->lang->line('gen_hamradio_rstr') . '</th>';
case 'State': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_state').'</th>'; break; break;
case 'Grid': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_gridsquare').'</th>'; break; case 'Country':
case 'Distance': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_distance').'</th>'; break; $ret .= '<th>' . $ctx->lang->line('general_word_country') . '</th>';
case 'Band': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_band').'</th>'; break; break;
case 'Frequency': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_frequency').'</th>'; break; case 'IOTA':
case 'Operator': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_operator').'</th>'; break; $ret .= '<th>' . $ctx->lang->line('gen_hamradio_iota') . '</th>';
break;
case 'SOTA':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_sota') . '</th>';
break;
case 'WWFF':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_wwff') . '</th>';
break;
case 'POTA':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_pota') . '</th>';
break;
case 'State':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_state') . '</th>';
break;
case 'Grid':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_gridsquare') . '</th>';
break;
case 'Distance':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_distance') . '</th>';
break;
case 'Band':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_band') . '</th>';
break;
case 'Frequency':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_frequency') . '</th>';
break;
case 'Operator':
$ret .= '<th>' . $ctx->lang->line('gen_hamradio_operator') . '</th>';
break;
} }
return $ret; return $ret;
} }
function part_QrbCalcLink($mygrid, $grid, $vucc) { function part_QrbCalcLink($mygrid, $grid, $vucc)
{
$ret = ''; $ret = '';
if (!empty($grid)) { if (!empty($grid)) {
$ret .= $grid . ' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>'; $ret .= $grid . ' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>';
@ -1351,24 +1404,89 @@ class Logbook extends CI_Controller {
return $ret; return $ret;
} }
function part_table_col($row, $name) { function part_table_col($row, $name)
{
$ret = ''; $ret = '';
$ci = &get_instance(); $ci = &get_instance();
switch ($name) { switch ($name) {
case 'Mode': $ret.= '<td>'; $ret.= $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . '</td>'; break; case 'Mode':
case 'RSTS': $ret.= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_SENT; if ($row->COL_STX) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">'; $ret.=sprintf("%03d", $row->COL_STX); $ret.= '</span>';} if ($row->COL_STX_STRING) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">' . $row->COL_STX_STRING . '</span>';} $ret.= '</td>'; break; $ret .= '<td>';
case 'RSTR': $ret.= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">'; $ret.=sprintf("%03d", $row->COL_SRX); $ret.= '</span>';} if ($row->COL_SRX_STRING) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">' . $row->COL_SRX_STRING . '</span>';} $ret.= '</td>'; break; $ret .= $row->COL_SUBMODE == null ? $row->COL_MODE : $row->COL_SUBMODE . '</td>';
case 'Country': $ret.= '<td>' . ucwords(strtolower(($row->COL_COUNTRY))); if ($row->end != NULL) $ret.= ' <span class="badge text-bg-danger">'.$ci->lang->line('gen_hamradio_deleted_dxcc').'</span>' . '</td>'; break; break;
case 'IOTA': $ret.= '<td>' . ($row->COL_IOTA) . '</td>'; break; case 'RSTS':
case 'SOTA': $ret.= '<td>' . ($row->COL_SOTA_REF) . '</td>'; break; $ret .= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_SENT;
case 'WWFF': $ret.= '<td>' . ($row->COL_WWFF_REF) . '</td>'; break; if ($row->COL_STX) {
case 'POTA': $ret.= '<td>' . ($row->COL_POTA_REF) . '</td>'; break; $ret .= ' <span data-bs-toggle="tooltip" title="' . ($row->COL_CONTEST_ID != "" ? $row->COL_CONTEST_ID : "n/a") . '" class="badge text-bg-light">';
case 'Grid': $ret.= '<td>' . $this->part_QrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE) . '</td>'; break; $ret .= sprintf("%03d", $row->COL_STX);
case 'Distance': $ret .= '<td>' . (property_exists($row, 'COL_DISTANCE') && $row->COL_DISTANCE ? $row->COL_DISTANCE . '&nbsp;km' : '') . '</td>'; break; $ret .= '</span>';
case 'Band': $ret.= '<td>'; if($row->COL_SAT_NAME != null) { $ret.= '<a href="https://db.satnogs.org/search/?q='.$row->COL_SAT_NAME.'" target="_blank">'.$row->COL_SAT_NAME.'</a></td>'; } else { $ret.= strtolower($row->COL_BAND); } $ret.= '</td>'; break; }
case 'Frequency': $ret.= '<td>'; if($row->COL_SAT_NAME != null) { $ret.= '<a href="https://db.satnogs.org/search/?q='.$row->COL_SAT_NAME.'" target="_blank">'.$row->COL_SAT_NAME.'</a></td>'; } else { if($row->COL_FREQ != null) { $ret.= $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { $ret.= strtolower($row->COL_BAND); } } $ret.= '</td>'; break; if ($row->COL_STX_STRING) {
case 'State': $ret.= '<td>' . ($row->COL_STATE) . '</td>'; break; $ret .= ' <span data-bs-toggle="tooltip" title="' . ($row->COL_CONTEST_ID != "" ? $row->COL_CONTEST_ID : "n/a") . '" class="badge text-bg-light">' . $row->COL_STX_STRING . '</span>';
case 'Operator': $ret.= '<td>' . ($row->COL_OPERATOR) . '</td>'; break; }
$ret .= '</td>';
break;
case 'RSTR':
$ret .= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD;
if ($row->COL_SRX) {
$ret .= ' <span data-bs-toggle="tooltip" title="' . ($row->COL_CONTEST_ID != "" ? $row->COL_CONTEST_ID : "n/a") . '" class="badge text-bg-light">';
$ret .= sprintf("%03d", $row->COL_SRX);
$ret .= '</span>';
}
if ($row->COL_SRX_STRING) {
$ret .= ' <span data-bs-toggle="tooltip" title="' . ($row->COL_CONTEST_ID != "" ? $row->COL_CONTEST_ID : "n/a") . '" class="badge text-bg-light">' . $row->COL_SRX_STRING . '</span>';
}
$ret .= '</td>';
break;
case 'Country':
$ret .= '<td>' . ucwords(strtolower(($row->COL_COUNTRY)));
if ($row->end != NULL) $ret .= ' <span class="badge text-bg-danger">' . $ci->lang->line('gen_hamradio_deleted_dxcc') . '</span>' . '</td>';
break;
case 'IOTA':
$ret .= '<td>' . ($row->COL_IOTA) . '</td>';
break;
case 'SOTA':
$ret .= '<td>' . ($row->COL_SOTA_REF) . '</td>';
break;
case 'WWFF':
$ret .= '<td>' . ($row->COL_WWFF_REF) . '</td>';
break;
case 'POTA':
$ret .= '<td>' . ($row->COL_POTA_REF) . '</td>';
break;
case 'Grid':
$ret .= '<td>' . $this->part_QrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE) . '</td>';
break;
case 'Distance':
$ret .= '<td>' . (property_exists($row, 'COL_DISTANCE') && $row->COL_DISTANCE ? $row->COL_DISTANCE . '&nbsp;km' : '') . '</td>';
break;
case 'Band':
$ret .= '<td>';
if ($row->COL_SAT_NAME != null) {
$ret .= '<a href="https://db.satnogs.org/search/?q=' . $row->COL_SAT_NAME . '" target="_blank">' . $row->COL_SAT_NAME . '</a></td>';
} else {
$ret .= strtolower($row->COL_BAND);
}
$ret .= '</td>';
break;
case 'Frequency':
$ret .= '<td>';
if ($row->COL_SAT_NAME != null) {
$ret .= '<a href="https://db.satnogs.org/search/?q=' . $row->COL_SAT_NAME . '" target="_blank">' . $row->COL_SAT_NAME . '</a></td>';
} else {
if ($row->COL_FREQ != null) {
$ret .= $ci->frequency->hz_to_mhz($row->COL_FREQ);
} else {
$ret .= strtolower($row->COL_BAND);
}
}
$ret .= '</td>';
break;
case 'State':
$ret .= '<td>' . ($row->COL_STATE) . '</td>';
break;
case 'Operator':
$ret .= '<td>' . ($row->COL_OPERATOR) . '</td>';
break;
} }
return $ret; return $ret;
} }