Merge pull request #471 from phl0/AddSomeGridDetails

Add QSO count and Locator to details table
pull/472/head
Peter Goodhall 2020-04-21 14:45:25 +01:00 zatwierdzone przez GitHub
commit aebdbe975c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -82,7 +82,7 @@ class Gridsquares_model extends CI_Model {
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$result = $this->db->query('SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" AND COL_BAND = "'.$band.'"
$result = $this->db->query('SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" AND COL_BAND = "'.$band.'"
AND COL_PROP_MODE != "SAT"
AND COL_PROP_MODE != "INTERNET"
AND COL_PROP_MODE != "ECH"
@ -99,7 +99,7 @@ class Gridsquares_model extends CI_Model {
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$result = $this->db->query('SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" AND COL_PROP_MODE = "SAT"');
$result = $this->db->query('SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" AND COL_PROP_MODE = "SAT"');
//print_r($result);
return json_encode($result->result());

Wyświetl plik

@ -41,7 +41,7 @@
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">QSOs in Square: <span id="square_number"></span></h5>
<h5 class="modal-title" id="exampleModalLabel"><span id="qso_count"></span> QSO<span id="gt1_qso"></span> in Square: <span id="square_number"></span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@ -54,6 +54,7 @@
<th scope="col">Callsign</th>
<th scope="col">Mode</th>
<th scope="col">Band</th>
<th scope="col">Locator</th>
</tr>
</thead>
<tbody>
@ -65,4 +66,4 @@
</div>
</div>
</div>
</div>
</div>

Wyświetl plik

@ -906,6 +906,7 @@ $(document).ready(function(){
var lng = LatLng.lng;
var locator = LatLng2Loc(lat,lng, 10);
var loc_4char = locator.substring(0, 4);
var count = 0;
console.log(loc_4char);
console.log(map.getZoom());
@ -921,16 +922,24 @@ $(document).ready(function(){
}
$.getJSON( "<?php echo site_url('gridsquares/');?>" + search_tags, function( data ) {
count = Object.keys(data).length;
console.log("Count: " + count);
var items = [];
$.each( data, function( i, item ) {
console.log(item.COL_CALL + item.COL_SAT_NAME);
if(item.COL_SAT_NAME != undefined) {
items.push( "<tr><td>" + item.COL_TIME_ON + "</td><td>" + item.COL_CALL + "</td><td>" + item.COL_MODE + "</td><td>" + item.COL_SAT_NAME + "</td></tr>" );
items.push( "<tr><td>" + item.COL_TIME_ON + "</td><td>" + item.COL_CALL + "</td><td>" + item.COL_MODE + "</td><td>" + item.COL_SAT_NAME + "</td><td>" + item.COL_GRIDSQUARE + "</td></tr>" );
} else {
items.push( "<tr><td>" + item.COL_TIME_ON + "</td><td>" + item.COL_CALL + "</td><td>" + item.COL_MODE + "</td><td>" + item.COL_BAND + "</td></tr>" );
items.push( "<tr><td>" + item.COL_TIME_ON + "</td><td>" + item.COL_CALL + "</td><td>" + item.COL_MODE + "</td><td>" + item.COL_BAND + "</td><td>" + item.COL_GRIDSQUARE + "</td></tr>" );
}
});
$('#qso_count').text(count);
if (count > 1) {
$('#gt1_qso').text("s");
} else {
$('#gt1_qso').text("");
}
$("#grid_results tbody").empty();
$("#grid_results tbody").append(items.join( "" ));