output->enable_profiler(TRUE); // 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'); } $this->load->model('stations'); $this->load->model('logbook_model'); $this->load->library('pagination'); $config['base_url'] = base_url().'index.php/logbook/index/'; $config['total_rows'] = $this->logbook_model->total_qsos(); $config['per_page'] = 25; $config['num_links'] = 6; $config['full_tag_open'] = ''; $config['full_tag_close'] = ''; $config['cur_tag_open'] = ''; $config['cur_tag_close'] = ''; $this->pagination->initialize($config); //load the model and get results $data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3)); $data['user_map_custom'] = $this->optionslib->get_map_custom(); if(!$data['results']) { $this->session->set_flashdata('notice', __("No logbooks were found. You need to define a logbook under Station Logbooks! Do it here:") . ' ' . __("Station Logbooks") . ''); } // Calculate Lat/Lng from Locator to use on Maps if($this->session->userdata('user_locator')) { if(!$this->load->is_loaded('Qra')) { $this->load->library('Qra'); } $qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator')); if (isset($qra_position[0]) and isset($qra_position[1])) { $data['qra'] = "set"; $data['qra_lat'] = $qra_position[0]; $data['qra_lng'] = $qra_position[1]; } else { $data['qra'] = "none"; } } else { $data['qra'] = "none"; } // load the view $data['page_title'] = __("Logbook"); $this->load->view('interface_assets/header', $data); $this->load->view('view_log/index'); $this->load->view('interface_assets/footer'); } function jsonentity($adif) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } $return['dxcc'] = $this->getentity($adif); header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); } function json($tempcallsign, $tempband, $tempmode, $tempstation_id = null, $date = "", $count = 5) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } session_write_close(); // Normalize the date only if it's not empty if (!empty($date)) { // Characters '/' and ',' are not URL safe, so we replace // them with '_' and '%'. Switch them back here. if (strpos($date, '_') !== false) { $date = str_replace('_', '/', $date); } if (strpos($date, '%') !== false) { $date = str_replace('%', ',', $date); } // Get user-preferred date format if ($this->session->userdata('user_date_format')) { $date_format = $this->session->userdata('user_date_format'); } else { $date_format = $this->config->item('qso_date_format'); } $date = urldecode($date); $dt = DateTime::createFromFormat($date_format, $date); if ($dt !== false) { $date = $dt->format('Y-m-d'); // or any normalized format } else { // Invalid date for the expected format, handle gracefully $date = null; } } // Cleaning for security purposes $callsign = $this->security->xss_clean($tempcallsign); $band = $this->security->xss_clean($tempband); $mode = $this->security->xss_clean($tempmode); $station_id = $this->security->xss_clean($tempstation_id); $date = $this->security->xss_clean($date); // Convert - in Callsign to / Used for URL processing $callsign = str_replace("-","/",$callsign); $callsign = str_replace("Ø","0",$callsign); // Check if callsign is an LoTW User // Check Database for all other data $this->load->model('logbook_model'); $lotw_days = $this->logbook_model->check_last_lotw($callsign); if ($lotw_days != null) { $lotw_member="active"; } else { $lotw_member="not found"; } $return = [ "callsign" => strtoupper($callsign), "dxcc" => false, "callsign_name" => "", "callsign_qra" => "", "callsign_distance" => 0, "callsign_qth" => "", "callsign_iota" => "", "callsign_state" => "", "callsign_us_county" => "", "callsign_ituz" => "", "callsign_cqz" => "", "qsl_manager" => "", "bearing" => "", "workedBefore" => false, "timesWorked" => 0, "lotw_member" => $lotw_member, "lotw_days" => $lotw_days, "image" => "", ]; $return['dxcc'] = $this->dxcheck($callsign,$date); $this->load->library('callbook'); $lookupcall = $this->callbook->get_plaincall($callsign); $callbook = $this->logbook_model->loadCallBook($callsign, $this->config->item('use_fullname')); $return['partial'] = $this->partial($lookupcall, $callbook, $callsign, $return['dxcc'], $lotw_days, $band, $count); if ($this->session->userdata('user_measurement_base') == NULL) { $measurement_base = $this->config->item('measurement_base'); } else { $measurement_base = $this->session->userdata('user_measurement_base'); } // Get user's lookup priority preference $lookup_priority = $this->get_lookup_priority(); $return['callsign_name'] = $this->nval($this->logbook_model->call_name($callsign), $callbook['name'] ?? '', $lookup_priority); $return['callsign_qra'] = $this->nval($this->logbook_model->call_qra($callsign), $callbook['gridsquare'] ?? '', $lookup_priority); $return['callsign_geoloc'] = $callbook['geoloc'] ?? ''; $return['callsign_distance'] = $this->distance($return['callsign_qra'], $station_id); $return['callsign_qth'] = $this->nval($this->logbook_model->call_qth($callsign), $callbook['city'] ?? '', $lookup_priority); $return['callsign_iota'] = $this->nval($this->logbook_model->call_iota($callsign), $callbook['iota'] ?? '', $lookup_priority); $return['callsign_email'] = $this->nval($this->logbook_model->call_email($callsign), $callbook['email'] ?? '', $lookup_priority); $return['qsl_manager'] = $this->nval($this->logbook_model->call_qslvia($callsign), $callbook['qslmgr'] ?? '', $lookup_priority); $return['callsign_state'] = $this->nval($this->logbook_model->call_state($callsign), $callbook['state'] ?? '', $lookup_priority); $return['callsign_us_county'] = $this->nval($this->logbook_model->call_us_county($callsign), $callbook['us_county'] ?? '', $lookup_priority); $return['callsign_ituz'] = $this->nval($this->logbook_model->call_ituzone($callsign), $callbook['ituz'] ?? '', $lookup_priority); $return['callsign_cqz'] = $this->nval($this->logbook_model->call_cqzone($callsign), $callbook['cqz'] ?? '', $lookup_priority); $return['workedBefore'] = $this->worked_grid_before($return['callsign_qra'], $band, $mode); $return['confirmed'] = $this->confirmed_grid_before($return['callsign_qra'], $band, $mode); $return['timesWorked'] = $this->logbook_model->times_worked($lookupcall); if ($this->session->userdata('user_show_profile_image')) { if (isset($callbook) && isset($callbook['image'])) { if ($callbook['image'] == "") { $return['image'] = "n/a"; } else { $return['image'] = $callbook['image']; } } else { $return['image'] = "n/a"; } // Additional profile information from QRZ $return['profile_url'] = $callbook['url'] ?? ''; $return['profile_class'] = $callbook['class'] ?? ''; $return['profile_born'] = $callbook['born'] ?? ''; $return['profile_eqsl'] = $callbook['eqsl'] ?? ''; $return['profile_lotw'] = $callbook['lotw'] ?? ''; $return['profile_mqsl'] = $callbook['mqsl'] ?? ''; $return['profile_fname'] = $callbook['fname'] ?? ''; $return['profile_name_last'] = $callbook['name_last'] ?? ''; $return['profile_nickname'] = $callbook['nickname'] ?? ''; $return['profile_aliases'] = $callbook['aliases'] ?? ''; $return['profile_p_call'] = $callbook['p_call'] ?? ''; $return['profile_addr1'] = $callbook['addr1'] ?? ''; $return['profile_addr2'] = $callbook['addr2'] ?? ''; $return['profile_state'] = $callbook['state'] ?? ''; $return['profile_zip'] = $callbook['zip'] ?? ''; $return['profile_country'] = $callbook['country'] ?? ''; $return['profile_dxcc'] = $callbook['dxcc'] ?? ''; $return['profile_lat'] = $callbook['lat'] ?? ''; $return['profile_lon'] = $callbook['lon'] ?? ''; $return['profile_efdate'] = $callbook['efdate'] ?? ''; $return['profile_expdate'] = $callbook['expdate'] ?? ''; $return['profile_GMTOffset'] = $callbook['GMTOffset'] ?? ''; $return['profile_qslmgr'] = $callbook['qslmgr'] ?? ''; } if ($return['callsign_qra'] != "" || $return['callsign_qra'] != null) { $return['latlng'] = $this->qralatlng($return['callsign_qra']); $return['bearing'] = $this->bearing($return['callsign_qra'], $measurement_base, $station_id); } $return['callbook_source'] = $callbook['source'] ?? ''; echo json_encode($return, JSON_PRETTY_PRINT); return; } // Helper function to get user's lookup priority setting // Returns 1 for database priority, 2 for external lookup priority (default) function get_lookup_priority() { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } $this->load->model('user_options_model'); $priority = $this->user_options_model->get_options('qso_db_search_priority', array('option_name'=>'enable', 'option_key'=>'boolean'))->row(); // If setting is 'Y' (Yes), prioritize database (return 1), otherwise prioritize external lookup (return 2) return (isset($priority->option_value) && $priority->option_value == 'Y') ? 1 : 2; } // Returns $val2 first if it has value, even if it is null or empty string, if not return $val1. // When $priority is set to 1, returns $val1 first if it has value, if not return $val2. private function nval($val1, $val2, $priority = 2) { if ($priority == 1) { return (($val1 ?? "") === "" ? ($val2 ?? "") : ($val1 ?? "")); } return (($val2 ?? "") === "" ? ($val1 ?? "") : ($val2 ?? "")); } private function confirmed_grid_before($gridsquare, $band, $mode) { if (strlen($gridsquare) < 4) return false; $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $user_default_confirmation = $this->session->userdata('user_default_confirmation'); if(!empty($logbooks_locations_array)) { $extrawhere=''; if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { $extrawhere="COL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'C') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_CLUBLOG_QSO_DOWNLOAD_STATUS='Y'"; } if($band == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } else { $this->load->model('logbook_model'); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); $this->db->limit(1); $query = $this->db->get($this->config->item('table_name')); foreach ($query->result() as $workedBeforeRow) { return true; } } return false; } private function worked_grid_before($gridsquare, $band, $mode) { if (strlen($gridsquare) < 4) return false; $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if(!empty($logbooks_locations_array)) { if($band == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); } else { $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); $this->db->limit(1); $query = $this->db->get($this->config->item('table_name')); foreach ($query->result() as $workedBeforeRow) { return true; } } return false; } /* * Function: jsonlookupgrid * * Usage: Used to look up gridsquares when creating a QSO to check whether its needed or not * the $type variable is only used for satellites, set this to SAT. * */ function jsonlookupgrid($gridsquare, $type, $band, $mode) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } session_write_close(); $return = [ "workedBefore" => false, "confirmed" => false, ]; $user_default_confirmation = $this->session->userdata('user_default_confirmation'); $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); } else { $this->load->model('logbook_model'); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['workedBefore'] = true; } $extrawhere=''; if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { $extrawhere="COL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; } if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } else { $this->load->model('logbook_model'); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['confirmed']=true; } header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } function jsonlookupdxcc($country, $type, $band, $mode) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } session_write_close(); $return = [ "workedBefore" => false, "confirmed" => false, ]; $user_default_confirmation = $this->session->userdata('user_default_confirmation'); $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->load->model('logbook_model'); if(!empty($logbooks_locations_array)) { if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); } else { $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_DXCC', urldecode($country)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['workedBefore'] = true; } $extrawhere=''; if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { $extrawhere="COL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; } if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } else { $this->load->model('logbook_model'); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_DXCC', urldecode($country)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['confirmed']=true; } header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } else { $return['workedBefore'] = false; $return['confirmed'] = false; header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } } function jsonlookupcallsign($callsign, $type, $band, $mode) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } session_write_close(); // Convert - in Callsign to / Used for URL processing $callsign = str_replace("-","/",$callsign); $return = [ "workedBefore" => false, "confirmed" => false, ]; $user_default_confirmation = $this->session->userdata('user_default_confirmation'); $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->load->model('logbook_model'); if(!empty($logbooks_locations_array)) { if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); } else { $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_CALL', strtoupper($callsign)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['workedBefore'] = true; } $extrawhere=''; if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) { $extrawhere="COL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_LOTW_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_EQSL_QSL_RCVD='Y'"; } if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) { if ($extrawhere!='') { $extrawhere.=" OR"; } $extrawhere.=" COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'"; } if($type == "SAT") { $this->db->where('COL_PROP_MODE', 'SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } else { $this->load->model('logbook_model'); $this->db->where('COL_MODE', $this->logbook_model->get_main_mode_from_mode($mode)); $this->db->where('COL_BAND', $band); $this->db->where('COL_PROP_MODE !=','SAT'); if ($extrawhere != '') { $this->db->where('('.$extrawhere.')'); } else { $this->db->where("1=0"); } } $this->db->where_in('station_id', $logbooks_locations_array); $this->db->where('COL_CALL', strtoupper($callsign)); $query = $this->db->get($this->config->item('table_name'), 1, 0); foreach ($query->result() as $workedBeforeRow) { $return['confirmed'] = true; } header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } else { $return['workedBefore'] = false; $return['confirmed'] = false; header('Content-Type: application/json'); echo json_encode($return, JSON_PRETTY_PRINT); return; } } function view($id) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } $this->load->library('DxccFlag'); if(!$this->load->is_loaded('Qra')) { $this->load->library('Qra'); } $this->load->library('subdivisions'); $this->load->model('logbook_model'); $data['query'] = $this->logbook_model->get_qso($id); if ($data['query']) { // QSO not found // Skip fetching details $data['dxccFlag'] = $this->dxccflag->get($data['query']->result()[0]->COL_DXCC); // Check for note for this callsign and current user $callsign = $data['query']->result()[0]->COL_CALL; $user_id = $this->session->userdata('user_id'); $this->load->model('note'); $data['contacts_note_id'] = $this->note->get_note_id_by_category($user_id, 'Contacts', $callsign); if ($this->session->userdata('user_measurement_base') == NULL) { $data['measurement_base'] = $this->config->item('measurement_base'); } else { $data['measurement_base'] = $this->session->userdata('user_measurement_base'); } $this->load->model('Qsl_model'); $data['qslimages'] = $this->Qsl_model->getQslForQsoId($id); $data['primary_subdivision'] = $this->subdivisions->get_primary_subdivision_name($data['query']->result()[0]->COL_DXCC); $data['secondary_subdivision'] = $this->subdivisions->get_secondary_subdivision_name($data['query']->result()[0]->COL_DXCC); $data['max_upload'] = ini_get('upload_max_filesize'); } $this->load->view('interface_assets/mini_header', $data); $this->load->view('view_log/qso'); $this->load->view('interface_assets/footer'); } function partial($lookupcall, $callbook, $callsign, $dxcc, $lotw_days, $band = null, $count = 5) { $this->load->model('user_model'); if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; } $this->load->model('logbooks_model'); $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $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, '.$this->config->item('table_name').'.COL_CLUBLOG_QSO_UPLOAD_STATUS, '.$this->config->item('table_name').'.COL_CLUBLOG_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.*, satellite.displayname AS sat_displayname'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.COL_SAT_NAME', 'left outer'); $this->db->where_in('station_profile.station_id', $logbooks_locations_array); $this->db->group_start(); $this->db->where($this->config->item('table_name').'.COL_CALL', $lookupcall); $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$lookupcall,'before'); $this->db->or_like($this->config->item('table_name').'.COL_CALL', $lookupcall.'/','after'); $this->db->or_like($this->config->item('table_name').'.COL_CALL', '/'.$lookupcall.'/'); $this->db->group_end(); $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc"); $this->db->order_by($this->config->item('table_name').".COL_PRIMARY_KEY", "desc"); $this->db->limit($count); $query = $this->db->get(); } if (!empty($logbooks_locations_array) && $query->num_rows() > 0) { $html .= "
| Date | "; $html .= "Callsign | "; $html .= $this->part_table_header_col($this, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); $html .= $this->part_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); $html .= $this->part_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); $html .= $this->part_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); switch($this->session->userdata('user_previous_qsl_type')) { case 0: $html .= "".__("QSL")." | "; break; case 1: $html .= "".__("LoTW")." | "; break; case 2: $html .= "".__("eQSL")." | "; break; case 4: $html .= "QRZ | "; break; case 8: $html .= "".__("Clublog") ." | "; break; default: $html .= "".__("QSL")." | "; break; } $html .= ""; $html .= " |
|---|---|---|---|---|---|---|---|---|
| ".date($custom_date_format, $timestamp). date(' H:i',strtotime($row->COL_TIME_ON ?? '1970-01-01 00:00:00')) . " | "; $html .= "" . str_replace('0','Ø',strtoupper($row->COL_CALL)) . " | "; $html .= $this->part_table_col($row, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); $html .= $this->part_table_col($row, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); $html .= $this->part_table_col($row, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); $html .= $this->part_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); if ($this->session->userdata('user_previous_qsl_type') == 1) { $html .= ""; $html .= "COL_LOTW_QSL_SENT) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▲"; $html .= "COL_LOTW_QSL_RCVD) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▼"; $html .= " | "; } else if ($this->session->userdata('user_previous_qsl_type') == 2) { $html .= ""; $html .= "COL_EQSL_QSL_SENT) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▲"; $html .= "COL_EQSL_QSL_RCVD) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▼"; $html .= " | "; } else if ($this->session->userdata('user_previous_qsl_type') == 4) { $html .= ""; $html .= "COL_QRZCOM_QSO_UPLOAD_STATUS) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▲"; $html .= "COL_QRZCOM_QSO_DOWNLOAD_STATUS) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▼"; $html .= " | "; } else if ($this->session->userdata('user_previous_qsl_type') == 8) { $html .= ""; $html .= "COL_CLUBLOG_QSO_UPLOAD_STATUS) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▲"; $html .= "COL_CLUBLOG_QSO_DOWNLOAD_STATUS) { case "Y": $html .= "green"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▼"; $html .= " | "; } else { $html .= ""; $html .= "COL_QSL_SENT) { case "Y": $html .= "green"; break; case "Q": $html .= "yellow"; break; case "R": $html .= "yellow"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▲"; $html .= "COL_QSL_RCVD) { case "Y": $html .= "green"; break; case "Q": $html .= "yellow"; break; case "R": $html .= "yellow"; break; case "I": $html .= "grey"; break; default: $html .= "red"; } $html .= "\">▼"; $html .= " | "; } $html .= "".$row->station_callsign." | "; $html .= "