Skip to content

Commit

Permalink
Results table headers now correctly only show when results are availa…
Browse files Browse the repository at this point in the history
…ble. 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.
  • Loading branch information
skweeker committed Nov 15, 2013
1 parent 11c5d0d commit efbc22e
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 100 deletions.
86 changes: 42 additions & 44 deletions application/controllers/eqsl.php
Expand Up @@ -27,61 +27,59 @@ private function loadFromFile($filepath)
$this->adif_parser->load_from_file($filepath);

$this->adif_parser->initialize();

$records = $this->adif_parser->get_record();

if (count($records) > 0)
$tableheaders = "<table>";
$tableheaders .= "<tr class=\"titles\">";
$tableheaders .= "<td>Date</td>";
$tableheaders .= "<td>Call</td>";
$tableheaders .= "<td>Mode</td>";
$tableheaders .= "<td>Log Status</td>";
$tableheaders .= "<td>eQSL Status</td>";
$tableheaders .= "<tr>";
$table = "";
while ($record = $this->adif_parser->get_record())
{
$table = "<table>";
$table .= "<tr class=\"titles\">";
$table .= "<td>Date</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>Log Status</td>";
$table .= "<td>eQSL Status</td>";
$table .= "<tr>";
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")
$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)
{
$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 .= "<tr>";
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>eQSL Record: ".$eqsl_status."</td>";
$table .= "<tr>";
}

else
{
$eqsl_status = "QSO not found";
}
$table .= "<tr>";
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>eQSL Record: ".$eqsl_status."</td>";
$table .= "<tr>";
}
if ($table != "")
{
$table .= "</table>";
$data['eqsl_results_table_headers'] = $tableheaders;
$data['eqsl_results_table'] = $table;

}

unlink($filepath);
Expand Down
98 changes: 44 additions & 54 deletions application/controllers/lotw.php
Expand Up @@ -28,70 +28,60 @@ private function loadFromFile($filepath)

$this->adif_parser->initialize();

$table = "<table>";
$table .= "<tr class=\"titles\">";
$table .= "<td>QSO Date</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>LoTW QSL Received</td>";
$table .= "<td>Date LoTW Confirmed</td>";
$table .= "<td>Log Status</td>";
$table .= "<td>LoTW Status</td>";
$table .= "<tr>";
$tableheaders = "<table>";
$tableheaders .= "<tr class=\"titles\">";
$tableheaders .= "<td>QSO Date</td>";
$tableheaders .= "<td>Call</td>";
$tableheaders .= "<td>Mode</td>";
$tableheaders .= "<td>LoTW QSL Received</td>";
$tableheaders .= "<td>Date LoTW Confirmed</td>";
$tableheaders .= "<td>Log Status</td>";
$tableheaders .= "<td>LoTW Status</td>";
$tableheaders .= "<tr>";

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']))."<br>";
//echo date('H:m', strtotime($record['time_on']))."<br>";

//$this->logbook_model->import($record);

//echo $record["call"]."<br>";
//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'];
}
// 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']);
$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 .= "<tr>";
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>".$record['qsl_rcvd']."</td>";
$table .= "<td>".$qsl_date."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>LoTW Record: ".$lotw_status."</td>";
$table .= "<tr>";
};

$table .= "</table>";

$table .= "<tr>";
$table .= "<td>".$time_on."</td>";
$table .= "<td>".$record['call']."</td>";
$table .= "<td>".$record['mode']."</td>";
$table .= "<td>".$record['qsl_rcvd']."</td>";
$table .= "<td>".$qsl_date."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>LoTW Record: ".$lotw_status."</td>";
$table .= "<tr>";
}

if ($table != "")
{
$table .= "</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');
Expand Down
5 changes: 3 additions & 2 deletions application/views/eqsl/analysis.php
Expand Up @@ -4,9 +4,10 @@
<?php $this->load->view('layout/messages'); ?>

<?php
if (isset($eqsl_results_table))
if (isset($eqsl_results_table_headers))
{
echo "<p>The following QSOs have been received from eQSL.cc</p>";
echo "<p>The following QSLs have been received from eQSL.cc</p>";
echo $eqsl_results_table_headers;
echo $eqsl_results_table;
}
else
Expand Down

0 comments on commit efbc22e

Please sign in to comment.