diff --git a/application/config/migration.php b/application/config/migration.php index 4b5f4a0c..34ac340c 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'] = 15; +$config['migration_version'] = 16; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 2e7c2a56..86b806b9 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -294,4 +294,38 @@ class Lotw extends CI_Controller { } } + /* + Load the ARRL LOTW User Activity CSV into LOTW User Table for cross checking when logging + */ + function load_users() { + set_time_limit(0); + $this->load->model('lotw_user'); + + $row = 1; + if (($handle = fopen("https://lotw.arrl.org/lotw-user-activity.csv", "r")) !== FALSE) { + while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { + $num = count($data); + $row++; + + if(isset($data[2])) { + $callsign = $data[0]; + $upload_date = $data[1]." ".$data[2]; + $this->lotw_user->add_lotwuser($callsign, $upload_date); + } + + } + fclose($handle); + } + + } + + /* + Check if callsign is an active LOTW user and return whether its true or not + */ + function lotw_usercheck($callsign) { + $this->load->model('lotw_user'); + + + } + } // end class diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index da15d933..5cad61ac 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -109,27 +109,18 @@ class QSO extends CI_Controller { } } - function qsl_rcvd() { - + function qsl_rcvd($id, $method) { $this->load->model('logbook_model'); $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } - $query = $this->logbook_model->qso_info($this->uri->segment(3)); - - $this->load->library('form_validation'); - $this->form_validation->set_rules('id', 'ID', 'required'); - $data = $query->row(); - if ($this->form_validation->run() == FALSE) - { - $this->load->view('qso/qsl_rcvd', $data); - } - else - { - $this->logbook_model->qsl_rcvd(); - $this->session->set_flashdata('notice', 'QSL registered'); - $this->load->view('qso/qsl_rcvd_done'); - } + // Update Logbook to Mark Paper Card Received + + $this->logbook_model->paperqsl_update($id, $method); + + $this->session->set_flashdata('notice', 'QSL Card: Marked as Received'); + + redirect('logbook'); } /* Delete QSO */ diff --git a/application/migrations/016_lotwusers.php b/application/migrations/016_lotwusers.php new file mode 100644 index 00000000..59f99104 --- /dev/null +++ b/application/migrations/016_lotwusers.php @@ -0,0 +1,33 @@ +dbforge->add_field(array( + 'id' => array( + 'type' => 'INT', + 'constraint' => 5, + 'unsigned' => TRUE, + 'auto_increment' => TRUE + ), + 'callsign' => array( + 'type' => 'VARCHAR', + 'constraint' => '100', + ), + 'upload_date' => array( + 'type' => 'datetime', + 'null' => TRUE, + ), + )); + $this->dbforge->add_key('id', TRUE); + $this->dbforge->create_table('lotw_userlist'); + } + + public function down() + { + $this->dbforge->drop_table('lotw_userlist'); + } +} \ No newline at end of file diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 7e986afc..a3e48686 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -399,6 +399,20 @@ class Logbook_model extends CI_Model { } + // Set Paper to recived + function paperqsl_update($qso_id, $method) { + $data = array( + 'COL_QSLRDATE' => date('Y-m-d'), + 'COL_QSL_RCVD' => 'Y', + 'COL_QSL_RCVD_VIA' => $method + ); + + $this->db->where('COL_PRIMARY_KEY', $qso_id); + + $this->db->update($this->config->item('table_name'), $data); + } + + function get_qsos($num, $offset) { $this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE, COL_QSL_RCVD, COL_EQSL_QSL_RCVD, COL_EQSL_QSL_SENT, COL_QSL_SENT, COL_STX_STRING, COL_SRX_STRING, COL_OPERATOR, COL_STATION_CALLSIGN, COL_LOTW_QSL_SENT, COL_LOTW_QSL_RCVD'); $this->db->order_by("COL_TIME_ON", "desc"); diff --git a/application/models/Lotw_user.php b/application/models/Lotw_user.php new file mode 100644 index 00000000..66be9158 --- /dev/null +++ b/application/models/Lotw_user.php @@ -0,0 +1,28 @@ +db->empty_table($table); + } + + function add_lotwuser($callsign, $date) { + + $data = array( + 'callsign' => $callsign, + 'upload_date' => $date + ); + + + + $this->db->insert('lotw_userlist', $data); + } +} +?> \ No newline at end of file diff --git a/application/views/view_log/index.php b/application/views/view_log/index.php index 06e046c3..423f8ac6 100644 --- a/application/views/view_log/index.php +++ b/application/views/view_log/index.php @@ -3,6 +3,13 @@