Merge pull request #2719 from phl0/refactorQsoMap

Fix URL and country names
This commit is contained in:
Florian (DF2ET)
2025-12-27 16:20:08 +01:00
committed by GitHub
3 changed files with 10 additions and 11 deletions

View File

@@ -72,7 +72,7 @@ class Map extends CI_Controller {
$station_id = ($station_id === 'all') ? null : $station_id;
try {
$qsos = $this->Map_model->get_qsos_by_country($country, $station_id, $limit);
$qsos = $this->Map_model->get_qsos_by_country($country, $station_id);
if (empty($qsos)) {
while (ob_get_level()) ob_end_clean();

View File

@@ -6,13 +6,12 @@ class Map_model extends CI_Model {
* Get available countries from the logbook with QSOs
*/
public function get_available_countries() {
$this->db->select('DISTINCT COL_COUNTRY, COL_DXCC, COUNT(*) as qso_count', FALSE);
$this->db->select('DISTINCT dxcc_entities.name AS COL_COUNTRY, COL_DXCC, COUNT(*) as qso_count', FALSE);
$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->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->where('COL_COUNTRY IS NOT NULL');
$this->db->where('COL_COUNTRY !=', '');
$this->db->where("LENGTH(COL_GRIDSQUARE) >=", 6); // At least 6 chars
$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');
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->where("LENGTH(COL_GRIDSQUARE) >=", 6); // At least 6 chars
$this->db->group_by('COL_COUNTRY, COL_DXCC');
$this->db->order_by('COL_COUNTRY');

View File

@@ -7,9 +7,9 @@
<select class="form-select" id="countrySelect" style="min-width: 200px;">
<option value=""><?= __("Choose a country...") ?></option>
<?php foreach ($countries as $country): ?>
<option value="<?php echo htmlspecialchars($country['COL_COUNTRY']); ?>"
<option value="<?php echo htmlspecialchars(ucwords(strtolower(($country['COL_COUNTRY'])), "- (/")); ?>"
data-dxcc="<?php echo htmlspecialchars($country['COL_DXCC']); ?>">
<?php echo htmlspecialchars($country['COL_COUNTRY'] . ' (' . $country['qso_count'] . ' ' . __("QSOs") . ')'); ?>
<?php echo htmlspecialchars(ucwords(strtolower(($country['COL_COUNTRY'])), "- (/") . ' (' . $country['qso_count'] . ' ' . __("QSOs") . ')'); ?>
</option>
<?php endforeach; ?>
</select>
@@ -284,9 +284,9 @@ function initMap() {
if (dxcc && supportedDxccs.includes(parseInt(dxcc))) {
// Single country GeoJSON
$.ajax({
url: base_url + "map/get_country_geojson/",
url: base_url + "index.php/map/get_country_geojson/",
type: 'post',
data: { dxcc: dxcc },
data: { dxcc: dxcc },
success: function(geojson) {
if (geojson && !geojson.error) {
const layer = L.geoJSON(geojson, {