diff --git a/.gitignore b/.gitignore index 27c58390c..01d66723d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /application/config/config.php /application/logs/*.php /application/cache/* +/uploads /uploads/*.adi /uploads/*.ADI /uploads/*.tq8 diff --git a/application/config/migration.php b/application/config/migration.php index 6e6072fac..ed733d726 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 188; +$config['migration_version'] = 191; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index dcdcaafbc..a9c0efc4c 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -139,6 +139,9 @@ class adif extends CI_Controller { } public function index() { + $this->load->model('contesting_model'); + $data['contests']=$this->contesting_model->getActivecontests(); + $this->load->model('stations'); $data['page_title'] = "ADIF Import / Export"; @@ -183,6 +186,7 @@ class adif extends CI_Controller { $this->load->view('interface_assets/footer'); } else { if ($this->stations->check_station_is_accessible($this->input->post('station_profile'))) { + $contest=$this->security->xss_clean($this->input->post('contest')) ?? ''; $stopnow=false; $fdata = array('upload_data' => $this->upload->data()); ini_set('memory_limit', '-1'); @@ -222,6 +226,9 @@ class adif extends CI_Controller { $alladif=[]; while($record = $this->adif_parser->get_record()) { + if ($contest != '') { + $record['contest_id']=$contest; + } if(count($record) == 0) { break; }; diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 8c131512f..e3a4e14d4 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -373,10 +373,12 @@ class Awards extends CI_Controller { $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); + $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); + $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); $type = $this->security->xss_clean($this->input->post('Type')); $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); - $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmode); + $data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl, $sat, $orbit, $searchmode); // This is done because we have two different ways to get dxcc info in Wavelog. Once is using the name (in awards), and the other one is using the ADIF DXCC. // We replace the values to make it look a bit nicer @@ -402,7 +404,18 @@ class Awards extends CI_Controller { // Render Page $data['page_title'] = "Log View - " . $type; - $data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode; + $data['filter'] = $type." ".$searchphrase." and band ".$band; + if ($band == 'SAT') { + if ($sat != 'All' && $sat != null) { + $data['filter'] .= " and sat ".$sat; + } + if ($orbit != 'All' && $orbit != null) { + $data['filter'] .= " and orbit type ".$orbit; + } + } + if ($mode != null && strtolower($mode) != 'all') { + $data['filter'] .= " and mode ".$mode; + } if (!empty($qsltype)) { $data['filter'] .= " and ".implode('/', $qsltype); } diff --git a/application/controllers/Bandmap.php b/application/controllers/Bandmap.php index 2e1ab3590..f93d658d6 100644 --- a/application/controllers/Bandmap.php +++ b/application/controllers/Bandmap.php @@ -44,14 +44,13 @@ class Bandmap extends CI_Controller { 'assets/js/sections/bandmap_list.js' ]; - $CI =& get_instance(); // Get Date format - if($CI->session->userdata('user_date_format')) { + if($this->session->userdata('user_date_format')) { // If Logged in and session exists - $pageData['custom_date_format'] = $CI->session->userdata('user_date_format'); + $pageData['custom_date_format'] = $this->session->userdata('user_date_format'); } else { // Get Default date format from /config/wavelog.php - $pageData['custom_date_format'] = $CI->config->item('qso_date_format'); + $pageData['custom_date_format'] = $this->config->item('qso_date_format'); } switch ($pageData['custom_date_format']) { diff --git a/application/controllers/Debug.php b/application/controllers/Debug.php index 0b341f016..229e0306f 100644 --- a/application/controllers/Debug.php +++ b/application/controllers/Debug.php @@ -2,176 +2,207 @@ class Debug extends CI_Controller { - function __construct() - { - parent::__construct(); + function __construct() { + parent::__construct(); - $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'); - } + $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'); + } - $this->load->library('Permissions'); - } + $this->load->library('Permissions'); + } - /* User Facing Links to Backup URLs */ - public function index() - { - $this->load->helper('file'); + /* User Facing Links to Backup URLs */ + public function index() { + $this->load->helper('file'); - $this->load->model('MigrationVersion'); - $this->load->model('Logbook_model'); - $this->load->model('Stations'); + $this->load->model('MigrationVersion'); + $this->load->model('Logbook_model'); + $this->load->model('Stations'); - $footerData = []; - $footerData['scripts'] = ['assets/js/sections/debug.js']; + $footerData = []; + $footerData['scripts'] = ['assets/js/sections/debug.js']; - $data['stations'] = $this->Stations->all(); + $data['stations'] = $this->Stations->all(); - $data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id(); - if ($data['qsos_with_no_station_id']) { - $data['calls_wo_sid'] = $this->Logbook_model->calls_without_station_id(); - } + $data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id(); + if ($data['qsos_with_no_station_id']) { + $data['calls_wo_sid'] = $this->Logbook_model->calls_without_station_id(); + } - $data['migration_version'] = $this->MigrationVersion->getMigrationVersion(); + $data['migration_version'] = $this->MigrationVersion->getMigrationVersion(); - // Test writing to backup folder - $backup_folder = $this->permissions->is_really_writable('backup'); - $data['backup_folder'] = $backup_folder; + // Test writing to backup folder + $backup_folder = $this->permissions->is_really_writable('backup'); + $data['backup_folder'] = $backup_folder; - // Test writing to updates folder - $updates_folder = $this->permissions->is_really_writable('updates'); - $data['updates_folder'] = $updates_folder; + // Test writing to updates folder + $updates_folder = $this->permissions->is_really_writable('updates'); + $data['updates_folder'] = $updates_folder; - // Test writing to uploads folder - $uploads_folder = $this->permissions->is_really_writable('uploads'); - $data['uploads_folder'] = $uploads_folder; + // Test writing to uploads folder + $uploads_folder = $this->permissions->is_really_writable('uploads'); + $data['uploads_folder'] = $uploads_folder; - // Check if userdata config is enabled - $userdata_enabled = $this->config->item('userdata'); - $data['userdata_enabled'] = $userdata_enabled; + // Check if userdata config is enabled + $userdata_enabled = $this->config->item('userdata'); + $data['userdata_enabled'] = $userdata_enabled; - if (isset($userdata_enabled)) { - // Test writing to userdata folder if option is enabled - $userdata_folder = $this->permissions->is_really_writable('userdata'); - $data['userdata_folder'] = $userdata_folder; + if (isset($userdata_enabled)) { + // Test writing to userdata folder if option is enabled + $userdata_folder = $this->permissions->is_really_writable('userdata'); + $data['userdata_folder'] = $userdata_folder; - // run the status check and return the array to the view - $userdata_status = $this->check_userdata_status($userdata_folder); - $data['userdata_status'] = $userdata_status; - } + // run the status check and return the array to the view + $userdata_status = $this->check_userdata_status($userdata_folder); + $data['userdata_status'] = $userdata_status; + } - $data['page_title'] = "Debug"; + $data['page_title'] = "Debug"; - $this->load->view('interface_assets/header', $data); - $this->load->view('debug/index'); - $this->load->view('interface_assets/footer', $footerData); - } + $this->load->view('interface_assets/header', $data); + $this->load->view('debug/index'); + $this->load->view('interface_assets/footer', $footerData); + } - function check_userdata_status($userdata_folder) - { - $this->load->model('debug_model'); - - $status = array(); + function check_userdata_status($userdata_folder) { + $this->load->model('debug_model'); - // Check if the folder is writable - if ($userdata_folder === true) { + $status = array(); - // Check if the qsl and eqsl folders are accessible and if there is any data the user could migrate - $qsl_dir = $this->permissions->is_really_writable('assets/qslcard'); - $eqsl_dir = $this->permissions->is_really_writable('images/eqsl_card_images'); + // Check if the folder is writable + if ($userdata_folder === true) { - $flag_file = $this->debug_model->check_migrated_flag(); + // Check if the qsl and eqsl folders are accessible and if there is any data the user could migrate + $qsl_dir = $this->permissions->is_really_writable('assets/qslcard'); + $eqsl_dir = $this->permissions->is_really_writable('images/eqsl_card_images'); - if ($qsl_dir && $eqsl_dir) { + $flag_file = $this->debug_model->check_migrated_flag(); - // Check for content of the qsl card folder other than *.html files - $qsl_files = glob('assets/qslcard/*'); - $qsl_files_filtered = array_filter($qsl_files, function ($file) { - return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html'; - }); + if ($qsl_dir && $eqsl_dir) { - // Check for content of the eqsl card folder other than *.html files - $eqsl_files = glob('images/eqsl_card_images/*'); - $eqsl_files_filtered = array_filter($eqsl_files, function ($file) { - return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html'; - }); + // Check for content of the qsl card folder other than *.html files + $qsl_files = glob('assets/qslcard/*'); + $qsl_files_filtered = array_filter($qsl_files, function ($file) { + return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html'; + }); - // Set the status info - if (!empty($qsl_files_filtered) || !empty($eqsl_files_filtered)) { - if (!$flag_file) { - $status['btn_class'] = ''; - $status['btn_text'] = 'Migrate data now'; - } else { - $status['btn_class'] = ''; - $status['btn_text'] = 'Migration already done. Run again?'; - } - } else { - $status['btn_class'] = 'disabled'; - $status['btn_text'] = 'No data to migrate'; - } - } else { - $status['btn_class'] = 'disabled'; - $status['btn_text'] = 'No migration possible'; - } - } else { - // If the folder is not writable, we don't need to continue - $status['btn_class'] = 'disabled'; - $status['btn_text'] = 'No migration possible'; - } + // Check for content of the eqsl card folder other than *.html files + $eqsl_files = glob('images/eqsl_card_images/*'); + $eqsl_files_filtered = array_filter($eqsl_files, function ($file) { + return !is_dir($file) && pathinfo($file, PATHINFO_EXTENSION) !== 'html'; + }); - return $status; - } + // Set the status info + if (!empty($qsl_files_filtered) || !empty($eqsl_files_filtered)) { + if (!$flag_file) { + $status['btn_class'] = ''; + $status['btn_text'] = 'Migrate data now'; + } else { + $status['btn_class'] = ''; + $status['btn_text'] = 'Migration already done. Run again?'; + } + } else { + $status['btn_class'] = 'disabled'; + $status['btn_text'] = 'No data to migrate'; + } + } else { + $status['btn_class'] = 'disabled'; + $status['btn_text'] = 'No migration possible'; + } + } else { + // If the folder is not writable, we don't need to continue + $status['btn_class'] = 'disabled'; + $status['btn_text'] = 'No migration possible'; + } - public function reassign() - { - $this->load->model('Logbook_model'); - $this->load->model('Stations'); + return $status; + } - $call = xss_clean(($this->input->post('call'))); - $qsoids = xss_clean(($this->input->post('qsoids'))); - $station_profile_id = xss_clean(($this->input->post('station_id'))); + public function reassign() { + $this->load->model('Logbook_model'); + $this->load->model('Stations'); - log_message('debug', 'station_profile_id:', $station_profile_id); - // Check if target-station-id exists - $allowed = false; - $status = false; - $stations = $this->Stations->all(); - foreach ($stations->result() as $station) { - if ($station->station_id == $station_profile_id) { - $allowed = true; - } - } - if ($allowed) { - $status = $this->Logbook_model->update_station_ids($station_profile_id, $call, $qsoids); - } else { - $status = false; - } + $call = xss_clean(($this->input->post('call'))); + $qsoids = xss_clean(($this->input->post('qsoids'))); + $station_profile_id = xss_clean(($this->input->post('station_id'))); - header('Content-Type: application/json'); - echo json_encode(array('status' => $status)); - return; - } + log_message('debug', 'station_profile_id:', $station_profile_id); + // Check if target-station-id exists + $allowed = false; + $status = false; + $stations = $this->Stations->all(); + foreach ($stations->result() as $station) { + if ($station->station_id == $station_profile_id) { + $allowed = true; + } + } + if ($allowed) { + $status = $this->Logbook_model->update_station_ids($station_profile_id, $call, $qsoids); + } else { + $status = false; + } - public function migrate_userdata() - { - // Check if users logged in - $this->load->model('user_model'); - if ($this->user_model->validate_session() == 0) { - // user is not logged in - redirect('user/login'); - } else { - $this->load->model('debug_model'); - $migrate = $this->debug_model->migrate_userdata(); + header('Content-Type: application/json'); + echo json_encode(array('status' => $status)); + return; + } - if ($migrate == true) { - $this->session->set_flashdata('success', 'File Migration was successfull, but please check also manually. If everything seems right you can delete the folders "assets/qslcard" and "images/eqsl_card_images".'); - redirect('debug'); - } else { - $this->session->set_flashdata('error', 'File Migration failed. Please check the Error Log.'); - redirect('debug'); - } - } - } + public function selfupdate() { + if (file_exists('.git')) { + try { + $st=exec('touch '.realpath(APPPATH.'../').'/.maintenance'); + $st=exec('git stash push --include-untracked'); + $st=exec('git fetch'); + $st=exec('git pull'); + $st=exec('git stash pop'); + $st=exec('rm '.realpath(APPPATH.'../').'/.maintenance'); + } catch (\Throwable $th) { + log_message("Error","Error at selfupdating"); + } + } + redirect('debug'); + } + + public function wavelog_fetch() { + $a_versions=[]; + try { + $st=exec('git fetch'); // Fetch latest things from Repo. ONLY Fetch. Doesn't hurt since it isn't a pull! + $versions['branch'] = trim(exec('git rev-parse --abbrev-ref HEAD')); // Get ONLY Name of the Branch we're on + $versions['latest_commit_hash']=substr(trim(exec('git log --pretty="%H" -n1 origin'.'/'.$versions['branch'])),0,8); // fetch latest commit-hash from repo + } catch (Exception $e) { + $versions['latest_commit_hash']=''; + $versions['branch']=''; + } + header('Content-Type: application/json'); + echo json_encode($versions); + } + + public function wavelog_version() { + $commit_hash=substr(trim(exec('git log --pretty="%H" -n1 HEAD')),0,8); // Get latest LOCAL Hash + header('Content-Type: application/json'); + echo json_encode($commit_hash); + } + + public function migrate_userdata() { + // Check if users logged in + $this->load->model('user_model'); + if ($this->user_model->validate_session() == 0) { + // user is not logged in + redirect('user/login'); + } else { + $this->load->model('debug_model'); + $migrate = $this->debug_model->migrate_userdata(); + + if ($migrate == true) { + $this->session->set_flashdata('success', 'File Migration was successfull, but please check also manually. If everything seems right you can delete the folders "assets/qslcard" and "images/eqsl_card_images".'); + redirect('debug'); + } else { + $this->session->set_flashdata('error', 'File Migration failed. Please check the Error Log.'); + redirect('debug'); + } + } + } } diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 922e987c2..c32155fb2 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -16,8 +16,9 @@ class Gridmap extends CI_Controller { $data['visitor'] = false; $data['homegrid'] = explode(',', $this->stations->find_gridsquare()); - $data['modes'] = $this->gridmap_model->get_worked_modes(); + $data['modes'] = $this->gridmap_model->get_worked_modes(); $data['bands'] = $this->bands->get_worked_bands(); + $data['orbits'] = $this->bands->get_worked_orbits(); $data['sats_available'] = $this->bands->get_worked_sats(); $data['user_default_band'] = $this->session->userdata('user_default_band'); @@ -45,13 +46,14 @@ class Gridmap extends CI_Controller { } public function getGridsjs() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); + $band = $this->security->xss_clean($this->input->post('band')); + $mode = $this->security->xss_clean($this->input->post('mode')); + $qsl = $this->security->xss_clean($this->input->post('qsl')); + $lotw = $this->security->xss_clean($this->input->post('lotw')); + $eqsl = $this->security->xss_clean($this->input->post('eqsl')); + $qrz = $this->security->xss_clean($this->input->post('qrz')); $sat = $this->security->xss_clean($this->input->post('sat')); + $orbit = $this->security->xss_clean($this->input->post('orbit')); $this->load->model('gridmap_model'); $array_grid_2char = array(); @@ -70,7 +72,7 @@ class Gridmap extends CI_Controller { $grid_4char_confirmed = ""; $grid_6char_confirmed = ""; - $query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); + $query = $this->gridmap_model->get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { @@ -97,7 +99,7 @@ class Gridmap extends CI_Controller { } } - $query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); + $query = $this->gridmap_model->get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { @@ -124,7 +126,7 @@ class Gridmap extends CI_Controller { } } } - $query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); + $query_vucc = $this->gridmap_model->get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); if ($query_vucc && $query_vucc->num_rows() > 0) { foreach ($query_vucc->result() as $row) { @@ -149,7 +151,7 @@ class Gridmap extends CI_Controller { } // // Confirmed Squares - $query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat); + $query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); if ($query_vucc && $query_vucc->num_rows() > 0) { foreach ($query_vucc->result() as $row) { diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index b6b6b8ada..7d69e1e1c 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -143,10 +143,11 @@ class Labels extends CI_Controller { $offset = xss_clean($this->input->post('startat')); $grid = $this->input->post('grid') === "true" ? 1 : 0; $via = $this->input->post('via') === "true" ? 1 : 0; + $reference = $this->input->post('reference') == "true" ? 1 : 0; $this->load->model('labels_model'); $result = $this->labels_model->export_printrequestedids($ids); - $this->prepareLabel($result, true, $offset, $grid, $via); + $this->prepareLabel($result, true, $offset, $grid, $via, $reference); } public function print($station_id) { @@ -154,18 +155,19 @@ class Labels extends CI_Controller { $offset = xss_clean($this->input->post('startat')); $grid = xss_clean($this->input->post('grid') ?? 0); $via = xss_clean($this->input->post('via') ?? 0); + $reference = xss_clean($this->input->post('reference') ?? 0); $this->load->model('stations'); if ($this->stations->check_station_is_accessible($station_id)) { $this->load->model('labels_model'); $result = $this->labels_model->export_printrequested($clean_id); - $this->prepareLabel($result, false, $offset, $grid, $via); + $this->prepareLabel($result, false, $offset, $grid, $via, $reference); } else { redirect('labels'); } } - function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false) { + function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false, $reference = false) { $this->load->model('labels_model'); $label = $this->labels_model->getDefaultLabel(); @@ -241,9 +243,9 @@ class Labels extends CI_Controller { if ($qsos->num_rows() > 0) { if ($label->qsos == 1) { - $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via); + $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via, $reference); } else { - $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via); + $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via, $reference); } } else { $this->session->set_flashdata('message', '0 QSOs found for print!'); @@ -252,7 +254,7 @@ class Labels extends CI_Controller { $pdf->Output(); } - function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via) { + function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via, $reference) { $text = ''; $current_callsign = ''; $current_sat = ''; @@ -269,7 +271,7 @@ class Labels extends CI_Controller { ( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) { // ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) { if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference); $qso_data = []; } $current_callsign = $qso->COL_CALL; @@ -281,7 +283,7 @@ class Labels extends CI_Controller { $qso_data[] = [ 'time' => $qso->COL_TIME_ON, 'band' => $qso->COL_BAND, - 'mode' => ($qso->COL_SUBMODE ?? $qso->COL_MODE), + 'mode' => (($qso->COL_SUBMODE ?? '') == '') ? $qso->COL_MODE : $qso->COL_SUBMODE, 'rst' => $qso->COL_RST_SENT, 'mygrid' => $qso->station_gridsquare, 'via' => $qso->COL_QSL_VIA, @@ -289,11 +291,17 @@ class Labels extends CI_Controller { 'sat_mode' => $this->pretty_sat_mode($qso->COL_SAT_MODE ?? ''), 'sat_band_rx' => ($qso->COL_BAND_RX ?? ''), 'qsl_recvd' => $qso->COL_QSL_RCVD, - 'mycall' => $qso->COL_STATION_CALLSIGN + 'mycall' => $qso->COL_STATION_CALLSIGN, + 'sig' => $qso->station_sig ?? '', + 'sig_info' => $qso->station_sig_info ?? '', + 'sota' => $qso->station_sota ?? '', + 'iota' => $qso->station_iota ?? '', + 'pota' => $qso->station_pota ?? '', + 'wwff' => $qso->station_wwff ?? '' ]; } if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference); } } // New begin @@ -301,7 +309,7 @@ class Labels extends CI_Controller { return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? '')); } - function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via) { + function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via, $reference) { $tableData = []; $count_qso = 0; @@ -321,7 +329,7 @@ class Labels extends CI_Controller { if($count_qso == $qso_per_label){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference); $tableData = []; // reset the data $count_qso = 0; // reset the counter } @@ -329,12 +337,12 @@ class Labels extends CI_Controller { } // generate label for remaining QSOs if($count_qso > 0){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference); $preliminaryData = []; // reset the data } } - function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false){ + function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false, $reference = false){ $builder = new \AsciiTable\Builder(); $builder->addRows($tableData); $text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with "; @@ -355,10 +363,19 @@ class Labels extends CI_Controller { } $text.="\n"; if ($grid) { $text .= "My call: ".$qso['mycall']." Grid: ".$qso['mygrid']."\n"; } + if ($reference) { + $ref_text = ""; + $ref_avail = false; + if (!empty($qso['sig']) && !empty($qso['sig_info'])) { $ref_text .= $qso['sig'].":".$qso['sig_info']." "; $ref_avail = true;} + if (!empty($qso['sota'])) { $ref_text .= "SOTA:".$qso['sota']." "; $ref_avail = true;} + if (!empty($qso['iota'])) { $ref_text .= "IOTA:".$qso['iota']." "; $ref_avail = true;} + if (!empty($qso['pota'])) { $ref_text .= "POTA:".$qso['pota']." "; $ref_avail = true;} + if (!empty($qso['wwff'])) { $ref_text .= "WWFF:".$qso['wwff']; $ref_avail = true;} + if ($ref_avail == true) {$text .= $ref_text."\n";} + } $text .= "Thanks for the QSO".($numofqsos>1 ? 's' : ''); $text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL"; - $pdf->Add_Label($text,$orientation); - } + $pdf->Add_Label($text,$orientation); } // New End diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index dd48d3c98..74be8f53a 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -635,7 +635,7 @@ class Logbook extends CI_Controller { $html = ""; if(!empty($logbooks_locations_array)) { - $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, '.$this->config->item('table_name').'.COL_MY_GRIDSQUARE, '.$this->config->item('table_name').'.COL_CONTEST_ID, '.$this->config->item('table_name').'.COL_STATE, '.$this->config->item('table_name').'.COL_QRZCOM_QSO_UPLOAD_STATUS, '.$this->config->item('table_name').'.COL_QRZCOM_QSO_DOWNLOAD_STATUS, station_profile.*'); + $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, '.$this->config->item('table_name').'.COL_MY_GRIDSQUARE, '.$this->config->item('table_name').'.COL_CONTEST_ID, '.$this->config->item('table_name').'.COL_STATE, '.$this->config->item('table_name').'.COL_QRZCOM_QSO_UPLOAD_STATUS, '.$this->config->item('table_name').'.COL_QRZCOM_QSO_DOWNLOAD_STATUS, '.$this->config->item('table_name').'.COL_POTA_REF, '.$this->config->item('table_name').'.COL_IOTA, '.$this->config->item('table_name').'.COL_SOTA_REF, '.$this->config->item('table_name').'.COL_WWFF_REF, '.$this->config->item('table_name').'.COL_OPERATOR, '.$this->config->item('table_name').'.COL_COUNTRY, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); @@ -1289,7 +1289,7 @@ class Logbook extends CI_Controller { case 'Mode': $ret.= '