diff --git a/application/config/migration.php b/application/config/migration.php index a9dbaec0..95bc2923 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 55; +$config['migration_version'] = 56; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index 6b63d65e..600654fd 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -76,7 +76,6 @@ class adif extends CI_Controller { } public function export_custom() { - // Set memory limit to unlimited to allow heavy usage ini_set('memory_limit', '-1'); @@ -87,12 +86,14 @@ class adif extends CI_Controller { $exportLotw = true; } else { $exportLotw = false; - } - + } + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $exportLotw); + $this->load->view('adif/data/exportall', $data); + if ($this->input->post('markLotw') == 1) { foreach ($data['qsos']->result() as $qso) { diff --git a/application/libraries/AdifHelper.php b/application/libraries/AdifHelper.php new file mode 100644 index 00000000..2489b9ed --- /dev/null +++ b/application/libraries/AdifHelper.php @@ -0,0 +1,133 @@ +getAdifFieldLine("CALL", $qso->COL_CALL); + $line .= $this->getAdifFieldLine("BAND", $qso->COL_BAND); + $line .= $this->getAdifFieldLine("MODE", $qso->COL_MODE); + + if ($qso->COL_SUBMODE) { + $line .= $this->getAdifFieldLine("SUBMODE", $qso->COL_SUBMODE); + } + + if ($qso->COL_FREQ != 0) { + $freq_in_mhz = $qso->COL_FREQ / 1000000; + $line .= $this->getAdifFieldLine("FREQ", $freq_in_mhz); + } + + if ($qso->COL_FREQ_RX != 0) { + $freq_rx_in_mhz = $qso->COL_FREQ_RX / 1000000; + $line .= $this->getAdifFieldLine("FREQ_RX", $freq_rx_in_mhz); + } + + if ($qso->COL_BAND_RX) { + $line .= $this->getAdifFieldLine("BAND_RX", $qso->COL_BAND_RX); + } + + $date_on = strtotime($qso->COL_TIME_ON); + $new_date = date('Ymd', $date_on); + $line .= $this->getAdifFieldLine("QSO_DATE", $new_date); + + $time_on = strtotime($qso->COL_TIME_ON); + $new_on = date('His', $time_on); + $line .= $this->getAdifFieldLine("TIME_ON", $new_on); + + $time_off = strtotime($qso->COL_TIME_OFF); + $new_off = date('His', $time_off); + $line .= $this->getAdifFieldLine("TIME_OFF", $new_off); + + $line .= $this->getAdifFieldLine("RST_RCVD", $qso->COL_RST_RCVD); + + $line .= $this->getAdifFieldLine("RST_SENT", $qso->COL_RST_SENT); + + $line .= $this->getAdifFieldLine("QSL_RCVD", $qso->COL_QSL_RCVD); + + $line .= $this->getAdifFieldLine("QSL_SENT", $qso->COL_QSL_SENT); + + $line .= $this->getAdifFieldLine("COUNTRY", $qso->COL_COUNTRY); + + if ($qso->COL_VUCC_GRIDS != "") { + $line .= $this->getAdifFieldLine("VUCC_GRIDS", $qso->COL_VUCC_GRIDS); + } + if ($qso->COL_VUCC_GRIDS == "" && $qso->COL_GRIDSQUARE != "") { + $line .= $this->getAdifFieldLine("GRIDSQUARE", $qso->COL_GRIDSQUARE); + } + if ($qso->COL_SAT_NAME) { + if ($qso->COL_SAT_MODE != 0 || $qso->COL_SAT_MODE !="") { + $line .= $this->getAdifFieldLine("SAT_MODE", $qso->COL_SAT_MODE); + $line .= $this->getAdifFieldLine("SAT_NAME", $qso->COL_SAT_NAME); + } + } + + $line .= $this->getAdifFieldLine("PROP_MODE", $qso->COL_PROP_MODE); + + $line .= $this->getAdifFieldLine("NAME", $qso->COL_NAME); + + $line .= $this->getAdifFieldLine("STATE", $qso->COL_STATE); + + $line .= $this->getAdifFieldLine("SOTA_REF", $qso->COL_SOTA_REF); + + $line .= $this->getAdifFieldLine("OPERATOR", $qso->COL_OPERATOR); + + $line .= $this->getAdifFieldLine("STATION_CALLSIGN", $qso->station_callsign); + + $line .= $this->getAdifFieldLine("MY_CITY", $qso->station_city); + + $line .= $this->getAdifFieldLine("MY_COUNTRY", $qso->station_country); + + $line .= $this->getAdifFieldLine("MY_DXCC", $qso->station_dxcc); + + if (strpos($qso->station_gridsquare, ',') !== false ) { + $line .= $this->getAdifFieldLine("MY_VUCC_GRIDS", $qso->station_gridsquare); + } + else { + $line .= $this->getAdifFieldLine("MY_GRIDSQUARE", $qso->station_gridsquare); + } + + $line .= $this->getAdifFieldLine("MY_IOTA", $qso->station_iota); + + $line .= $this->getAdifFieldLine("MY_SOTA_REF", $qso->station_sota); + + $line .= $this->getAdifFieldLine("MY_CQ_ZONE", $qso->station_cq); + + $line .= $this->getAdifFieldLine("MY_ITU_ZONE", $qso->station_itu); + + $line .= $this->getAdifFieldLine("MY_CNTY", $qso->station_cnty); + + $line .= $this->getAdifFieldLine("MY_STATE", $qso->COL_MY_STATE); + + $line .= $this->getAdifFieldLine("STX", $qso->COL_STX); + + $line .= $this->getAdifFieldLine("STX_STRING", $qso->COL_STX_STRING); + + $line .= $this->getAdifFieldLine("SRX", $qso->COL_SRX); + + $line .= $this->getAdifFieldLine("SRX_STRING", $qso->COL_SRX_STRING); + + $line .= $this->getAdifFieldLine("TX_PWR", $qso->COL_TX_PWR); + + $line .= $this->getAdifFieldLine("COMMENT", $qso->COL_COMMENT); + + $line .= $this->getAdifFieldLine("MY_SIG", $qso->station_sig); + + $line .= $this->getAdifFieldLine("MY_SIG_INFO", $qso->station_sig_info); + + $line .= $this->getAdifFieldLine("SIG", $qso->COL_SIG); + + $line .= $this->getAdifFieldLine("SIG_INFO", $qso->COL_SIG_INFO); + + $line .= "\r\n"; + + return $line; + } + + function getAdifFieldLine($adifcolumn, $dbvalue) { + if ($dbvalue != "") { + return "<" . $adifcolumn . ":" . strlen($dbvalue) . ">" . $dbvalue; + } else { + return ""; + } + } +} \ No newline at end of file diff --git a/application/migrations/056_add_qrz_upload_realtime_option.php b/application/migrations/056_add_qrz_upload_realtime_option.php new file mode 100644 index 00000000..dd510fa4 --- /dev/null +++ b/application/migrations/056_add_qrz_upload_realtime_option.php @@ -0,0 +1,20 @@ +dbforge->add_column('station_profile', $fields); + } + + public function down() + { + $this->dbforge->drop_column('station_profile', 'qrzrealtime'); + } +} \ No newline at end of file diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 3e925bb0..91eab056 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -122,6 +122,8 @@ class Logbook_model extends CI_Model { 'COL_CQZ' => $cqz, 'COL_STATE' => trim($this->input->post('usa_state')), 'COL_SOTA_REF' => trim($this->input->post('sota_ref')), + 'COL_SIG' => trim($this->input->post('sig')), + 'COL_SIG_INFO' => trim($this->input->post('sig_info')), 'COL_DARC_DOK' => trim($this->input->post('darc_dok')), 'COL_NOTES' => $this->input->post('notes'), ); @@ -336,15 +338,19 @@ class Logbook_model extends CI_Model { $data['COL_RX_PWR'] = str_replace("W", "", $data['COL_RX_PWR']); } + $result = $this->exists_qrz_api_key($data['station_id']); + // Push qso to qrz if apikey is set - if ($apikey = $this->exists_qrz_api_key($data['station_id'])) { - $adif = $this->create_adif_from_data($data); - $result = $this->push_qso_to_qrz($apikey, $adif); - IF ($result['status'] == 'OK') { - $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y'; - $data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now")); + if ($result) { + if ($result->qrzrealtime == 1) { + $adif = $this->create_adif_from_data($data); + $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); + IF ($result['status'] == 'OK') { + $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y'; + $data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now")); + } } - } + } // Add QSO to database $this->db->insert($this->config->item('table_name'), $data); @@ -354,7 +360,7 @@ class Logbook_model extends CI_Model { * Function checks if a QRZ API Key exists in the table with the given station id */ function exists_qrz_api_key($station_id) { - $sql = 'select qrzapikey from station_profile + $sql = 'select qrzapikey, qrzrealtime from station_profile where station_id = ' . $station_id; $query = $this->db->query($sql); @@ -362,7 +368,7 @@ class Logbook_model extends CI_Model { $result = $query->row(); if ($result) { - return $result->qrzapikey; + return $result; } else { return false; @@ -602,6 +608,8 @@ class Logbook_model extends CI_Model { 'COL_IOTA' => $this->input->post('iota_ref'), 'COL_SOTA_REF' => $this->input->post('sota_ref'), 'COL_TX_PWR' => $this->input->post('transmit_power'), + 'COL_SIG' => $this->input->post('sig'), + 'COL_SIG_INFO' => $this->input->post('sig_info'), 'COL_DARC_DOK' => $this->input->post('darc_dok'), 'COL_QTH' => $this->input->post('qth'), 'COL_PROP_MODE' => $this->input->post('prop_mode'), diff --git a/application/models/Stations.php b/application/models/Stations.php index 47534858..d7945260 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -53,6 +53,7 @@ class Stations extends CI_Model { 'state' => xss_clean($this->input->post('station_state', true)), 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), + 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), ); // Insert Records @@ -77,6 +78,7 @@ class Stations extends CI_Model { 'state' => xss_clean($this->input->post('station_state', true)), 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), + 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), ); $this->db->where('station_id', xss_clean($this->input->post('station_id', true))); diff --git a/application/views/adif/data/exportall.php b/application/views/adif/data/exportall.php index f6ca4990..26991708 100644 --- a/application/views/adif/data/exportall.php +++ b/application/views/adif/data/exportall.php @@ -7,7 +7,10 @@ config->item('app_version')); ?>>Version config->item('app_version')."\n"; ?> -result() as $qso) { ?> - - COL_CALL); ?>>COL_CALL; ?>COL_BAND); ?>>COL_BAND; ?>COL_MODE); ?>>COL_MODE; ?>COL_SUBMODE) { ?>COL_SUBMODE); ?>>COL_SUBMODE; ?>COL_FREQ != "0") { ?>COL_FREQ / 1000000; ?>>COL_FREQ_RX != "0") { ?>COL_FREQ_RX / 1000000; ?>>COL_BAND_RX) { ?>COL_BAND_RX); ?>>COL_BAND_RX; ?>COL_TIME_ON); $new_date = date('Ymd', $date_on); ?>>COL_TIME_ON); $new_on = date('His', $time_on); ?>>COL_TIME_OFF); $new_off = date('His', $time_off); ?>>COL_RST_RCVD); ?>>COL_RST_RCVD; ?>COL_RST_SENT); ?>>COL_RST_SENT; ?>COL_QSL_RCVD); ?>>COL_QSL_RCVD; ?>COL_QSL_SENT); ?>>COL_QSL_SENT; ?>COL_COUNTRY); ?>>COL_COUNTRY; ?>COL_VUCC_GRIDS != "") { ?>COL_VUCC_GRIDS); ?>>COL_VUCC_GRIDS; ?>COL_VUCC_GRIDS == "" && $qso->COL_GRIDSQUARE != "") { ?>COL_GRIDSQUARE); ?>>COL_GRIDSQUARE; ?>COL_SAT_NAME) { ?>COL_SAT_MODE != 0 || $qso->COL_SAT_MODE !="") {?>COL_SAT_MODE); ?>>COL_SAT_MODE; ?>COL_SAT_NAME); ?>>COL_SAT_NAME; ?>COL_PROP_MODE) { ?>COL_PROP_MODE); ?>>COL_PROP_MODE; ?>COL_NAME) { ?>COL_NAME); ?>>COL_NAME; ?>COL_STATE) { ?>COL_STATE); ?>>COL_STATE; ?>COL_SOTA_REF) { ?>COL_SOTA_REF); ?>>COL_SOTA_REF; ?>COL_OPERATOR) { ?>COL_OPERATOR); ?>>COL_OPERATOR; ?>station_callsign) { ?>station_callsign); ?>>station_callsign; ?>station_city) { ?>station_city); ?>>station_city; ?>station_country) { ?>station_country); ?>>station_country; ?>station_dxcc) { ?>station_dxcc); ?>>station_dxcc; ?>station_gridsquare, ',') !== false ) { ?>station_gridsquare); ?>>station_gridsquare; ?>station_gridsquare); ?>>station_gridsquare; ?>station_iota) { ?>station_iota); ?>>station_iota; ?>station_sota) { ?>station_sota); ?>>station_sota; ?>station_sota) { ?>station_sig); ?>>station_sig; ?>station_sig) { ?>station_sig_info); ?>>station_sig_info; ?>station_cq) { ?>station_cq); ?>>station_cq; ?>station_itu) { ?>station_itu); ?>>station_itu; ?>station_cnty) { ?>station_cnty); ?>>station_cnty; ?>state) { ?>state); ?>>state; ?>COL_STX !="") { ?>COL_STX);?>>COL_STX; ?>COL_STX_STRING !="") { ?>COL_STX_STRING);?>>COL_STX_STRING; ?>COL_SRX !="") { ?>COL_SRX);?>>COL_SRX; ?>COL_SRX_STRING !="") { ?>COL_SRX_STRING);?>>COL_SRX_STRING; ?>COL_TX_PWR; ?>COL_COMMENT !="") { ?>COL_COMMENT);?>>COL_COMMENT; ?> - +load->library('AdifHelper'); + +foreach ($qsos->result() as $qso) { + echo $CI->adifhelper->getAdifLine($qso); +} diff --git a/application/views/qso/edit.php b/application/views/qso/edit.php index fbed95a4..407f5e9c 100755 --- a/application/views/qso/edit.php +++ b/application/views/qso/edit.php @@ -7,15 +7,14 @@ - - + + - - - + + + - @@ -342,7 +341,17 @@
-
+ + +
+ + +
+ +
+ + +
diff --git a/application/views/qso/edit_ajax.php b/application/views/qso/edit_ajax.php index ee9c2cdd..7a126a7d 100644 --- a/application/views/qso/edit_ajax.php +++ b/application/views/qso/edit_ajax.php @@ -7,13 +7,13 @@ - - + + - - + + @@ -387,6 +387,16 @@
+
+ + +
+ +
+ + +
+
diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 1f02128a..312ba52f 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -328,6 +328,18 @@ For example: GM/NS-001
+
+ + + For example: WWFF or POTA +
+ +
+ + + For example: DLFF-0029 +
+
diff --git a/application/views/station_profile/create.php b/application/views/station_profile/create.php index 0f05e4a4..6edb2359 100644 --- a/application/views/station_profile/create.php +++ b/application/views/station_profile/create.php @@ -200,10 +200,19 @@ eQSL QTH Nickname.
-
- - - Find your API key on QRZ.com's settings page +
+
+ + + Find your API key on QRZ.com's settings page +
+
+ + +
diff --git a/application/views/station_profile/edit.php b/application/views/station_profile/edit.php index 5be02219..f7831e8a 100644 --- a/application/views/station_profile/edit.php +++ b/application/views/station_profile/edit.php @@ -222,11 +222,20 @@ eQSL QTH Nickname.
-
+
+
qrzapikey; } ?>"> Find your API key on QRZ.com's settings page
+
+ + +
+
diff --git a/application/views/view_log/qso.php b/application/views/view_log/qso.php index 7a98d489..7719f6e2 100644 --- a/application/views/view_log/qso.php +++ b/application/views/view_log/qso.php @@ -192,6 +192,20 @@ + COL_SIG != null) { ?> + + Sig: + COL_SIG; ?> + + + + COL_SIG_INFO != null) { ?> + + Sig Info: + COL_SIG_INFO; ?> + + + COL_DARC_DOK != null) { ?> DOK: