diff --git a/application/config/migration.php b/application/config/migration.php
index da1ea557..679b8daf 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
-$config['migration_version'] = 112;
+$config['migration_version'] = 113;
/*
|--------------------------------------------------------------------------
diff --git a/application/controllers/User.php b/application/controllers/User.php
index c323bdb9..fecca221 100644
--- a/application/controllers/User.php
+++ b/application/controllers/User.php
@@ -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 '.$this->input->post('user_name').' 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');
}
diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php
index 6c7aa411..acbbc091 100755
--- a/application/models/Logbook_model.php
+++ b/application/models/Logbook_model.php
@@ -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();
diff --git a/application/models/User_model.php b/application/models/User_model.php
index 801ab136..c4a24fb5 100644
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -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,
);
diff --git a/application/views/user/add.php b/application/views/user/add.php
index 4451effd..0ae5ce78 100644
--- a/application/views/user/add.php
+++ b/application/views/user/add.php
@@ -479,6 +479,26 @@
+
+