kopia lustrzana https://github.com/magicbug/Cloudlog
You can now select station profile for ADIF file when importing
rodzic
74fec04b6b
commit
c124a0200c
|
@ -95,6 +95,8 @@ class adif extends CI_Controller {
|
|||
}
|
||||
|
||||
public function index() {
|
||||
$this->load->model('stations');
|
||||
$data['station_profile'] = $this->stations->all();
|
||||
$data['page_title'] = "ADIF Import";
|
||||
$data['max_upload'] = ini_get('upload_max_filesize');
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
|
@ -103,6 +105,8 @@ class adif extends CI_Controller {
|
|||
}
|
||||
|
||||
public function import() {
|
||||
$this->load->model('stations');
|
||||
$data['station_profile'] = $this->stations->all();
|
||||
|
||||
$data['page_title'] = "ADIF Import";
|
||||
|
||||
|
@ -145,7 +149,7 @@ class adif extends CI_Controller {
|
|||
};
|
||||
|
||||
|
||||
$this->logbook_model->import($record);
|
||||
$this->logbook_model->import($record, $this->input->post('station_profile'));
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -917,10 +917,11 @@ class Logbook_model extends CI_Model {
|
|||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function import($record) {
|
||||
function import($record, $station_id = "0") {
|
||||
$CI =& get_instance();
|
||||
$CI->load->library('frequency');
|
||||
|
||||
|
||||
// Join date+time
|
||||
|
||||
$time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));
|
||||
|
@ -1197,6 +1198,33 @@ class Logbook_model extends CI_Model {
|
|||
'COL_WEB' => (!empty($record['web'])) ? $record['web'] : ''
|
||||
);
|
||||
|
||||
if($station_id != "0") {
|
||||
$station_result = $this->db->where('station_id', $station_id)
|
||||
->get('station_profile');
|
||||
|
||||
|
||||
if ($station_result->num_rows() > 0){
|
||||
$row = $station_result->row_array();
|
||||
|
||||
if (strpos(trim($row['station_gridsquare']), ',') !== false) {
|
||||
$data['COL_MY_VUCC_GRIDS'] = strtoupper(trim($row['station_gridsquare']));
|
||||
} else {
|
||||
$data['COL_MY_GRIDSQUARE'] = strtoupper(trim($row['station_gridsquare']));
|
||||
}
|
||||
|
||||
$data['COL_MY_CITY'] = strtoupper(trim($row['station_city']));
|
||||
$data['COL_MY_IOTA'] = strtoupper(trim($row['station_iota']));
|
||||
$data['COL_MY_SOTA_REF'] = strtoupper(trim($row['station_sota']));
|
||||
|
||||
$data['COL_STATION_CALLSIGN'] = strtoupper(trim($row['station_callsign']));
|
||||
$data['COL_MY_DXCC'] = strtoupper(trim($row['station_dxcc']));
|
||||
$data['COL_MY_COUNTRY'] = strtoupper(trim($row['station_country']));
|
||||
$data['COL_MY_CNTY'] = strtoupper(trim($row['station_cnty']));
|
||||
$data['COL_MY_CQ_ZONE'] = strtoupper(trim($row['station_cq']));
|
||||
$data['COL_MY_ITU_ZONE'] = strtoupper(trim($row['station_itu']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->add_qso($data);
|
||||
|
||||
|
|
|
@ -12,6 +12,11 @@ class Stations extends CI_Model {
|
|||
return $this->db->get('station_profile');
|
||||
}
|
||||
|
||||
function profile($id) {
|
||||
$this->db->where('station_id', $id);
|
||||
return $this->db->get('station_profile');
|
||||
}
|
||||
|
||||
|
||||
function add() {
|
||||
$data = array(
|
||||
|
|
|
@ -19,7 +19,13 @@
|
|||
|
||||
<p><span class="label important">Important</span> Log files must have the file type .adi</p>
|
||||
|
||||
<form class="form-inline" action="<?php echo site_url('adif/import'); ?>" method="post" enctype="multipart/form-data">
|
||||
<form class="form" action="<?php echo site_url('adif/import'); ?>" method="post" enctype="multipart/form-data">
|
||||
<select name="station_profile" class="custom-select mb-2 mr-sm-2" style="width: 20%;">
|
||||
<option value="0">Select Station Profile</option>
|
||||
<?php foreach ($station_profile->result() as $station) { ?>
|
||||
<option value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<label class="sr-only" for="inlineFormInputName2">ADIF file</label>
|
||||
<input class="file-input mb-2 mr-sm-2" type="file" name="userfile" size="20" />
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue