mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Use central function to generate ADIF-Header
This commit is contained in:
@@ -103,11 +103,7 @@ class adif extends CI_Controller {
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
// Output ADIF header // No chance to use exportall-view any longer, because of chunking logic
|
||||
echo "Wavelog ADIF export\n";
|
||||
echo "<ADIF_VER:5>3.1.6\n";
|
||||
echo "<PROGRAMID:".strlen($this->config->item('app_name')).">".$this->config->item('app_name')."\r\n";
|
||||
echo "<PROGRAMVERSION:".strlen($this->optionslib->get_option('version')).">".$this->optionslib->get_option('version')."\r\n";
|
||||
echo "<EOH>\n\n";
|
||||
echo $this->adifhelper->getAdifHeader($this->config->item('app_name'),$this->optionslib->get_option('version'));
|
||||
|
||||
// Stream QSOs in 5K chunks
|
||||
$offset = 0;
|
||||
@@ -204,12 +200,7 @@ class adif extends CI_Controller {
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
// Output ADIF header // No chance to use exportall-view any longer, because of chunking logic
|
||||
echo "Wavelog ADIF export\n";
|
||||
echo "<ADIF_VER:5>3.1.6\n";
|
||||
echo "<PROGRAMID:".strlen($this->config->item('app_name')).">".$this->config->item('app_name')."\r\n";
|
||||
echo "<PROGRAMVERSION:".strlen($this->optionslib->get_option('version')).">".$this->optionslib->get_option('version')."\r\n";
|
||||
echo "<EOH>\n\n";
|
||||
echo $this->adifhelper->getAdifHeader($this->config->item('app_name'),$this->optionslib->get_option('version'));
|
||||
|
||||
// Collect QSO IDs for LoTW marking (since we can't access all at once)
|
||||
$qso_ids_for_lotw = [];
|
||||
|
||||
@@ -453,11 +453,7 @@ class API extends CI_Controller {
|
||||
$offset = 0;
|
||||
|
||||
// Start building ADIF content
|
||||
$adif_content = "Wavelog ADIF export\n";
|
||||
$adif_content .= "<ADIF_VER:5>3.1.6\n";
|
||||
$adif_content .= "<PROGRAMID:".strlen($this->config->item('app_name')).">".$this->config->item('app_name')."\r\n";
|
||||
$adif_content .= "<PROGRAMVERSION:".strlen($this->optionslib->get_option('version')).">".$this->optionslib->get_option('version')."\r\n";
|
||||
$adif_content .= "<EOH>\n\n";
|
||||
$adif_content = $this->adifhelper->getAdifHeader($this->config->item('app_name'),$this->optionslib->get_option('version'));
|
||||
|
||||
do {
|
||||
// Calculate chunk size for this iteration
|
||||
|
||||
@@ -262,6 +262,15 @@ class AdifHelper {
|
||||
return $line;
|
||||
}
|
||||
|
||||
function getAdifHeader($app_name,$version) {
|
||||
$adif_header = "Wavelog ADIF export\n";
|
||||
$adif_header .= "<ADIF_VER:5>3.1.6\n";
|
||||
$adif_header .= "<PROGRAMID:".strlen($app_name).">".$app_name."\r\n";
|
||||
$adif_header .= "<PROGRAMVERSION:".strlen($version).">".$version."\r\n";
|
||||
$adif_header .= "<EOH>\n\n";
|
||||
return $adif_header;
|
||||
}
|
||||
|
||||
function getAdifFieldLine($adifcolumn, $dbvalue) {
|
||||
if ($dbvalue !== "" && $dbvalue !== null && $dbvalue !== 0) {
|
||||
return "<" . $adifcolumn . ":" . mb_strlen($dbvalue, "UTF-8") . ">" . $dbvalue . "\r\n";
|
||||
|
||||
@@ -5,19 +5,13 @@
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="'.$this->session->userdata('user_callsign').'-'.date('Ymd-Hi').'.adi"');
|
||||
}
|
||||
?>
|
||||
Wavelog ADIF export
|
||||
<ADIF_VER:5>3.1.6
|
||||
<PROGRAMID:<?php echo strlen($this->config->item('app_name')); ?>><?php echo $this->config->item('app_name')."\r\n"; ?>
|
||||
<PROGRAMVERSION:<?php echo strlen($this->optionslib->get_option('version')); ?>><?php echo $this->optionslib->get_option('version')."\r\n"; ?>
|
||||
<EOH>
|
||||
|
||||
<?php
|
||||
$CI =& get_instance();
|
||||
if (!$CI->load->is_loaded('AdifHelper')) {
|
||||
$CI->load->library('AdifHelper');
|
||||
}
|
||||
|
||||
echo $this->adifhelper->getAdifHeader($CI->config->item('app_name'),$CI->optionslib->get_option('version'));
|
||||
|
||||
foreach ($qsos->result() as $qso) {
|
||||
echo $CI->adifhelper->getAdifLine($qso);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user