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/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/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