kopia lustrzana https://github.com/magicbug/Cloudlog
Option tu upload SAT status info to amsat.org/status
rodzic
ffc959ed57
commit
995e89e444
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 112;
|
||||
$config['migration_version'] = 113;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -81,6 +81,7 @@ class User extends CI_Controller {
|
|||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
|
||||
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
|
||||
$data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload');
|
||||
$this->load->view('user/add', $data);
|
||||
} else {
|
||||
$this->load->view('user/add', $data);
|
||||
|
@ -111,7 +112,8 @@ class User extends CI_Controller {
|
|||
$this->input->post('user_column4'),
|
||||
$this->input->post('user_column5'),
|
||||
$this->input->post('user_show_profile_image'),
|
||||
$this->input->post('user_previous_qsl_type'))) {
|
||||
$this->input->post('user_previous_qsl_type'),
|
||||
$this->input->post('user_amsat_status_upload'))) {
|
||||
// Check for errors
|
||||
case EUSERNAMEEXISTS:
|
||||
$data['username_error'] = 'Username <b>'.$this->input->post('user_name').'</b> already in use!';
|
||||
|
@ -152,6 +154,7 @@ class User extends CI_Controller {
|
|||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
|
||||
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
|
||||
$data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload');
|
||||
$this->load->view('user/add', $data);
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
@ -347,6 +350,12 @@ class User extends CI_Controller {
|
|||
$data['user_previous_qsl_type'] = $q->user_previous_qsl_type;
|
||||
}
|
||||
|
||||
if($this->input->post('user_amsat_status_upload')) {
|
||||
$data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload', false);
|
||||
} else {
|
||||
$data['user_amsat_status_upload'] = $q->user_amsat_status_upload;
|
||||
}
|
||||
|
||||
if($this->input->post('user_column1')) {
|
||||
$data['user_column1'] = $this->input->post('user_column1', true);
|
||||
} else {
|
||||
|
@ -430,6 +439,7 @@ class User extends CI_Controller {
|
|||
$data['user_column5'] = $this->input->post('user_column5');
|
||||
$data['user_show_profile_image'] = $this->input->post('user_show_profile_image');
|
||||
$data['user_previous_qsl_type'] = $this->input->post('user_previous_qsl_type');
|
||||
$data['user_amsat_status_upload'] = $this->input->post('user_amsat_status_upload');
|
||||
$this->load->view('user/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
|
|
@ -478,6 +478,10 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
$last_id = $this->db->insert_id();
|
||||
|
||||
if ($this->session->userdata('user_amsat_status_upload') && $data['COL_PROP_MODE'] == "SAT") {
|
||||
$this->upload_amsat_status($data);
|
||||
}
|
||||
|
||||
// No point in fetching qrz api key and qrzrealtime setting if we're skipping the export
|
||||
if (!$skipexport) {
|
||||
|
||||
|
@ -576,6 +580,48 @@ class Logbook_model extends CI_Model {
|
|||
return true;
|
||||
}
|
||||
|
||||
function upload_amsat_status($data) {
|
||||
$sat_name = '';
|
||||
if ($data['COL_SAT_NAME'] == 'AO-7') {
|
||||
if ($data['COL_BAND'] == '2m' && $data['COL_BAND_RX'] == '10m') {
|
||||
$sat_name = '[A]_AO-7';
|
||||
}
|
||||
if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') {
|
||||
$sat_name = '[B]_AO-7';
|
||||
}
|
||||
} else if ($data['COL_SAT_NAME'] == 'QO-100') {
|
||||
$sat_name = 'QO-100_NB';
|
||||
} else if ($data['COL_SAT_NAME'] == 'AO-92') {
|
||||
if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') {
|
||||
$sat_name = 'AO-92_U/v';
|
||||
}
|
||||
if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') {
|
||||
$sat_name = 'AO-92_L/v';
|
||||
}
|
||||
} else if ($data['COL_SAT_NAME'] == 'AO-95') {
|
||||
if ($data['COL_BAND'] == '70cm' && $data['COL_BAND_RX'] == '2m') {
|
||||
$sat_name = 'AO-95_U/v';
|
||||
}
|
||||
if ($data['COL_BAND'] == '23cm' && $data['COL_BAND_RX'] == '2m') {
|
||||
$sat_name = 'AO-95_L/v';
|
||||
}
|
||||
} else if ($data['COL_SAT_NAME'] == 'PO-101') {
|
||||
if ($data['COL_MODE'] == 'PACKET') {
|
||||
$sat_name = 'PO-101[APRS]';
|
||||
} else {
|
||||
$sat_name = 'PO-101[FM]';
|
||||
}
|
||||
}
|
||||
if ($sat_name != '') {
|
||||
$datearray = date_parse_from_format("Y-m-d H:i:s", $data['COL_TIME_ON']);
|
||||
$url='https://amsat.org/status/submit.php?SatSubmit=yes&Confirm=yes&SatName='.$sat_name.'&SatYear='.$datearray['year'].'&SatMonth='.str_pad($datearray['month'], 2, '0', STR_PAD_LEFT).'&SatDay='.str_pad($datearray['day'], 2, '0', STR_PAD_LEFT).'&SatHour='.str_pad($datearray['hour'], 2, '0', STR_PAD_LEFT).'&SatPeriod='.(intdiv(($datearray['minute']-1), 15)).'&SatCall='.$data['COL_STATION_CALLSIGN'].'&SatReport=Heard&SatGridSquare='.$data['COL_MY_GRIDSQUARE'];
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_exec($ch);
|
||||
}
|
||||
}
|
||||
|
||||
/* Edit QSO */
|
||||
function edit() {
|
||||
$qso = $this->get_qso($this->input->post('id'))->row();
|
||||
|
|
|
@ -122,7 +122,7 @@ class User_Model extends CI_Model {
|
|||
function add($username, $password, $email, $type, $firstname, $lastname, $callsign, $locator, $timezone,
|
||||
$measurement, $user_date_format, $user_stylesheet, $user_qth_lookup, $user_sota_lookup, $user_wwff_lookup,
|
||||
$user_show_notes, $user_column1, $user_column2, $user_column3, $user_column4, $user_column5,
|
||||
$user_show_profile_image, $user_previous_qsl_type) {
|
||||
$user_show_profile_image, $user_previous_qsl_type, $user_amsat_status_upload) {
|
||||
// Check that the user isn't already used
|
||||
if(!$this->exists($username)) {
|
||||
$data = array(
|
||||
|
@ -149,6 +149,7 @@ class User_Model extends CI_Model {
|
|||
'user_column5' => xss_clean($user_column5),
|
||||
'user_show_profile_image' => xss_clean($user_show_profile_image),
|
||||
'user_previous_qsl_type' => xss_clean($user_previous_qsl_type),
|
||||
'user_amsat_status_upload' => xss_clean($user_amsat_status_upload),
|
||||
);
|
||||
|
||||
// Check the password is valid
|
||||
|
@ -203,6 +204,7 @@ class User_Model extends CI_Model {
|
|||
'user_column5' => xss_clean($fields['user_column5']),
|
||||
'user_show_profile_image' => xss_clean($fields['user_show_profile_image']),
|
||||
'user_previous_qsl_type' => xss_clean($fields['user_previous_qsl_type']),
|
||||
'user_amsat_status_upload' => xss_clean($fields['user_amsat_status_upload']),
|
||||
);
|
||||
|
||||
// Check to see if the user is allowed to change user levels
|
||||
|
@ -321,6 +323,7 @@ class User_Model extends CI_Model {
|
|||
'user_column4' => isset($u->row()->user_column4) ? $u->row()->user_column4: 'Band',
|
||||
'user_column5' => isset($u->row()->user_column5) ? $u->row()->user_column5: 'Country',
|
||||
'user_previous_qsl_type' => isset($u->row()->user_previous_qsl_type) ? $u->row()->user_previous_qsl_type: 0,
|
||||
'user_amsat_status_upload' => isset($u->row()->user_amsat_status_upload) ? $u->row()->user_amsat_status_upload: 0,
|
||||
'active_station_logbook' => $u->row()->active_station_logbook,
|
||||
);
|
||||
|
||||
|
|
|
@ -479,6 +479,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
AMSAT Status Upload
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amsatstatusupload">Upload status of SAT QSOs to <a href="https://www.amsat.org/status/" target="_blank">https://www.amsat.org/status/</a>.</label>
|
||||
<select class="custom-select" id="amsatstatusupload" name="user_amsat_status_upload">
|
||||
<option value="0"><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||
<option value="1"><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
<br />
|
||||
|
@ -486,4 +506,4 @@
|
|||
<br />
|
||||
<br />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -478,6 +478,27 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
AMSAT Status Upload
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="amsatsatatusupload">Upload status of SAT QSOs to <a href="https://www.amsat.org/status/" target="_blank">https://www.amsat.org/status/</a>.</label>
|
||||
<select class="custom-select" id="amsatstatusupload" name="user_amsat_status_upload">
|
||||
<option value="1" <?php if ($user_amsat_status_upload == 1) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_yes'); ?></option>
|
||||
<option value="0" <?php if ($user_amsat_status_upload == 0) { echo " selected =\"selected\""; } ?>><?php echo $this->lang->line('general_word_no'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="<?php echo $this->uri->segment(3); ?>" />
|
||||
<br>
|
||||
|
|
Ładowanie…
Reference in New Issue