Merge pull request #151 from skweeker/master

Misc improvements to eqsl and lotw import
这个提交包含在:
Peter Goodhall 2013-11-15 13:34:53 -08:00
当前提交 d34e9c47ed
共有 3 个文件被更改,包括 89 次插入98 次删除

查看文件

@ -27,61 +27,59 @@ class eqsl extends CI_Controller {
$this->adif_parser->load_from_file($filepath); $this->adif_parser->load_from_file($filepath);
$this->adif_parser->initialize(); $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>"; $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));
$table .= "<tr class=\"titles\">";
$table .= "<td>Date</td>"; // The report from eQSL should only contain entries that have been confirmed via eQSL
$table .= "<td>Call</td>"; // If there's a match for the QSO from the report in our log, it's confirmed via eQSL.
$table .= "<td>Mode</td>";
$table .= "<td>Log Status</td>"; // If we have a positive match from LoTW, record it in the DB according to the user's preferences
$table .= "<td>eQSL Status</td>"; if ($record['qsl_sent'] == "Y")
$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'])); $record['qsl_sent'] = $config['eqsl_rcvd_mark'];
}
// 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. $status = $this->logbook_model->import_check($time_on, $record['call'], $record['band']);
if ($status == "Found")
// If we have a positive match from LoTW, record it in the DB according to the user's preferences {
if ($record['qsl_sent'] == "Y") $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']; $eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $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.";
}
} }
else 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>"; $table .= "</table>";
$data['eqsl_results_table_headers'] = $tableheaders;
$data['eqsl_results_table'] = $table; $data['eqsl_results_table'] = $table;
} }
unlink($filepath); unlink($filepath);

查看文件

@ -28,68 +28,60 @@ class Lotw extends CI_Controller {
$this->adif_parser->initialize(); $this->adif_parser->initialize();
$table = "<table>"; $tableheaders = "<table>";
$table .= "<tr class=\"titles\">"; $tableheaders .= "<tr class=\"titles\">";
$table .= "<td>Date</td>"; $tableheaders .= "<td>QSO Date</td>";
$table .= "<td>Call</td>"; $tableheaders .= "<td>Call</td>";
$table .= "<td>Mode</td>"; $tableheaders .= "<td>Mode</td>";
$table .= "<td>Log Status</td>"; $tableheaders .= "<td>LoTW QSL Received</td>";
$table .= "<td>LoTW Status</td>"; $tableheaders .= "<td>Date LoTW Confirmed</td>";
$table .= "<tr>"; $tableheaders .= "<td>Log Status</td>";
$tableheaders .= "<td>LoTW Status</td>";
$tableheaders .= "<tr>";
while($record = $this->adif_parser->get_record()) $table = "";
{ while($record = $this->adif_parser->get_record())
if(count($record) == 0)
{ {
break;
};
$time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));
//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'])); $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'])) { if (isset($record['time_off'])) {
$time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_off'])); $time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_off']));
} else { } else {
$time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on'])); $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 .= "<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 we have a positive match from LoTW, record it in the DB according to the user's preferences if ($table != "")
if ($record['qsl_rcvd'] == "Y")
{ {
$record['qsl_rcvd'] = $config['lotw_rcvd_mark']; $table .= "</table>";
} $data['lotw_table_headers'] = $tableheaders;
$data['lotw_table'] = $table;
$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>";
unlink($filepath); unlink($filepath);
$data['lotw_table'] = $table;
$data['page_title'] = "LoTW ADIF Information"; $data['page_title'] = "LoTW ADIF Information";
$this->load->view('layout/header', $data); $this->load->view('layout/header', $data);
$this->load->view('lotw/analysis'); $this->load->view('lotw/analysis');

查看文件

@ -4,9 +4,10 @@
<?php $this->load->view('layout/messages'); ?> <?php $this->load->view('layout/messages'); ?>
<?php <?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; echo $eqsl_results_table;
} }
else else