Skip to content
Permalink
Browse files

Show worked before grid status

  • Loading branch information...
Manawyrm committed Feb 26, 2019
1 parent f55d7c1 commit ca20d29bd611dde2d434160fc2134766fe5de382
Showing with 54 additions and 8 deletions.
  1. +24 −6 application/controllers/Logbook.php
  2. +21 −0 application/views/qso/index.php
  3. +9 −2 css/main.css
@@ -62,12 +62,13 @@ function json($callsign)
$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 @@ function json($callsign)
$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,13 +118,29 @@ function json($callsign)
$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']);
echo json_encode($return, JSON_PRETTY_PRINT);
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');
@@ -464,6 +464,27 @@ function delay(callback, ms) {
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 */
@@ -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; }

0 comments on commit ca20d29

Please sign in to comment.
You can’t perform that action at this time.