diff --git a/application/controllers/Cabrillo.php b/application/controllers/Cabrillo.php index 95764fd63..d713b2e9b 100644 --- a/application/controllers/Cabrillo.php +++ b/application/controllers/Cabrillo.php @@ -132,6 +132,7 @@ class Cabrillo extends CI_Controller { $data['soapbox'] = $this->security->xss_clean($this->input->post('soapbox')); $data['gridlocator'] = $station->station_gridsquare; $data['certificate'] = $this->security->xss_clean($this->input->post('certificate')); + $data['grid_export'] = $this->security->xss_clean($this->input->post('grid_export')) == '1' ? true : false; $this->load->view('cabrillo/export', $data); }else { diff --git a/application/libraries/Cabrilloformat.php b/application/libraries/Cabrilloformat.php index c26ad9425..3f8a7c010 100644 --- a/application/libraries/Cabrilloformat.php +++ b/application/libraries/Cabrilloformat.php @@ -62,7 +62,7 @@ class Cabrilloformat { return "END-OF-LOG:"; } - public function qso($qso) { + public function qso($qso, $grid_export) { $freq = substr($qso->COL_FREQ, 0, -3); if ($freq > 30000) { if ($freq > 250000000) { @@ -123,7 +123,7 @@ class Cabrilloformat { // based on the official cabrillo documentation // https://wwrof.org/cabrillo/cabrillo-qso-data/ - + if($qso->COL_MODE == "CW") { $mode = "CW"; } elseif($qso->COL_MODE == "SSB" || $qso->COL_MODE == "AM") { @@ -146,6 +146,10 @@ class Cabrilloformat { $returnstring .= sprintf("%-6s", sprintf("%03d", $qso->COL_STX)) ." "; } + if ($grid_export == true) { + $returnstring .= substr($qso->station_gridsquare, 0, 4) ." "; + } + if ($qso->COL_STX_STRING != "") { $returnstring .= $qso->COL_STX_STRING ." "; } @@ -155,6 +159,10 @@ class Cabrilloformat { if ($qso->COL_SRX != NULL) { $returnstring .= sprintf("%-6s", sprintf("%03d", $qso->COL_SRX)) ." "; } + + if ($grid_export == true) { + $returnstring .= substr($qso->COL_GRIDSQUARE, 0, 4) ." "; + } if ($qso->COL_SRX_STRING != "") { $returnstring .= $qso->COL_SRX_STRING ." "; diff --git a/application/views/cabrillo/export.php b/application/views/cabrillo/export.php index aeba10dba..34399bc32 100644 --- a/application/views/cabrillo/export.php +++ b/application/views/cabrillo/export.php @@ -9,6 +9,6 @@ echo $CI->cabrilloformat->header($contest_id, $callsign, $claimed_score, $operators, $club, $location, $name, $address, $addresscity, $addressstateprovince, $addresspostalcode, $addresscountry, $soapbox, $gridlocator, $categoryoverlay, $categorytransmitter, $categorytime, $categorystation, $categorypower, $categorymode, $categoryband, $categoryassisted, $categoryoperator, $email, $certificate); foreach ($qsos->result() as $row) { - echo $CI->cabrilloformat->qso($row); + echo $CI->cabrilloformat->qso($row, $grid_export); } echo $CI->cabrilloformat->footer(); diff --git a/application/views/cabrillo/index.php b/application/views/cabrillo/index.php index 1a86de2b3..765dcbb33 100644 --- a/application/views/cabrillo/index.php +++ b/application/views/cabrillo/index.php @@ -197,6 +197,13 @@ +