From 11c5d0d9c5b3c608a5c5b7cba7252d9e4bc2bb32 Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Mon, 11 Nov 2013 11:24:20 -0600 Subject: [PATCH 1/2] Correcting the result table headers to match the data displayed. --- application/controllers/lotw.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/lotw.php b/application/controllers/lotw.php index 080f5ffc..e8db94d3 100644 --- a/application/controllers/lotw.php +++ b/application/controllers/lotw.php @@ -30,9 +30,11 @@ class Lotw extends CI_Controller { $table = ""; $table .= ""; - $table .= ""; + $table .= ""; $table .= ""; $table .= ""; + $table .= ""; + $table .= ""; $table .= ""; $table .= ""; $table .= ""; From efbc22e6653baf18b57e64b65aecd5b3447c57ca Mon Sep 17 00:00:00 2001 From: Corby Krick Date: Fri, 15 Nov 2013 15:28:56 -0600 Subject: [PATCH 2/2] Results table headers now correctly only show when results are available. Also fixing issue where the first record downloaded from eqsl and lotw was not displayed in the results table. LoTW import now displays message if no results available. --- application/controllers/eqsl.php | 86 +++++++++++++------------ application/controllers/lotw.php | 98 +++++++++++++---------------- application/views/eqsl/analysis.php | 5 +- 3 files changed, 89 insertions(+), 100 deletions(-) diff --git a/application/controllers/eqsl.php b/application/controllers/eqsl.php index 9259c590..d8594266 100644 --- a/application/controllers/eqsl.php +++ b/application/controllers/eqsl.php @@ -27,61 +27,59 @@ class eqsl extends CI_Controller { $this->adif_parser->load_from_file($filepath); $this->adif_parser->initialize(); - - $records = $this->adif_parser->get_record(); - if (count($records) > 0) + $tableheaders = "
DateQSO DateCallModeLoTW QSL ReceivedDate LoTW ConfirmedLog StatusLoTW Status
"; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $table = ""; + while ($record = $this->adif_parser->get_record()) { - $table = "
DateCallModeLog StatuseQSL Status
"; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - while($record = $this->adif_parser->get_record()) + $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); + + // The report from eQSL should only contain entries that have been confirmed via eQSL + // If there's a match for the QSO from the report in our log, it's confirmed via eQSL. + + // If we have a positive match from LoTW, record it in the DB according to the user's preferences + if ($record['qsl_sent'] == "Y") { - $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); - - // The report from eQSL should only contain entries that have been confirmed via eQSL - // If there's a match for the QSO from the report in our log, it's confirmed via eQSL. - - // If we have a positive match from LoTW, record it in the DB according to the user's preferences - if ($record['qsl_sent'] == "Y") + $record['qsl_sent'] = $config['eqsl_rcvd_mark']; + } + + $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']); + if ($status == "Found") + { + $dupe = $this->logbook_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); + if ($dupe == false) { - $record['qsl_sent'] = $config['eqsl_rcvd_mark']; - } - - $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']); - if ($status == "Found") - { - $dupe = $this->logbook_model->eqsl_dupe_check($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); - if ($dupe == false) - { - $eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); - } - else - { - $eqsl_status = "Already received an eQSL for this QSO."; - } + $eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']); } else { - $eqsl_status = "QSO not found"; + $eqsl_status = "Already received an eQSL for this QSO."; } - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; } - + else + { + $eqsl_status = "QSO not found"; + } + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + } + if ($table != "") + { $table .= "
DateCallModeLog StatuseQSL Status
".$time_on."".$record['call']."".$record['mode']."QSO Record: ".$status."eQSL Record: ".$eqsl_status."
".$time_on."".$record['call']."".$record['mode']."QSO Record: ".$status."eQSL Record: ".$eqsl_status."
"; + $data['eqsl_results_table_headers'] = $tableheaders; $data['eqsl_results_table'] = $table; - } unlink($filepath); diff --git a/application/controllers/lotw.php b/application/controllers/lotw.php index e8db94d3..8cac9125 100644 --- a/application/controllers/lotw.php +++ b/application/controllers/lotw.php @@ -28,70 +28,60 @@ class Lotw extends CI_Controller { $this->adif_parser->initialize(); - $table = ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; + $tableheaders = "
QSO DateCallModeLoTW QSL ReceivedDate LoTW ConfirmedLog StatusLoTW Status
"; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; + $tableheaders .= ""; - while($record = $this->adif_parser->get_record()) - { - if(count($record) == 0) + $table = ""; + while($record = $this->adif_parser->get_record()) { - break; - }; - - - //echo date('Y-m-d', strtotime($record['qso_date']))."
"; - //echo date('H:m', strtotime($record['time_on']))."
"; - - //$this->logbook_model->import($record); - - //echo $record["call"]."
"; - //print_r($record->); + $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); - $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); - - $qsl_date = date('Y-m-d', strtotime($record['qslrdate'])) ." ".date('H:i', strtotime($record['qslrdate'])); + $qsl_date = date('Y-m-d', strtotime($record['qslrdate'])) ." ".date('H:i', strtotime($record['qslrdate'])); - if (isset($record['time_off'])) { - $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_off'])); - } else { - $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); + if (isset($record['time_off'])) { + $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_off'])); + } else { + $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); + } + + // If we have a positive match from LoTW, record it in the DB according to the user's preferences + if ($record['qsl_rcvd'] == "Y") + { + $record['qsl_rcvd'] = $config['lotw_rcvd_mark']; + } + + $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']); + $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd']); + + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; + $table .= ""; } - // If we have a positive match from LoTW, record it in the DB according to the user's preferences - if ($record['qsl_rcvd'] == "Y") + if ($table != "") { - $record['qsl_rcvd'] = $config['lotw_rcvd_mark']; - } - - $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']); - $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd']); - - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - $table .= ""; - }; - - $table .= "
QSO DateCallModeLoTW QSL ReceivedDate LoTW ConfirmedLog StatusLoTW Status
".$time_on."".$record['call']."".$record['mode']."".$record['qsl_rcvd']."".$qsl_date."QSO Record: ".$status."LoTW Record: ".$lotw_status."
".$time_on."".$record['call']."".$record['mode']."".$record['qsl_rcvd']."".$qsl_date."QSO Record: ".$status."LoTW Record: ".$lotw_status."
"; - + $table .= ""; + $data['lotw_table_headers'] = $tableheaders; + $data['lotw_table'] = $table; + } + unlink($filepath); - $data['lotw_table'] = $table; - $data['page_title'] = "LoTW ADIF Information"; $this->load->view('layout/header', $data); $this->load->view('lotw/analysis'); diff --git a/application/views/eqsl/analysis.php b/application/views/eqsl/analysis.php index 18ce724e..808b8fd0 100644 --- a/application/views/eqsl/analysis.php +++ b/application/views/eqsl/analysis.php @@ -4,9 +4,10 @@ load->view('layout/messages'); ?> The following QSOs have been received from eQSL.cc

"; + echo "

The following QSLs have been received from eQSL.cc

"; + echo $eqsl_results_table_headers; echo $eqsl_results_table; } else