kopia lustrzana https://github.com/magicbug/Cloudlog
Works now if QSLs are not waiting to be downloaded
rodzic
0e348f4bb7
commit
e9fdc07b93
|
@ -28,57 +28,63 @@ class eqsl extends CI_Controller {
|
|||
|
||||
$this->adif_parser->initialize();
|
||||
|
||||
$table = "<table>";
|
||||
|
||||
while($record = $this->adif_parser->get_record())
|
||||
$records = $this->adif_parser->get_record();
|
||||
|
||||
if (count($records) > 0)
|
||||
{
|
||||
/*if(count($record) == 0)
|
||||
$table = "<table>";
|
||||
$table .= "<tr>";
|
||||
$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())
|
||||
{
|
||||
break;
|
||||
};
|
||||
*/
|
||||
$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)
|
||||
$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")
|
||||
{
|
||||
$eqsl_status = $this->logbook_model->eqsl_update($time_on, $record['call'], $record['band'], $config['eqsl_rcvd_mark']);
|
||||
$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.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$eqsl_status = "Already received an eQSL for this QSO.";
|
||||
$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>";
|
||||
}
|
||||
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>";
|
||||
};
|
||||
|
||||
$table .= "</table>";
|
||||
$data['eqsl_results_table'] = $table;
|
||||
|
||||
}
|
||||
|
||||
$table .= "</table>";
|
||||
|
||||
//unlink($filepath);
|
||||
|
||||
$data['eqsl_table'] = $table;
|
||||
unlink($filepath);
|
||||
|
||||
$data['page_title'] = "eQSL Import Information";
|
||||
$this->load->view('layout/header', $data);
|
||||
|
@ -163,7 +169,7 @@ class eqsl extends CI_Controller {
|
|||
}
|
||||
else
|
||||
{
|
||||
if (stristr($result, "Your ADIF log file has been built"))
|
||||
if (stristr($input, "Your ADIF log file has been built"))
|
||||
{
|
||||
// Get all the links on the page and grab the URL for the ADI file.
|
||||
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
|
||||
|
@ -173,6 +179,7 @@ class eqsl extends CI_Controller {
|
|||
// Look for the link that has the .adi file, and download it to $file
|
||||
if (substr($match, -4, 4) == ".adi")
|
||||
{
|
||||
|
||||
file_put_contents($file, file_get_contents("http://eqsl.cc/qslcard/" . $match));
|
||||
ini_set('memory_limit', '-1');
|
||||
$this->loadFromFile($file);
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
<div id="container">
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<?php echo $eqsl_table; ?>
|
||||
<?php $this->load->view('layout/messages'); ?>
|
||||
|
||||
<?php
|
||||
if (isset($eqsl_results_table))
|
||||
{
|
||||
echo "<p>The following QSOs have been received from eQSL.cc</p>";
|
||||
echo $eqsl_results_table;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<p>There are no QSO confirmations waiting for you at eQSL.cc</p>";
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
|
Ładowanie…
Reference in New Issue