Working on getting the export running. At the point where I am ready to start trying to do the HTTP posts to eQSL.cc

这个提交包含在:
Corby Krick 2013-09-08 15:30:24 -05:00
父节点 7bb1748332
当前提交 4406931674
共有 4 个文件被更改,包括 87 次插入18 次删除

查看文件

@ -100,7 +100,7 @@ class eqsl extends CI_Controller {
{
$file = $config['upload_path'] . 'eqslreport_download.adi';
// Get credentials for LoTW
// Get credentials for eQSL
$query = $this->user_model->get_by_id($this->session->userdata('user_id'));
$q = $query->row();
$data['user_eqsl_name'] = $q->user_eqsl_name;
@ -182,23 +182,63 @@ class eqsl extends CI_Controller {
} // end function
public function export() {
$data['page_title'] = "eQSL Report Upload";
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'tq8|TQ8';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
$this->load->model('logbook_model');
$data['page_title'] = "eQSL QSO Upload";
if ($this->input->post('eqslexport') == "export")
{
$data['error'] = $this->upload->display_errors();
$this->load->view('layout/header', $data);
$this->load->view('eqsl/export');
$this->load->view('layout/footer');
// Check for credentials
// Grab the list of QSOs to send information about
// perform an HTTP get on each one, and grab the status back
$qslsnotsent = $this->logbook_model->eqsl_not_yet_sent();
// Build out the ADIF info string
$adif = "";
foreach ($qslsnotsent->result_array() as $qsl)
{
}
// Perform a big HTTP POST with the ADIF information at the back
// http://www.eqsl.cc/qslcard/ImportADIF.txt
// Dump out a table with the results
}
else
{
{
$qslsnotsent = $this->logbook_model->eqsl_not_yet_sent();
if ($qslsnotsent->num_rows() > 0)
{
$table = "<table>";
$table .= "<tr class=\"titles\">";
$table .= "<td>Date</td>";
$table .= "<td>Call</td>";
$table .= "<td>Mode</td>";
$table .= "<td>Band</td>";
$table .= "<tr>";
foreach ($qslsnotsent->result_array() as $qsl)
{
$table .= "<tr>";
$table .= "<td>".$qsl['COL_TIME_ON']."</td>";
$table .= "<td><a class=\"qsobox\" href=\"".site_url('qso/edit')."/".$qsl['COL_PRIMARY_KEY']."\">".strtoupper($qsl['COL_CALL'])."</a></td>";
$table .= "<td>".$qsl['COL_MODE']."</td>";
$table .= "<td>".$qsl['COL_BAND']."</td>";
$table .= "<tr>";
}
$table .= "</table>";
$data['eqsl_table'] = $table;
}
}
$this->load->view('layout/header', $data);
$this->load->view('eqsl/export');
$this->load->view('layout/footer');
/* OLD STUFF from LOTW
$data = array('upload_data' => $this->upload->data());
// Figure out how we should be marking QSLs confirmed via LoTW
@ -230,7 +270,6 @@ class eqsl extends CI_Controller {
$ch = curl_init();
// extra headers
$headers[] = "Accept: */*";
$headers[] = "Connection: Keep-Alive";
// basic curl options for all requests
@ -297,11 +336,11 @@ class eqsl extends CI_Controller {
// Now we need to clean up
unlink($cookie_file_path);
unlink('./uploads/'.$data['upload_data']['file_name']);
$this->load->view('layout/header', $data);
$this->load->view('eqsl/status');
$this->load->view('layout/footer');
}
*/
}
} // end class

查看文件

@ -654,6 +654,14 @@ class Logbook_model extends CI_Model {
}
}
// Show all QSOs we need to send to eQSL
function eqsl_not_yet_sent() {
$this->db->select('COL_PRIMARY_KEY, COL_TIME_ON, COL_CALL, COL_BAND, COL_MODE');
$this->db->where('COL_EQSL_QSL_SENT', 'N');
return $this->db->get($this->config->item('table_name'));
}
function import($record) {
// Join date+time
//$datetime = date('Y-m-d') ." ". $this->input->post('start_time');

查看文件

@ -0,0 +1,21 @@
<div id="container">
<h2><?php echo $page_title; ?></h2>
<?php $this->load->view('layout/messages'); ?>
<?php
if (isset($eqsl_table))
{
echo "<p>The following QSOs have not been sent to eQSL.cc</p>";
echo $eqsl_table;
echo "<p>Clicking \"Upload QSOs\" will send QSO information to eQSL.cc.</p>";
echo form_open('eqsl/export');
echo "<input type=\"hidden\" name=\"eqslexport\" id=\"eqslexport\" value=\"export\" />";
echo "<input class=\"btn primary\" type=\"submit\" value=\"Upload QSOs\" /></form>";
}
else
{
echo "<p>There are no QSOs that need to be sent to eQSL.cc at this time. Go log some more QSOs!</p>";
}
?>
</div>

查看文件

@ -88,6 +88,7 @@
<li><a href="<?php echo site_url('export');?>" title="Data Export">Data Export</a></li>
<li><a href="<?php echo site_url('api/help');?>" title="API">API</a></li>
<li><a href="<?php echo site_url('eqsl/import');?>" title="eQSL Import">eQSL Import</a></li>
<li><a href="<?php echo site_url('eqsl/export');?>" title="eQSL Import">eQSL Export</a></li>
<li><a href="<?php echo site_url('lotw/import');?>" title="LoTW Import">LoTW Import</a></li>
<li><a href="<?php echo site_url('lotw/export');?>" title="LoTW Export">LoTW Export</a></li>
</ul>