kopia lustrzana https://github.com/magicbug/Cloudlog
added adif
rodzic
7d9b678d42
commit
e7c06edec1
|
@ -98,7 +98,9 @@ $mimes = array( 'hqx' => 'application/mac-binhex40',
|
|||
'word' => array('application/msword', 'application/octet-stream'),
|
||||
'xl' => 'application/excel',
|
||||
'eml' => 'message/rfc822',
|
||||
'json' => array('application/json', 'text/json')
|
||||
'json' => array('application/json', 'text/json'),
|
||||
'adi' => 'application/octet-stream',
|
||||
'ADI' => 'application/octet-stream',
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@ class adif extends CI_Controller {
|
|||
|
||||
/* Controls ADIF Import/Export Functions */
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('form', 'url'));
|
||||
}
|
||||
|
||||
/* Shows Export Views */
|
||||
public function export() {
|
||||
|
||||
|
@ -38,10 +44,98 @@ class adif extends CI_Controller {
|
|||
|
||||
$this->load->view('adif/data/exportall', $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function import() {
|
||||
$data['page_title'] = "ADIF Import";
|
||||
|
||||
$config['upload_path'] = './uploads/';
|
||||
$config['allowed_types'] = 'adi|ADI';
|
||||
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if ( ! $this->upload->do_upload())
|
||||
{
|
||||
$data['error'] = $this->upload->display_errors();
|
||||
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('adif/import');
|
||||
$this->load->view('layout/footer');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$data = array('upload_data' => $this->upload->data());
|
||||
|
||||
ini_set('memory_limit', '-1');
|
||||
set_time_limit(0);
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$this->load->library('adif_parser');
|
||||
|
||||
$this->adif_parser->load_from_file('./uploads/'.$data['upload_data']['file_name']);
|
||||
|
||||
$this->adif_parser->initialize();
|
||||
|
||||
while($record = $this->adif_parser->get_record())
|
||||
{
|
||||
if(count($record) == 0)
|
||||
{
|
||||
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);
|
||||
};
|
||||
|
||||
unlink('./uploads/'.$data['upload_data']['file_name']);
|
||||
|
||||
$data['page_title'] = "ADIF Imported";
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('adif/import_success');
|
||||
$this->load->view('layout/footer');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function test() {
|
||||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
set_time_limit(0);
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$this->load->library('adif_parser');
|
||||
|
||||
$this->adif_parser->load_from_file('./uploads/2e0sql.ADI');
|
||||
|
||||
$this->adif_parser->initialize();
|
||||
|
||||
while($record = $this->adif_parser->get_record())
|
||||
{
|
||||
if(count($record) == 0)
|
||||
{
|
||||
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);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
|
|
|
@ -432,6 +432,105 @@ class Logbook_model extends CI_Model {
|
|||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
$this->db->delete($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function import($record) {
|
||||
// Join date+time
|
||||
//$datetime = date('Y-m-d') ." ". $this->input->post('start_time');
|
||||
//$myDate = date('Y-m-d', $record['qso_date']);
|
||||
$time_on = 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_off']));
|
||||
|
||||
|
||||
if(isset($record['freq'])) {
|
||||
$freq = $record['freq'];
|
||||
} else {
|
||||
$freq = "0";
|
||||
}
|
||||
if(isset($record['name'])) {
|
||||
$name = $record['name'];
|
||||
} else {
|
||||
$name = "";
|
||||
}
|
||||
if(isset($record['comment'])) {
|
||||
$comment = $record['comment'];
|
||||
} else {
|
||||
$comment = "";
|
||||
}
|
||||
|
||||
if(isset($record['sat_name'])) {
|
||||
$sat_name = $record['sat_name'];
|
||||
} else {
|
||||
$sat_name = "";
|
||||
}
|
||||
|
||||
if(isset($record['sat_mode'])) {
|
||||
$sat_mode = $record['sat_mode'];
|
||||
} else {
|
||||
$sat_mode = "";
|
||||
}
|
||||
|
||||
if(isset($record['gridsquare'])) {
|
||||
$gridsquare = $record['gridsquare'];
|
||||
} else {
|
||||
$gridsquare = "";
|
||||
}
|
||||
|
||||
if(isset($record['country'])) {
|
||||
$country = $record['country'];
|
||||
} else {
|
||||
|
||||
$country = "";
|
||||
|
||||
}
|
||||
|
||||
if(isset($record['qth'])) {
|
||||
$qth = $record['qth'];
|
||||
} else {
|
||||
$qth = "";
|
||||
}
|
||||
|
||||
if(isset($record['prop_mode'])) {
|
||||
$prop_mode = $record['prop_mode'];
|
||||
} else {
|
||||
$prop_mode = "";
|
||||
}
|
||||
|
||||
|
||||
$this->db->where('COL_CALL', $record['call']);
|
||||
$this->db->where('COL_TIME_ON', $time_on);
|
||||
$check = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($check->num_rows() <= 0)
|
||||
{
|
||||
// Create array with QSO Data
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $time_on,
|
||||
'COL_TIME_OFF' => $time_off,
|
||||
'COL_CALL' => strtoupper($record['call']),
|
||||
'COL_BAND' => $record['band'],
|
||||
'COL_FREQ' => $freq,
|
||||
'COL_MODE' => $record['mode'],
|
||||
'COL_RST_RCVD' => $record['rst_rcvd'],
|
||||
'COL_RST_SENT' => $record['rst_sent'],
|
||||
'COL_NAME' => $name,
|
||||
'COL_COMMENT' => $comment,
|
||||
'COL_SAT_NAME' => $sat_name,
|
||||
'COL_SAT_MODE' => $sat_mode,
|
||||
'COL_GRIDSQUARE' => $gridsquare,
|
||||
'COL_COUNTRY' => $country,
|
||||
'COL_QTH' =>$qth,
|
||||
'COL_PROP_MODE' => $prop_mode,
|
||||
'COL_DISTANCE' => 0,
|
||||
'COL_FREQ_RX' => 0,
|
||||
'COL_BAND_RX' => 0,
|
||||
'COL_ANT_AZ' => 0,
|
||||
'COL_ANT_EL' => 0,
|
||||
);
|
||||
|
||||
$this->add_qso($data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<li><a href="<?php echo site_url('setup');?>" title="Setup">Setup</a></li>
|
||||
<li><a href="<?php echo site_url('user');?>" title="Users">Users</a></li>
|
||||
<li><a href="<?php echo site_url('backup');?>" title="Backup">Backup</a></li>
|
||||
<li><a href="<?php echo site_url('adif/import');?>" title="ADIF Import">ADIF Import</a></li>
|
||||
<li><a href="<?php echo site_url('adif/export');?>" title="ADIF Export">ADIF Export</a></li>
|
||||
<li><a href="<?php echo site_url('api/help');?>" title="API">API</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Welcome to CodeIgniter</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font-family: Lucida Grande, Verdana, Sans-serif;
|
||||
font-size: 14px;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 24px 0 2px 0;
|
||||
padding: 5px 0 6px 0;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Monaco, Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Welcome to CodeIgniter!</h1>
|
||||
|
||||
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
|
||||
|
||||
<p>If you would like to edit this page you'll find it located at:</p>
|
||||
<code>application/views/welcome_message.php</code>
|
||||
|
||||
<p>The corresponding controller for this page is found at:</p>
|
||||
<code>application/controllers/welcome.php</code>
|
||||
|
||||
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>
|
||||
|
||||
|
||||
<p><br />Page rendered in {elapsed_time} seconds</p>
|
||||
|
||||
</body>
|
||||
</html>
|
51
license.txt
51
license.txt
|
@ -1,51 +0,0 @@
|
|||
Copyright (c) 2008 - 2011, EllisLab, Inc.
|
||||
All rights reserved.
|
||||
|
||||
This license is a legal agreement between you and EllisLab Inc. for the use
|
||||
of CodeIgniter Software (the "Software"). By obtaining the Software you
|
||||
agree to comply with the terms and conditions of this license.
|
||||
|
||||
PERMITTED USE
|
||||
You are permitted to use, copy, modify, and distribute the Software and its
|
||||
documentation, with or without modification, for any purpose, provided that
|
||||
the following conditions are met:
|
||||
|
||||
1. A copy of this license agreement must be included with the distribution.
|
||||
|
||||
2. Redistributions of source code must retain the above copyright notice in
|
||||
all source code files.
|
||||
|
||||
3. Redistributions in binary form must reproduce the above copyright notice
|
||||
in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
4. Any files that have been modified must carry notices stating the nature
|
||||
of the change and the names of those who changed them.
|
||||
|
||||
5. Products derived from the Software must include an acknowledgment that
|
||||
they are derived from CodeIgniter in their documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
6. Products derived from the Software may not be called "CodeIgniter",
|
||||
nor may "CodeIgniter" appear in their name, without prior written
|
||||
permission from EllisLab, Inc.
|
||||
|
||||
INDEMNITY
|
||||
You agree to indemnify and hold harmless the authors of the Software and
|
||||
any contributors for any direct, indirect, incidental, or consequential
|
||||
third-party claims, actions or suits, as well as any related expenses,
|
||||
liabilities, damages, settlements or fees arising from your use or misuse
|
||||
of the Software, or a violation of any terms of this license.
|
||||
|
||||
DISCLAIMER OF WARRANTY
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR
|
||||
IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF QUALITY, PERFORMANCE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
LIMITATIONS OF LIABILITY
|
||||
YOU ASSUME ALL RISK ASSOCIATED WITH THE INSTALLATION AND USE OF THE SOFTWARE.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE LIABLE
|
||||
FOR CLAIMS, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION
|
||||
WITH THE SOFTWARE. LICENSE HOLDERS ARE SOLELY RESPONSIBLE FOR DETERMINING THE
|
||||
APPROPRIATENESS OF USE AND ASSUME ALL RISKS ASSOCIATED WITH ITS USE, INCLUDING
|
||||
BUT NOT LIMITED TO THE RISKS OF PROGRAM ERRORS, DAMAGE TO EQUIPMENT, LOSS OF
|
||||
DATA OR SOFTWARE PROGRAMS, OR UNAVAILABILITY OR INTERRUPTION OF OPERATIONS.
|
Ładowanie…
Reference in New Issue