Submitting LoTW fetch on the import form will download a file from LoTW and stick it in the uploads directory. Working on building the LoTW report download link.

pull/129/head
Corby Krick 2013-02-22 18:30:33 -06:00
rodzic 6cd66a6a4a
commit 8761d52bb7
1 zmienionych plików z 36 dodań i 32 usunięć

Wyświetl plik

@ -19,26 +19,33 @@ class Lotw extends CI_Controller {
$config['allowed_types'] = 'adi|ADI';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
if ($this->input->post('lotwimport') == 'fetch')
{
// Probably need something like
// $this->load->library('arrl_lotw');
// $this->arrl_lotw->fetch_report(someargs)
// Then dump that file into the uploads directory
// Then continue on with the below code using the file that
// got fetched instead of the uploaded one.
// $xml = file_get_contents("http://www.example.com/file.xml");
// http://us.php.net/manual/en/function.file.php
$file = $config['upload_path'] . 'lotwreport_download.adi';
file_put_contents($file, file_get_contents("https://p1k.arrl.org/lotwuser/lotwreport.adi?login=______&password=______&qso_query=1"));
$data['error'] = $this->upload->display_errors();
$this->load->view('layout/header', $data);
$this->load->view('lotw/import');
$this->load->view('layout/footer');
}
else
{
if ($this->input->post('lotwimport') == 'fetch')
if ( ! $this->upload->do_upload())
{
// Probably need something like
// $this->load->library('arrl_lotw');
// $this->arrl_lotw->fetch_report(someargs)
// Then dump that file into the uploads directory
// Then continue on with the below code using the file that
// got fetched instead of the uploaded one.
$data['error'] = $this->upload->display_errors();
$this->load->view('layout/header', $data);
$this->load->view('lotw/import');
$this->load->view('layout/footer');
}
else
{
@ -109,9 +116,6 @@ class Lotw extends CI_Controller {
$this->load->view('lotw/analysis');
$this->load->view('layout/footer');
}
}
}
}
} // end function
} // end class