Show worked before grid status

pull/266/head
Tobias Mädel 2019-02-26 22:00:09 +01:00
rodzic f55d7c1c05
commit ca20d29bd6
3 zmienionych plików z 54 dodań i 8 usunięć

Wyświetl plik

@ -62,12 +62,13 @@ class Logbook extends CI_Controller {
$return = [
"dxcc" => false,
"callsign_name" => "",
"callsign_qra" => "",
"callsign_qth" => "",
"callsign_iota" => "",
"bearing" => ""
];
"callsign_name" => "",
"callsign_qra" => "",
"callsign_qth" => "",
"callsign_iota" => "",
"bearing" => "",
"workedBefore" => false
];
$return['dxcc'] = $this->find_dxcc($callsign);
$return['partial'] = $this->partial($callsign);
@ -80,6 +81,7 @@ class Logbook extends CI_Controller {
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
$return['bearing'] = $this->bearing($return['callsign_qra']);
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra']);
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
@ -116,6 +118,7 @@ class Logbook extends CI_Controller {
$return['callsign_qra'] = $callbook['gridsquare'];
$return['callsign_qth'] = $callbook['city'];
$return['callsign_iota'] = $callbook['iota'];
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra']);
}
$return['bearing'] = $this->bearing($return['callsign_qra']);
@ -123,6 +126,21 @@ class Logbook extends CI_Controller {
return;
}
function worked_grid_before($gridsquare)
{
if (strlen($gridsquare) < 4)
return false;
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
return true;
}
return false;
}
/* Used to generate maps for displaying on /logbook/ */
function qso_map() {
$this->load->model('logbook_model');

Wyświetl plik

@ -464,6 +464,27 @@
if($('#locator').val() == "") {
$('#locator').val(result.callsign_qra);
$('#locator_info').html(result.bearing);
if (result.callsign_qra != "")
{
if (result.workedBefore)
{
$('#locator').addClass("workedGrid");
$('#locator').attr('title', 'Grid was already worked in the past');
}
else
{
$('#locator').addClass("newGrid");
$('#locator').attr('title', 'New grid!');
}
}
else
{
$('#locator').removeClass("workedGrid");
$('#locator').removeClass("newGrid");
$('#locator').attr('title', '');
}
}
/* Find Operators Name */

Wyświetl plik

@ -30,9 +30,16 @@ table .title { font-weight: bold; color: #439BF6; }
#sat_name { text-transform: uppercase; }
#sat_mode { text-transform: uppercase; }
#iota_ref { text-transform: uppercase; }
.workedGrid {
background-color: #B33A3A;
color: #FFF !important;
}
.newGrid {
background-color: #4BB543;
color: #FFF !important;
}
input[type="text"] {
color: #000000 !important;
color: #000000;
}
.pull-right { color: #fff; }