Added code to import lotw-useractivity.csv for displaying if users on lotw

The csv can be imported by using /index.php/lotw/load_users need to impliment frontend next
This commit is contained in:
Peter Goodhall
2019-06-16 14:31:23 +01:00
parent ec5c356cc0
commit 6cfbf774cb
4 changed files with 96 additions and 1 deletions

View File

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