Improved ADIF code

This commit is contained in:
Peter Goodhall
2011-11-20 15:12:40 +00:00
parent 36b89a5463
commit f09867716c
2 changed files with 21 additions and 20 deletions

View File

@@ -1,19 +1,4 @@
<?php
/*
Copyright 2011 Jason Harris KJ4IWX
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
class ADIF_Parser
{

View File

@@ -438,11 +438,17 @@ class Logbook_model extends CI_Model {
//$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['time_off'])) {
$time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_off']));
} else {
$time_off = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));
}
if(isset($record['freq'])) {
$freq = $record['freq'];
$cleansedstring = preg_replace('#\W#', '', $record['freq']);
$freq = $cleansedstring."000";
} else {
$freq = "0";
}
@@ -451,8 +457,8 @@ class Logbook_model extends CI_Model {
} else {
$name = "";
}
if(isset($record['comment'])) {
$comment = $record['comment'];
if(isset($record['NOTES'])) {
$comment = $record['NOTES'];
} else {
$comment = "";
}
@@ -478,9 +484,19 @@ class Logbook_model extends CI_Model {
if(isset($record['country'])) {
$country = $record['country'];
} else {
$this->load->model('dxcc');
$country = "";
$dxccinfo = $this->dxcc->info($record['call']);
if ($dxccinfo->num_rows() > 0)
{
foreach ($dxccinfo->result() as $row1)
{
$country = ucfirst(strtolower($row1->name));
}
} else {
$country = "";
}
}
if(isset($record['qth'])) {