kopia lustrzana https://github.com/magicbug/Cloudlog
Merge branch 'master' into fix_edit_transmit_pwr
commit
438352f519
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 55;
|
||||
$config['migration_version'] = 56;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -76,7 +76,6 @@ class adif extends CI_Controller {
|
|||
}
|
||||
|
||||
public function export_custom() {
|
||||
|
||||
// Set memory limit to unlimited to allow heavy usage
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
|
@ -87,12 +86,14 @@ class adif extends CI_Controller {
|
|||
$exportLotw = true;
|
||||
} else {
|
||||
$exportLotw = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to'), $exportLotw);
|
||||
|
||||
|
||||
$this->load->view('adif/data/exportall', $data);
|
||||
|
||||
|
||||
if ($this->input->post('markLotw') == 1) {
|
||||
foreach ($data['qsos']->result() as $qso)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class AdifHelper {
|
||||
|
||||
public function getAdifLine($qso) {
|
||||
$line = "";
|
||||
$line .= $this->getAdifFieldLine("CALL", $qso->COL_CALL);
|
||||
$line .= $this->getAdifFieldLine("BAND", $qso->COL_BAND);
|
||||
$line .= $this->getAdifFieldLine("MODE", $qso->COL_MODE);
|
||||
|
||||
if ($qso->COL_SUBMODE) {
|
||||
$line .= $this->getAdifFieldLine("SUBMODE", $qso->COL_SUBMODE);
|
||||
}
|
||||
|
||||
if ($qso->COL_FREQ != 0) {
|
||||
$freq_in_mhz = $qso->COL_FREQ / 1000000;
|
||||
$line .= $this->getAdifFieldLine("FREQ", $freq_in_mhz);
|
||||
}
|
||||
|
||||
if ($qso->COL_FREQ_RX != 0) {
|
||||
$freq_rx_in_mhz = $qso->COL_FREQ_RX / 1000000;
|
||||
$line .= $this->getAdifFieldLine("FREQ_RX", $freq_rx_in_mhz);
|
||||
}
|
||||
|
||||
if ($qso->COL_BAND_RX) {
|
||||
$line .= $this->getAdifFieldLine("BAND_RX", $qso->COL_BAND_RX);
|
||||
}
|
||||
|
||||
$date_on = strtotime($qso->COL_TIME_ON);
|
||||
$new_date = date('Ymd', $date_on);
|
||||
$line .= $this->getAdifFieldLine("QSO_DATE", $new_date);
|
||||
|
||||
$time_on = strtotime($qso->COL_TIME_ON);
|
||||
$new_on = date('His', $time_on);
|
||||
$line .= $this->getAdifFieldLine("TIME_ON", $new_on);
|
||||
|
||||
$time_off = strtotime($qso->COL_TIME_OFF);
|
||||
$new_off = date('His', $time_off);
|
||||
$line .= $this->getAdifFieldLine("TIME_OFF", $new_off);
|
||||
|
||||
$line .= $this->getAdifFieldLine("RST_RCVD", $qso->COL_RST_RCVD);
|
||||
|
||||
$line .= $this->getAdifFieldLine("RST_SENT", $qso->COL_RST_SENT);
|
||||
|
||||
$line .= $this->getAdifFieldLine("QSL_RCVD", $qso->COL_QSL_RCVD);
|
||||
|
||||
$line .= $this->getAdifFieldLine("QSL_SENT", $qso->COL_QSL_SENT);
|
||||
|
||||
$line .= $this->getAdifFieldLine("COUNTRY", $qso->COL_COUNTRY);
|
||||
|
||||
if ($qso->COL_VUCC_GRIDS != "") {
|
||||
$line .= $this->getAdifFieldLine("VUCC_GRIDS", $qso->COL_VUCC_GRIDS);
|
||||
}
|
||||
if ($qso->COL_VUCC_GRIDS == "" && $qso->COL_GRIDSQUARE != "") {
|
||||
$line .= $this->getAdifFieldLine("GRIDSQUARE", $qso->COL_GRIDSQUARE);
|
||||
}
|
||||
if ($qso->COL_SAT_NAME) {
|
||||
if ($qso->COL_SAT_MODE != 0 || $qso->COL_SAT_MODE !="") {
|
||||
$line .= $this->getAdifFieldLine("SAT_MODE", $qso->COL_SAT_MODE);
|
||||
$line .= $this->getAdifFieldLine("SAT_NAME", $qso->COL_SAT_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
$line .= $this->getAdifFieldLine("PROP_MODE", $qso->COL_PROP_MODE);
|
||||
|
||||
$line .= $this->getAdifFieldLine("NAME", $qso->COL_NAME);
|
||||
|
||||
$line .= $this->getAdifFieldLine("STATE", $qso->COL_STATE);
|
||||
|
||||
$line .= $this->getAdifFieldLine("SOTA_REF", $qso->COL_SOTA_REF);
|
||||
|
||||
$line .= $this->getAdifFieldLine("OPERATOR", $qso->COL_OPERATOR);
|
||||
|
||||
$line .= $this->getAdifFieldLine("STATION_CALLSIGN", $qso->station_callsign);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_CITY", $qso->station_city);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_COUNTRY", $qso->station_country);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_DXCC", $qso->station_dxcc);
|
||||
|
||||
if (strpos($qso->station_gridsquare, ',') !== false ) {
|
||||
$line .= $this->getAdifFieldLine("MY_VUCC_GRIDS", $qso->station_gridsquare);
|
||||
}
|
||||
else {
|
||||
$line .= $this->getAdifFieldLine("MY_GRIDSQUARE", $qso->station_gridsquare);
|
||||
}
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_IOTA", $qso->station_iota);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_SOTA_REF", $qso->station_sota);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_CQ_ZONE", $qso->station_cq);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_ITU_ZONE", $qso->station_itu);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_CNTY", $qso->station_cnty);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_STATE", $qso->COL_MY_STATE);
|
||||
|
||||
$line .= $this->getAdifFieldLine("STX", $qso->COL_STX);
|
||||
|
||||
$line .= $this->getAdifFieldLine("STX_STRING", $qso->COL_STX_STRING);
|
||||
|
||||
$line .= $this->getAdifFieldLine("SRX", $qso->COL_SRX);
|
||||
|
||||
$line .= $this->getAdifFieldLine("SRX_STRING", $qso->COL_SRX_STRING);
|
||||
|
||||
$line .= $this->getAdifFieldLine("TX_PWR", $qso->COL_TX_PWR);
|
||||
|
||||
$line .= $this->getAdifFieldLine("COMMENT", $qso->COL_COMMENT);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_SIG", $qso->station_sig);
|
||||
|
||||
$line .= $this->getAdifFieldLine("MY_SIG_INFO", $qso->station_sig_info);
|
||||
|
||||
$line .= $this->getAdifFieldLine("SIG", $qso->COL_SIG);
|
||||
|
||||
$line .= $this->getAdifFieldLine("SIG_INFO", $qso->COL_SIG_INFO);
|
||||
|
||||
$line .= "<eor>\r\n";
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
function getAdifFieldLine($adifcolumn, $dbvalue) {
|
||||
if ($dbvalue != "") {
|
||||
return "<" . $adifcolumn . ":" . strlen($dbvalue) . ">" . $dbvalue;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_qrz_upload_realtime_option extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'qrzrealtime bool DEFAULT TRUE',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('station_profile', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('station_profile', 'qrzrealtime');
|
||||
}
|
||||
}
|
|
@ -122,6 +122,8 @@ class Logbook_model extends CI_Model {
|
|||
'COL_CQZ' => $cqz,
|
||||
'COL_STATE' => trim($this->input->post('usa_state')),
|
||||
'COL_SOTA_REF' => trim($this->input->post('sota_ref')),
|
||||
'COL_SIG' => trim($this->input->post('sig')),
|
||||
'COL_SIG_INFO' => trim($this->input->post('sig_info')),
|
||||
'COL_DARC_DOK' => trim($this->input->post('darc_dok')),
|
||||
'COL_NOTES' => $this->input->post('notes'),
|
||||
);
|
||||
|
@ -336,15 +338,19 @@ class Logbook_model extends CI_Model {
|
|||
$data['COL_RX_PWR'] = str_replace("W", "", $data['COL_RX_PWR']);
|
||||
}
|
||||
|
||||
$result = $this->exists_qrz_api_key($data['station_id']);
|
||||
|
||||
// Push qso to qrz if apikey is set
|
||||
if ($apikey = $this->exists_qrz_api_key($data['station_id'])) {
|
||||
$adif = $this->create_adif_from_data($data);
|
||||
$result = $this->push_qso_to_qrz($apikey, $adif);
|
||||
IF ($result['status'] == 'OK') {
|
||||
$data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y';
|
||||
$data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now"));
|
||||
if ($result) {
|
||||
if ($result->qrzrealtime == 1) {
|
||||
$adif = $this->create_adif_from_data($data);
|
||||
$result = $this->push_qso_to_qrz($result->qrzapikey, $adif);
|
||||
IF ($result['status'] == 'OK') {
|
||||
$data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y';
|
||||
$data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add QSO to database
|
||||
$this->db->insert($this->config->item('table_name'), $data);
|
||||
|
@ -354,7 +360,7 @@ class Logbook_model extends CI_Model {
|
|||
* Function checks if a QRZ API Key exists in the table with the given station id
|
||||
*/
|
||||
function exists_qrz_api_key($station_id) {
|
||||
$sql = 'select qrzapikey from station_profile
|
||||
$sql = 'select qrzapikey, qrzrealtime from station_profile
|
||||
where station_id = ' . $station_id;
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
@ -362,7 +368,7 @@ class Logbook_model extends CI_Model {
|
|||
$result = $query->row();
|
||||
|
||||
if ($result) {
|
||||
return $result->qrzapikey;
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
@ -602,6 +608,8 @@ class Logbook_model extends CI_Model {
|
|||
'COL_IOTA' => $this->input->post('iota_ref'),
|
||||
'COL_SOTA_REF' => $this->input->post('sota_ref'),
|
||||
'COL_TX_PWR' => $this->input->post('transmit_power'),
|
||||
'COL_SIG' => $this->input->post('sig'),
|
||||
'COL_SIG_INFO' => $this->input->post('sig_info'),
|
||||
'COL_DARC_DOK' => $this->input->post('darc_dok'),
|
||||
'COL_QTH' => $this->input->post('qth'),
|
||||
'COL_PROP_MODE' => $this->input->post('prop_mode'),
|
||||
|
|
|
@ -53,6 +53,7 @@ class Stations extends CI_Model {
|
|||
'state' => xss_clean($this->input->post('station_state', true)),
|
||||
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
|
||||
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
|
||||
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
|
||||
);
|
||||
|
||||
// Insert Records
|
||||
|
@ -77,6 +78,7 @@ class Stations extends CI_Model {
|
|||
'state' => xss_clean($this->input->post('station_state', true)),
|
||||
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
|
||||
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
|
||||
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
|
||||
);
|
||||
|
||||
$this->db->where('station_id', xss_clean($this->input->post('station_id', true)));
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,15 +7,14 @@
|
|||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->session->userdata('user_stylesheet');?>">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/fontawesome/css/all.css">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
|
||||
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery.fancybox.min.css" />
|
||||
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css">
|
||||
|
||||
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/popper.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/jquery.fancybox.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="container-fluid qso-edit-box">
|
||||
|
@ -342,7 +341,17 @@
|
|||
<div class="form-group">
|
||||
<label for="sota_ref">SOTA</label>
|
||||
<input type="text" class="form-control" id="sota_ref" name="sota_ref" value="<?php echo $qso->COL_SOTA_REF; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig">Sig</label>
|
||||
<input type="text" class="form-control" id="sig" name="sig" value="<?php echo $qso->COL_SIG; ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig_info">Sig Info</label>
|
||||
<input type="text" class="form-control" id="sig_info" name="sig_info" value="<?php echo $qso->COL_SIG_INFO; ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="darc_dok">DOK</label>
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->session->userdata('user_stylesheet');?>">
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/fontawesome/css/all.css">
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
|
||||
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/jquery.fancybox.min.css" />
|
||||
|
||||
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css">
|
||||
|
||||
<script src="<?php echo base_url(); ?>assets/js/jquery-3.3.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/popper.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/jquery.fancybox.min.js"></script>
|
||||
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
|
||||
|
||||
</head>
|
||||
|
@ -387,6 +387,16 @@
|
|||
<input type="text" class="form-control" id="sota_ref" name="sota_ref" value="<?php echo $qso->COL_SOTA_REF; ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig">Sig</label>
|
||||
<input type="text" class="form-control" id="sig" name="sig" value="<?php echo $qso->COL_SIG; ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig_info">Sig Info</label>
|
||||
<input type="text" class="form-control" id="sig_info" name="sig_info" value="<?php echo $qso->COL_SIG_INFO; ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="darc_dok">DOK</label>
|
||||
<input type="text" class="form-control" id="darc_dok" name="darc_dok" value="<?php echo $qso->COL_DARC_DOK; ?>">
|
||||
|
|
|
@ -328,6 +328,18 @@
|
|||
<small id="sotaRefHelp" class="form-text text-muted">For example: GM/NS-001</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig">Sig</label>
|
||||
<input class="form-control" id="sig" type="text" name="sig" value="" />
|
||||
<small id="sigHelp" class="form-text text-muted">For example: WWFF or POTA</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sig_info">Sig Info</label>
|
||||
<input class="form-control" id="sig_info" type="text" name="sig_info" value="" />
|
||||
<small id="sigInfoHelp" class="form-text text-muted">For example: DLFF-0029</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="sota_ref">DOK</label>
|
||||
<input class="form-control" id="darc_dok" type="text" name="darc_dok" value="" />
|
||||
|
|
|
@ -200,10 +200,19 @@
|
|||
<small id="eqslhelp" class="form-text text-muted">eQSL QTH Nickname.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qrzApiKey">QRZ.com Logbook API Key</label>
|
||||
<input type="text" class="form-control" name="qrzapikey" id="qrzApiKey" aria-describedby="qrzApiKeyHelp">
|
||||
<small id="qrzApiKeyHelp" class="form-text text-muted">Find your API key on <a href="https://logbook.qrz.com/logbook" target="_blank">QRZ.com's settings page</a></small>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="qrzApiKey">QRZ.com Logbook API Key</label>
|
||||
<input type="text" class="form-control" name="qrzapikey" id="qrzApiKey" aria-describedby="qrzApiKeyHelp">
|
||||
<small id="qrzApiKeyHelp" class="form-text text-muted">Find your API key on <a href="https://logbook.qrz.com/logbook" target="_blank">QRZ.com's settings page</a></small>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="qrzrealtime">QRZ.com Logbook Realtime Upload</label>
|
||||
<select class="custom-select" id="qrzrealtime" name="qrzrealtime">
|
||||
<option value="1" selected>Yes</option>
|
||||
<option value="0">No</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create Station Profile</button>
|
||||
|
|
|
@ -222,11 +222,20 @@
|
|||
<small id="eqslhelp" class="form-text text-muted">eQSL QTH Nickname.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="qrzApiKey">QRZ.com Logbook API Key</label>
|
||||
<input type="text" class="form-control" name="qrzapikey" id="qrzApiKey" aria-describedby="qrzApiKeyHelp" value="<?php if(set_value('qrzapikey') != "") { echo set_value('qrzapikey'); } else { echo $my_station_profile->qrzapikey; } ?>">
|
||||
<small id="qrzApiKeyHelp" class="form-text text-muted">Find your API key on <a href="https://logbook.qrz.com/logbook" target="_blank">QRZ.com's settings page</a></small>
|
||||
</div>
|
||||
<div class="form-group col-sm-6">
|
||||
<label for="qrzrealtime">QRZ.com Logbook Realtime Upload</label>
|
||||
<select class="custom-select" id="qrzrealtime" name="qrzrealtime">
|
||||
<option value="1" <?php if ($my_station_profile->qrzrealtime == 1) { echo " selected =\"selected\""; } ?>>Yes</option>
|
||||
<option value="0" <?php if ($my_station_profile->qrzrealtime == 0) { echo " selected =\"selected\""; } ?>>No</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update Station Profile</button>
|
||||
|
||||
|
|
|
@ -192,6 +192,20 @@
|
|||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($row->COL_SIG != null) { ?>
|
||||
<tr>
|
||||
<td>Sig:</td>
|
||||
<td><?php echo $row->COL_SIG; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($row->COL_SIG_INFO != null) { ?>
|
||||
<tr>
|
||||
<td>Sig Info:</td>
|
||||
<td><?php echo $row->COL_SIG_INFO; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($row->COL_DARC_DOK != null) { ?>
|
||||
<tr>
|
||||
<td>DOK:</td>
|
||||
|
|
Ładowanie…
Reference in New Issue