Added Flags to Maps Popups

This commit is contained in:
Peter Goodhall 2024-06-11 13:05:54 +01:00 committed by GitHub
commit 02281ae235
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 12 deletions

View File

@ -4764,19 +4764,23 @@ class Logbook_model extends CI_Model
// [JSON PLOT] return array for plot qso for map //
public function get_plot_array_for_map($qsos_result, $isVisitor = false)
{
{
$this->load->library('qra');
$CI = &get_instance();
$CI->load->library('DxccFlag');
$json["markers"] = array();
foreach ($qsos_result as $row) {
$plot = array('lat' => 0, 'lng' => 0, 'html' => '', 'label' => '', 'confirmed' => 'N');
$plot = array('lat' => 0, 'lng' => 0, 'html' => '', 'label' => '', 'flag' => '', 'confirmed' => 'N');
$plot['label'] = $row->COL_CALL;
$plot['html'] = "Callsign: " . $row->COL_CALL . "<br />Date/Time: " . $row->COL_TIME_ON . "<br />";
$plot['html'] .= ($row->COL_SAT_NAME != null) ? ("SAT: " . $row->COL_SAT_NAME . "<br />") : ("Band: " . $row->COL_BAND . "<br />");
$plot['html'] .= "Mode: " . ($row->COL_SUBMODE == null ? $row->COL_MODE : $row->COL_SUBMODE) . "<br />";
$flag = strtolower($CI->dxccflag->getISO($row->COL_DXCC));
$plot['flag'] = '<span data-bs-toggle="tooltip" title="' . ucwords(strtolower(($row->name==null?"- NONE -":$row->name))) . '"><span class="fi fi-' . $flag .'"></span></span> ';
$plot['html'] = ($row->COL_GRIDSQUARE != null ? "<b>Grid:</b> " . $row->COL_GRIDSQUARE . "<br />" : "");
$plot['html'] .= "<b>Date/Time:</b> " . $row->COL_TIME_ON . "<br />";
$plot['html'] .= ($row->COL_SAT_NAME != null) ? ("<b>SAT:</b> " . $row->COL_SAT_NAME . "<br />") : ("<b>Band:</b> " . $row->COL_BAND . " ");
$plot['html'] .= "<b>Mode:</b> " . ($row->COL_SUBMODE == null ? $row->COL_MODE : $row->COL_SUBMODE) . "<br />";
// check if qso is confirmed //
if (!$isVisitor) {

View File

@ -898,17 +898,19 @@ if ($this->session->userdata('user_id') != null) {
var newMarkers = {};
data.markers.forEach(marker => {
var key = `${marker.lat},${marker.lng}`;
var html = `<h3>${marker.flag}${marker.label}</h3> ${marker.html}`;
newMarkers[key] = marker;
if (!markers[key]) {
var icon = L.divIcon({
className: 'custom-icon',
html: `<i class="${iconsList.qso.icon}" style="color:${iconsList.qso.color}"></i>`
});
});
L.marker([marker.lat, marker.lng], {
icon: icon
})
.addTo(map)
.bindPopup(marker.html);
.bindPopup(html);
}
});
Object.keys(markers).forEach(key => {

View File

@ -92,7 +92,7 @@ function createPlots(_plot) {
plotmark.data=_plot;
map.addLayer(plotmark);
if ((typeof _plot.label!=="undefined")&&(typeof _plot.html!=="undefined")) {
_plot.label = (_plot.label!="")?("<h3>"+_plot.label+"</h3>"):"";
_plot.label = (_plot.label!="")?("<h3>"+ _plot.flag + _plot.label+"</h3>"):"";
if ((_plot.label+_plot.html)!="") { plotmark.bindPopup(_plot.label+_plot.html); }
}
plotlayers.push(plotmark);