Basics for ADIF TQ8 headers added based on database info

pull/594/head
Peter Goodhall 2020-08-25 15:53:20 +01:00
rodzic f9448bddb2
commit 047636b674
4 zmienionych plików z 46 dodań i 5 usunięć

Wyświetl plik

@ -153,14 +153,16 @@ class Lotw extends CI_Controller {
if ($station_profiles->num_rows() >= 1) {
foreach ($station_profiles->result() as $station_profile)
{
print_r($station_profile);
// Get Certificate Data
$this->load->model('LotwCert');
$data['station_profile'] = $station_profile;
$data['lotw_cert_info'] = $this->LotwCert->lotw_cert_details($station_profile->station_callsign);
$lotw_cert_info = $this->LotwCert->lotw_cert_details($station_profile->station_callsign, $this->session->userdata('user_id'));
$this->load->model('Dxcc');
$data['station_profile_dxcc'] = $this->Dxcc->lookup_country($data['lotw_cert_info']->cert_dxcc);
print_r($lotw_cert_info);
$this->load->view('lotw_views/adif_views/adif_export', $data);
}
} else {
echo "No Station Profiles";

Wyświetl plik

@ -463,5 +463,19 @@ class DXCC extends CI_Model {
}
return $sql;
}
function lookup_country($country)
{
$query = $this->db->query('
SELECT *
FROM dxcc_entities
WHERE name = "'.$country.'"
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
');
return $query->row();
}
}
?>

Wyświetl plik

@ -25,8 +25,7 @@ class LotwCert extends CI_Model {
return $query;
}
function lotw_cert_details($callsign, $user_id) {
$this->db->where('user_id', $user_id);
function lotw_cert_details($callsign) {
$this->db->where('callsign', $callsign);
$query = $this->db->get('lotw_certs');

Wyświetl plik

@ -0,0 +1,26 @@
<?php
header('Content-Type: text/plain; charset=utf-8');
?>
<TQSL_IDENT:54>TQSL V2.5.4 Lib: V2.5 Config: V11.12 AllowDupes: false
<Rec_Type:5>tCERT
<CERT_UID:1>1
<CERTIFICATE:<?php echo strlen($lotw_cert_info->cert_key); ?>><?php echo $lotw_cert_info->cert_key; ?>
<eor>
<Rec_Type:8>tSTATION
<STATION_UID:1>1
<CERT_UID:1>1
<CALL:<?php echo strlen($lotw_cert_info->callsign); ?>><?php echo $lotw_cert_info->callsign; ?>
<DXCC:<?php echo strlen($station_profile_dxcc->adif); ?>><?php echo $station_profile_dxcc->adif; ?>
<GRIDSQUARE:<?php echo strlen($station_profile->station_gridsquare); ?>><?php echo $station_profile->station_gridsquare; ?>
<?php if(isset($station_profile->station_itu)) { ?><ITUZ:<?php echo strlen($station_profile->station_itu); ?>><?php echo $station_profile->station_itu; ?><?php } ?>
<?php if(isset($station_profile->station_cq)) { ?><CQZ:<?php echo strlen($station_profile->station_cq); ?>><?php echo $station_profile->station_cq; ?><?php } ?>
<?php if(isset($station_profile->station_iota)) { ?><IOTA:<?php echo strlen($station_profile->station_iota); ?>><?php echo $station_profile->station_iota; ?><?php } ?>
<eor>