[DXCC Mao] Fixed so that worked/confirmed/not worked works with map
这个提交包含在:
父节点
1b563b7eb0
当前提交
06028992aa
共有 2 个文件被更改,包括 69 次插入 和 47 次删除
|
|
@ -644,7 +644,7 @@ class Awards extends CI_Controller {
|
|||
}
|
||||
$newdxcc[$i]['lat'] = $dxcc->lat;
|
||||
$newdxcc[$i]['long'] = $dxcc->long;
|
||||
$newdxcc[$i++]['status'] = $this->returnStatus($dxcc_array[$dxcc->adif]);
|
||||
$newdxcc[$i++]['status'] = isset($dxcc_array[$dxcc->adif]) ? $this->returnStatus($dxcc_array[$dxcc->adif]) : 'x';
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function load_dxcc_map() {
|
|||
Antarctica: +$('#Antarctica').prop('checked'),
|
||||
},
|
||||
success: function(data) {
|
||||
load_dxcc_map2(data);
|
||||
load_dxcc_map2(data, worked, confirmed, notworked);
|
||||
},
|
||||
error: function() {
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ function load_dxcc_map() {
|
|||
});
|
||||
}
|
||||
|
||||
function load_dxcc_map2(data) {
|
||||
function load_dxcc_map2(data, worked, confirmed, notworked) {
|
||||
|
||||
// If map is already initialized
|
||||
var container = L.DomUtil.get('dxccmap');
|
||||
|
|
@ -51,25 +51,64 @@ function load_dxcc_map2(data) {
|
|||
}
|
||||
).addTo(map);
|
||||
|
||||
var notworked = data.length;
|
||||
var confirmed = 0;
|
||||
var workednotconfirmed = 0;
|
||||
var notworkedcount = data.length;
|
||||
var confirmedcount = 0;
|
||||
var workednotconfirmedcount = 0;
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var D = data[i];
|
||||
if (D['status'] != 'x') {
|
||||
var mapColor = 'red';
|
||||
|
||||
if (D['status'] == 'C') {
|
||||
mapColor = 'green';
|
||||
confirmed++;
|
||||
notworked--;
|
||||
if (confirmed != '0') {
|
||||
addMarker(L, D, mapColor, map);
|
||||
confirmedcount++;
|
||||
notworkedcount--;
|
||||
}
|
||||
}
|
||||
if (D['status'] == 'W') {
|
||||
mapColor = 'orange';
|
||||
workednotconfirmed++;
|
||||
notworked--;
|
||||
if (worked != '0') {
|
||||
addMarker(L, D, mapColor, map);
|
||||
workednotconfirmedcount++;
|
||||
notworkedcount--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Make a check here and hide what I don't want to show
|
||||
if (notworked != '0') {
|
||||
if (mapColor == 'red') {
|
||||
addMarker(L, D, mapColor, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Legend specific*/
|
||||
var legend = L.control({ position: "topright" });
|
||||
|
||||
if (notworked.checked == false) {
|
||||
notworkedcount = 0;
|
||||
}
|
||||
|
||||
legend.onAdd = function(map) {
|
||||
var div = L.DomUtil.create("div", "legend");
|
||||
div.innerHTML += "<h4>Colors</h4>";
|
||||
div.innerHTML += '<i style="background: green"></i><span>Confirmed ('+confirmedcount+')</span><br>';
|
||||
div.innerHTML += '<i style="background: orange"></i><span>Worked not confirmed ('+workednotconfirmedcount+')</span><br>';
|
||||
div.innerHTML += '<i style="background: red"></i><span>Not worked ('+notworkedcount+')</span><br>';
|
||||
return div;
|
||||
};
|
||||
|
||||
legend.addTo(map);
|
||||
|
||||
map.setView([20, 0], 2);
|
||||
}
|
||||
|
||||
function addMarker(L, D, mapColor, map) {
|
||||
const markerHtmlStyles = `
|
||||
background-color: ${mapColor};
|
||||
width: 1rem;
|
||||
|
|
@ -97,23 +136,6 @@ function load_dxcc_map2(data) {
|
|||
).addTo(map).on('click', onClick);
|
||||
}
|
||||
|
||||
/*Legend specific*/
|
||||
var legend = L.control({ position: "topright" });
|
||||
|
||||
legend.onAdd = function(map) {
|
||||
var div = L.DomUtil.create("div", "legend");
|
||||
div.innerHTML += "<h4>Colors</h4>";
|
||||
div.innerHTML += '<i style="background: green"></i><span>Confirmed ('+confirmed+')</span><br>';
|
||||
div.innerHTML += '<i style="background: orange"></i><span>Worked not confirmed ('+workednotconfirmed+')</span><br>';
|
||||
div.innerHTML += '<i style="background: red"></i><span>Not worked ('+notworked+')</span><br>';
|
||||
return div;
|
||||
};
|
||||
|
||||
legend.addTo(map);
|
||||
|
||||
map.setView([20, 0], 2);
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
var marker = e.target;
|
||||
displayContacts(marker.options.adif, $('#band2').val(), $('#mode').val(), 'DXCC2');
|
||||
|
|
|
|||
正在加载…
在新工单中引用