[QRZ Logbook] option for realtime logging added

这个提交包含在:
Andreas 2020-11-18 11:50:15 +01:00
父节点 388bfb848a
当前提交 e149d34ba1
共有 6 个文件被更改,包括 59 次插入15 次删除

查看文件

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to. | be upgraded / downgraded to.
| |
*/ */
$config['migration_version'] = 55; $config['migration_version'] = 56;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

查看文件

@ -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');
}
}

查看文件

@ -336,15 +336,19 @@ class Logbook_model extends CI_Model {
$data['COL_RX_PWR'] = str_replace("W", "", $data['COL_RX_PWR']); $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 // Push qso to qrz if apikey is set
if ($apikey = $this->exists_qrz_api_key($data['station_id'])) { if ($result) {
if ($result->qrzrealtime == 1) {
$adif = $this->create_adif_from_data($data); $adif = $this->create_adif_from_data($data);
$result = $this->push_qso_to_qrz($apikey, $adif); $result = $this->push_qso_to_qrz($result->qrzapikey, $adif);
IF ($result['status'] == 'OK') { IF ($result['status'] == 'OK') {
$data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y'; $data['COL_QRZCOM_QSO_UPLOAD_STATUS'] = 'Y';
$data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now")); $data['COL_QRZCOM_QSO_UPLOAD_DATE'] = date("Y-m-d H:i:s", strtotime("now"));
} }
} }
}
// Add QSO to database // Add QSO to database
$this->db->insert($this->config->item('table_name'), $data); $this->db->insert($this->config->item('table_name'), $data);
@ -354,7 +358,7 @@ class Logbook_model extends CI_Model {
* Function checks if a QRZ API Key exists in the table with the given station id * Function checks if a QRZ API Key exists in the table with the given station id
*/ */
function exists_qrz_api_key($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; where station_id = ' . $station_id;
$query = $this->db->query($sql); $query = $this->db->query($sql);
@ -362,7 +366,7 @@ class Logbook_model extends CI_Model {
$result = $query->row(); $result = $query->row();
if ($result) { if ($result) {
return $result->qrzapikey; return $result;
} }
else { else {
return false; return false;

查看文件

@ -53,6 +53,7 @@ class Stations extends CI_Model {
'state' => xss_clean($this->input->post('station_state', true)), 'state' => xss_clean($this->input->post('station_state', true)),
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
); );
// Insert Records // Insert Records
@ -77,6 +78,7 @@ class Stations extends CI_Model {
'state' => xss_clean($this->input->post('station_state', true)), 'state' => xss_clean($this->input->post('station_state', true)),
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
'qrzapikey' => xss_clean($this->input->post('qrzapikey', 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))); $this->db->where('station_id', xss_clean($this->input->post('station_id', true)));

查看文件

@ -200,11 +200,20 @@
<small id="eqslhelp" class="form-text text-muted">eQSL QTH Nickname.</small> <small id="eqslhelp" class="form-text text-muted">eQSL QTH Nickname.</small>
</div> </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> <label for="qrzApiKey">QRZ.com Logbook API Key</label>
<input type="text" class="form-control" name="qrzapikey" id="qrzApiKey" aria-describedby="qrzApiKeyHelp"> <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> <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>
<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>True</option>
<option value="0">False</option>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create Station Profile</button> <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> <small id="eqslhelp" class="form-text text-muted">eQSL QTH Nickname.</small>
</div> </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> <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; } ?>"> <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> <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>
<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\""; } ?>>True</option>
<option value="0" <?php if ($my_station_profile->qrzrealtime == 0) { echo " selected =\"selected\""; } ?>>False</option>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update Station Profile</button> <button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update Station Profile</button>