diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 56bd6de74..5c2e83988 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -2209,4 +2209,113 @@ class Awards extends CI_Controller { $this->load->view('awards/73on73/index'); $this->load->view('interface_assets/footer'); } + + public function wpx () { + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/wpx.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wpx.js")), + ]; + + $this->load->model('wpx'); + $this->load->model('modes'); + $this->load->model('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'); + + $data['worked_bands'] = $this->bands->get_worked_bands('dxcc'); // Used in the view for band select + $data['modes'] = $this->modes->active(); // Used in the view for mode select + + if ($this->input->post('band') != NULL) { // Band is not set when page first loads. + if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands + $bands = $data['worked_bands']; + } else { + $bands[] = $this->security->xss_clean($this->input->post('band')); + } + } else { + $bands = $data['worked_bands']; + } + + $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view + + if($this->input->method() === 'post') { + $postdata['qsl'] = ($this->input->post('qsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['lotw'] = ($this->input->post('lotw',true) ?? 0) == 0 ? NULL: 1; + $postdata['eqsl'] = ($this->input->post('eqsl',true) ?? 0) == 0 ? NULL: 1; + $postdata['qrz'] = ($this->input->post('qrz',true) ?? 0) == 0 ? NULL: 1; + $postdata['clublog'] = ($this->input->post('clublog',true) ?? 0) == 0 ? NULL: 1; + $postdata['Africa'] = ($this->input->post('Africa',true) ?? 0) == 0 ? NULL: 1; + $postdata['Asia'] = ($this->input->post('Asia',true) ?? 0) == 0 ? NULL: 1; + $postdata['Europe'] = ($this->input->post('Europe',true) ?? 0) == 0 ? NULL: 1; + $postdata['NorthAmerica'] = ($this->input->post('NorthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['SouthAmerica'] = ($this->input->post('SouthAmerica',true) ?? 0) == 0 ? NULL: 1; + $postdata['Oceania'] = ($this->input->post('Oceania',true) ?? 0) == 0 ? NULL: 1; + $postdata['Antarctica'] = ($this->input->post('Antarctica',true) ?? 0) == 0 ? NULL: 1; + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sats')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits')); + } else { // Setting default values at first load of page + $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = NULL; + $postdata['qrz'] = NULL; + $postdata['clublog'] = NULL; + $postdata['Africa'] = 1; + $postdata['Asia'] = 1; + $postdata['Europe'] = 1; + $postdata['NorthAmerica'] = 1; + $postdata['SouthAmerica'] = 1; + $postdata['Oceania'] = 1; + $postdata['Antarctica'] = 1; + $postdata['band'] = 'All'; + $postdata['mode'] = 'All'; + $postdata['sat'] = 'All'; + $postdata['orbit'] = 'All'; + } + + $data['wpx_array'] = $this->wpx->get_wpx_array($bands, $postdata); + + // Render Page + $data['page_title'] = sprintf(__("Awards - %s"), __("WPX")); + $data['posted_band']=$postdata['band']; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/wpx/index'); + $this->load->view('interface_assets/footer', $footerData); + } + + public function wpx_details() + { + $postdata['band'] = $this->input->post('band', true); + $postdata['status'] = $this->input->post('status', true); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sats')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits')); + $postdata['mode'] = $this->input->post('mode'); + $postdata['qsl'] = ($this->input->post('qsl', true) ?? 0) == 0 ? NULL: 1; + $postdata['lotw'] = ($this->input->post('lotw', true) ?? 0) == 0 ? NULL: 1; + $postdata['eqsl'] = ($this->input->post('eqsl', true) ?? 0) == 0 ? NULL: 1; + $postdata['qrz'] = ($this->input->post('qrz', true) ?? 0) == 0 ? NULL: 1; + $postdata['clublog'] = ($this->input->post('clublog', true) ?? 0) == 0 ? NULL: 1; + $postdata['Africa'] = ($this->input->post('Africa', true) ?? 0) == 0 ? NULL: 1; + $postdata['Asia'] = ($this->input->post('Asia', true) ?? 0) == 0 ? NULL: 1; + $postdata['Europe'] = ($this->input->post('Europe', true) ?? 0) == 0 ? NULL: 1; + $postdata['NorthAmerica'] = ($this->input->post('NorthAmerica', true) ?? 0) == 0 ? NULL: 1; + $postdata['SouthAmerica'] = ($this->input->post('SouthAmerica', true) ?? 0) == 0 ? NULL: 1; + $postdata['Oceania'] = ($this->input->post('Oceania', true) ?? 0) == 0 ? NULL: 1; + $postdata['Antarctica'] = ($this->input->post('Antarctica', true) ?? 0) == 0 ? NULL: 1; + + $this->load->model('wpx'); + $this->load->model('modes'); + $this->load->model('bands'); + + $results = $this->wpx->getWpxBandDetails($postdata); + + $data['band'] = $postdata['band']; + $data['status'] = $postdata['status']; + $data['results'] = $results; + + $this->load->view('awards/wpx/wpx_details', $data); + } + } diff --git a/application/models/Wpx.php b/application/models/Wpx.php new file mode 100644 index 000000000..eecab6b1b --- /dev/null +++ b/application/models/Wpx.php @@ -0,0 +1,470 @@ +load->is_loaded('Genfunctions')) { + $this->load->library('Genfunctions'); + } + } + + function get_wpx_array($bands, $postdata) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $this->load->model('bands'); + + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display + //'
dxcc.'","'. $band . '","'. $postdata['sat'] . '","' . $postdata['orbit'] . '","'. $postdata['mode'] . '","DXCC2", "")\'>W
'; + $worked = $this->getWpxForBand($band, $location_list, $postdata); + $confirmed = $this->getWpxForBandConfirmed($band, $location_list, $postdata); + $wpxSummary['worked'][$band] = $worked[0]->wpxcount; + $wpxSummary['confirmed'][$band] = $confirmed[0]->wpxcount; + } + + $workedTotal = $this->getWpxForBand($postdata['band'], $location_list, $postdata); + $confirmedTotal = $this->getWpxForBandConfirmed($postdata['band'], $location_list, $postdata); + + $wpxSummary['worked']['Total'] = $workedTotal[0]->wpxcount; + $wpxSummary['confirmed']['Total'] = $confirmedTotal[0]->wpxcount; + + if (isset($wpxSummary)) { + return $wpxSummary; + } else { + return 0; + } + } + + function getWpxForBand($band, $location_list, $postdata) { + $bindings = []; + $sql = "select count(distinct wpx_prefix) wpxcount from ( + SELECT + col_call, + CASE + /* case 1: /digit suffix → handle multi-digit prefixes correctly */ + WHEN col_call REGEXP '/[0-9]$' THEN + CASE + /* If prefix has multiple digits, replace the last digit */ + WHEN SUBSTRING_INDEX(col_call, '/', 1) REGEXP '^[0-9]?[A-Z]{1,3}[0-9]{2,}' THEN + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3}[0-9]*)[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + /* If prefix has single digit, replace it */ + ELSE + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3})[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + END + + /* case 2: no digit at all → append 0 */ + WHEN call_core NOT REGEXP '[A-Z][0-9]' THEN CONCAT(call_core, '0') + + /* case 3: normal/anniversary calls → keep prefix+digits */ + ELSE + REGEXP_REPLACE(call_core, '^([0-9]?[A-Z]{1,3}[0-9]{1,4}).*$', '\\\\1') + END AS wpx_prefix + FROM ( + SELECT + col_call, + CASE + WHEN num_slashes >= 2 THEN left_part + WHEN num_slashes = 1 AND NOT (call_raw REGEXP '/[0-9]$') THEN + CASE + WHEN (left_has_digit + left_short) > (right_has_digit + right_short) THEN left_part + WHEN (left_has_digit + left_short) < (right_has_digit + right_short) THEN right_part + ELSE left_part + END + ELSE call_raw + END AS call_core + FROM ( + SELECT + col_call, + UPPER(TRIM(col_call)) AS call_raw, + (LENGTH(UPPER(TRIM(col_call))) - LENGTH(REPLACE(UPPER(TRIM(col_call)), '/', ''))) AS num_slashes, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) AS left_part, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) AS right_part, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) REGEXP '[0-9]') AS left_has_digit, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) REGEXP '[0-9]') AS right_has_digit, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1)) <= 3) AS left_short, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1)) <= 3) AS right_short + FROM ".$this->config->item('table_name')." thcv + left join satellite on thcv.COL_SAT_NAME = satellite.name + WHERE station_id in (" . $location_list . ") "; + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = ? or col_submode = ?)"; + $bindings[] = $postdata['mode']; + $bindings[] = $postdata['mode']; + } + $sql .= $this->genfunctions->addBandToQuery($band, $bindings); + + $sql .= $this->addContinentsToQuery($postdata); + + $sql .= $this->addOrbitToQuery($postdata, $bindings); + + $sql .= " ) AS s + ) AS t + ) as x"; + + if (!empty($bindings)) { + $query = $this->db->query($sql, $bindings); + } else { + $query = $this->db->query($sql); + } + + return $query->result(); + } + + function getWpxForBandConfirmed($band, $location_list, $postdata) { + $bindings=[]; + $sql = "select count(distinct wpx_prefix) wpxcount from ( + SELECT + col_call, + CASE + /* case 1: /digit suffix → handle multi-digit prefixes correctly */ + WHEN col_call REGEXP '/[0-9]$' THEN + CASE + /* If prefix has multiple digits, replace the last digit */ + WHEN SUBSTRING_INDEX(col_call, '/', 1) REGEXP '^[0-9]?[A-Z]{1,3}[0-9]{2,}' THEN + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3}[0-9]*)[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + /* If prefix has single digit, replace it */ + ELSE + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3})[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + END + + /* case 2: no digit at all → append 0 */ + WHEN call_core NOT REGEXP '[A-Z][0-9]' THEN CONCAT(call_core, '0') + + /* case 3: normal/anniversary calls → keep prefix+digits */ + ELSE + REGEXP_REPLACE(call_core, '^([0-9]?[A-Z]{1,3}[0-9]{1,4}).*$', '\\\\1') + END AS wpx_prefix + FROM ( + SELECT + col_call, + CASE + WHEN num_slashes >= 2 THEN left_part + WHEN num_slashes = 1 AND NOT (call_raw REGEXP '/[0-9]$') THEN + CASE + WHEN (left_has_digit + left_short) > (right_has_digit + right_short) THEN left_part + WHEN (left_has_digit + left_short) < (right_has_digit + right_short) THEN right_part + ELSE left_part + END + ELSE call_raw + END AS call_core + FROM ( + SELECT + col_call, + UPPER(TRIM(col_call)) AS call_raw, + (LENGTH(UPPER(TRIM(col_call))) - LENGTH(REPLACE(UPPER(TRIM(col_call)), '/', ''))) AS num_slashes, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) AS left_part, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) AS right_part, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) REGEXP '[0-9]') AS left_has_digit, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) REGEXP '[0-9]') AS right_has_digit, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1)) <= 3) AS left_short, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1)) <= 3) AS right_short + FROM ".$this->config->item('table_name')." thcv + left join satellite on thcv.COL_SAT_NAME = satellite.name + WHERE station_id in (" . $location_list . ") "; + $sql .= $this->genfunctions->addQslToQuery($postdata); + + $sql .= $this->genfunctions->addBandToQuery($band, $bindings); + + $sql .= $this->addContinentsToQuery($postdata); + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = ? or col_submode = ?)"; + $bindings[]=$postdata['mode']; + $bindings[]=$postdata['mode']; + } + + $sql .= $this->addContinentsToQuery($postdata); + + $sql .= $this->addOrbitToQuery($postdata,$bindings); + + $sql .= " ) AS s + ) AS t + ) as x"; + + if (!empty($bindings)) { + $query = $this->db->query($sql, $bindings); + } else { + $query = $this->db->query($sql); + } + + return $query->result(); + } + + // Made function instead of repeating this several times + function addContinentsToQuery($postdata) { + $sql = ''; + if ($postdata['Africa'] == NULL) { + $sql .= " and col_cont <> 'AF'"; + } + + if ($postdata['Europe'] == NULL) { + $sql .= " and col_cont <> 'EU'"; + } + + if ($postdata['Asia'] == NULL) { + $sql .= " and col_cont <> 'AS'"; + } + + if ($postdata['SouthAmerica'] == NULL) { + $sql .= " and col_cont <> 'SA'"; + } + + if ($postdata['NorthAmerica'] == NULL) { + $sql .= " and col_cont <> 'NA'"; + } + + if ($postdata['Oceania'] == NULL) { + $sql .= " and col_cont <> 'OC'"; + } + + if ($postdata['Antarctica'] == NULL) { + $sql .= " and col_cont <> 'AN'"; + } + if (strlen($sql) > 0) { + $sql .= " and col_cont <> '' and col_cont IS NOT NULL"; + } + return $sql; + } + + // Adds orbit type to query + function addOrbitToQuery($postdata,&$binding) { + $sql = ''; + if ($postdata['orbit'] != 'All') { + $sql .= ' AND satellite.orbit = ?'; + $binding[]=$postdata['orbit']; + } + + return $sql; + } + + public function get_band_details($band, $status) + { + $this->db->select('col_call, col_time_on, col_mode, col_qsl_rcvd, col_lotw_qsl_rcvd, col_eqsl_qsl_rcvd'); + + $this->db->from($this->config->item('table_name') . ' thcv'); + + $station_id = $this->session->userdata('active_station_logbook'); + if (is_array($station_id)) { + $this->db->where_in('station_id', $station_id); + } else { + $this->db->where('station_id', $station_id); + } + + // filter by band (skip if "Total") + if ($band !== 'Total') { + $this->db->where('col_band', $band); + } + + // filter by status + if ($status === 'confirmed') { + $this->db->where("(col_qsl_rcvd = 'Y' OR col_lotw_qsl_rcvd = 'Y' OR col_eqsl_qsl_rcvd = 'Y')", null, false); + } + + $this->db->order_by('col_time_on', 'DESC'); + + $query = $this->db->get(); + return $query->result(); + } + + function getWpxBandDetails($postdata) { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + + $bindings = []; + $sql = "select wpx_prefix, col_call, col_time_on, col_band, col_mode, col_submode, + col_lotw_qsl_rcvd, col_qsl_rcvd, col_eqsl_qsl_rcvd, COL_QRZCOM_QSO_DOWNLOAD_STATUS, COL_CLUBLOG_QSO_DOWNLOAD_STATUS + from ( + select wpx_prefix, col_call, col_time_on, col_band, col_mode, col_submode, + col_lotw_qsl_rcvd, col_qsl_rcvd, col_eqsl_qsl_rcvd, COL_QRZCOM_QSO_DOWNLOAD_STATUS, COL_CLUBLOG_QSO_DOWNLOAD_STATUS, + ROW_NUMBER() OVER ( + PARTITION BY wpx_prefix + ORDER BY + /* Prioritize confirmed contacts first */ + CASE + WHEN col_lotw_qsl_rcvd = 'Y' OR + col_qsl_rcvd = 'Y' OR + col_eqsl_qsl_rcvd = 'Y' OR + COL_QRZCOM_QSO_DOWNLOAD_STATUS = 'Y' OR + COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y' + THEN 0 + ELSE 1 + END, + /* Then by time */ + col_time_on ASC + ) as rn from ( + SELECT col_call, col_time_on, col_band, col_mode, col_submode, + col_lotw_qsl_rcvd, col_qsl_rcvd, col_eqsl_qsl_rcvd, COL_QRZCOM_QSO_DOWNLOAD_STATUS, COL_CLUBLOG_QSO_DOWNLOAD_STATUS, + CASE + /* case 1: /digit suffix → handle multi-digit prefixes correctly */ + WHEN col_call REGEXP '/[0-9]$' THEN + CASE + /* If prefix has multiple digits, replace the last digit */ + WHEN SUBSTRING_INDEX(col_call, '/', 1) REGEXP '^[0-9]?[A-Z]{1,3}[0-9]{2,}' THEN + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3}[0-9]*)[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + /* If prefix has single digit, replace it */ + ELSE + CONCAT( + REGEXP_REPLACE( + SUBSTRING_INDEX(col_call, '/', 1), + '^([0-9]?[A-Z]{1,3})[0-9].*$', + '\\\\1' + ), + SUBSTRING_INDEX(col_call, '/', -1) + ) + END + + /* case 2: no digit at all → append 0 */ + WHEN call_core NOT REGEXP '[A-Z][0-9]' THEN CONCAT(call_core, '0') + + /* case 3: normal/anniversary calls → keep prefix+digits */ + ELSE + REGEXP_REPLACE(call_core, '^([0-9]?[A-Z]{1,3}[0-9]{1,4}).*$', '\\\\1') + END AS wpx_prefix + FROM ( + SELECT + col_call, col_time_on, col_band, col_mode, col_submode, + col_lotw_qsl_rcvd, col_qsl_rcvd, col_eqsl_qsl_rcvd, COL_QRZCOM_QSO_DOWNLOAD_STATUS, COL_CLUBLOG_QSO_DOWNLOAD_STATUS, + CASE + WHEN num_slashes >= 2 THEN left_part + WHEN num_slashes = 1 AND NOT (call_raw REGEXP '/[0-9]$') THEN + CASE + WHEN (left_has_digit + left_short) > (right_has_digit + right_short) THEN left_part + WHEN (left_has_digit + left_short) < (right_has_digit + right_short) THEN right_part + ELSE left_part + END + ELSE call_raw + END AS call_core + FROM ( + SELECT + col_call, col_time_on, col_band, col_mode, col_submode, col_lotw_qsl_rcvd, col_qsl_rcvd, col_eqsl_qsl_rcvd, COL_QRZCOM_QSO_DOWNLOAD_STATUS, COL_CLUBLOG_QSO_DOWNLOAD_STATUS, + UPPER(TRIM(col_call)) AS call_raw, + (LENGTH(UPPER(TRIM(col_call))) - LENGTH(REPLACE(UPPER(TRIM(col_call)), '/', ''))) AS num_slashes, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) AS left_part, + SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) AS right_part, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1) REGEXP '[0-9]') AS left_has_digit, + (SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1) REGEXP '[0-9]') AS right_has_digit, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', 1)) <= 3) AS left_short, + (LENGTH(SUBSTRING_INDEX(UPPER(TRIM(col_call)), '/', -1)) <= 3) AS right_short + FROM ".$this->config->item('table_name')." thcv + LEFT JOIN satellite on thcv.COL_SAT_NAME = satellite.name + WHERE station_id in (" . $location_list . ") "; + + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = ? or col_submode = ?)"; + $bindings[] = $postdata['mode']; + $bindings[] = $postdata['mode']; + } + // filter by band (skip if "Total") + if ($postdata['band'] !== 'Total') { + $sql .= $this->genfunctions->addBandToQuery($postdata['band'], $bindings); + } + + if ($postdata['status'] === 'confirmed') { + $sql .= $this->addQslToQuery($postdata); + } + $sql .= $this->addContinentsToQuery($postdata); + + $sql .= " ) AS s + ) AS t + ) as x + ) as ranked + WHERE rn = 1 + ORDER BY wpx_prefix"; + + if (!empty($bindings)) { + $query = $this->db->query($sql, $bindings); + } else { + $query = $this->db->query($sql); + } + + return $query->result(); + } + + function addQslToQuery($postdata) { + $sql = ''; + $qsl = array(); + if ( (($postdata['clublog'] ?? '') != '') || + (($postdata['qrz'] ?? '') != '') || + (($postdata['lotw'] ?? '') != '') || + (($postdata['qsl'] ?? '') != '') || + (($postdata['dcl'] ?? '') != '') || + (($postdata['eqsl'] ?? '') != '') ) { + $sql .= ' and ('; + if (($postdata['qsl'] ?? '') != '') { + array_push($qsl, "col_qsl_rcvd = 'Y'"); + } + if (($postdata['lotw'] ?? '') != '') { + array_push($qsl, "col_lotw_qsl_rcvd = 'Y'"); + } + if (($postdata['eqsl'] ?? '') != '') { + array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'"); + } + if (($postdata['qrz'] ?? '') != '') { + array_push($qsl, "COL_QRZCOM_QSO_DOWNLOAD_STATUS = 'Y'"); + } + if (($postdata['clublog'] ?? '') != '') { + array_push($qsl, "COL_CLUBLOG_QSO_DOWNLOAD_STATUS = 'Y'"); + } + if (($postdata['dcl'] ?? '') != '') { + array_push($qsl, "COL_DCL_QSL_RCVD = 'Y'"); + } + if (count($qsl) > 0) { + $sql .= implode(' or ', $qsl); + } else { + $sql .= '1=0'; + } + $sql .= ')'; + } else { + $sql.=' and 1=0'; + } + return $sql; + } + +} +?> diff --git a/application/views/awards/wpx/index.php b/application/views/awards/wpx/index.php new file mode 100644 index 000000000..d0d1329b6 --- /dev/null +++ b/application/views/awards/wpx/index.php @@ -0,0 +1,233 @@ +
+ +
+
+

+
+ + +
+
+ +
+
+ + +' . __("Summary") . ' + + + + '; + + $addsat = ''; + foreach ($bands as $band) { + if ($band != 'SAT') { + echo ''; + } else { + $addsat = ''; + } + } + echo ''; + if (count($bands) > 1) { + echo ''; + } + echo $addsat; + echo ' + + + '; + + // ---- Worked row ---- + echo ''; + $addsat = ''; + foreach ($wpx_array['worked'] as $band => $value) { + if ($band != 'SAT') { + echo ''; + } else { + $addsat = ''; + } + } + + if (count($bands) > 1) { + echo ''; + } + if ($addsat != '' && count($wpx_array['worked']) > 1) { + echo $addsat; + } + echo ''; + + // ---- Confirmed row ---- + echo ''; + $addsat = ''; + foreach ($wpx_array['confirmed'] as $band => $value) { + if ($band != 'SAT') { + echo ''; + } else { + $addsat = ''; + } + } + + if (count($bands) > 1) { + echo ''; + } + if ($addsat != '' && count($wpx_array['confirmed']) > 1) { + echo $addsat; + } + echo ''; + + echo '
' . $band . '' . $band . '' . __("Total") . '
' . __("Total worked") . ''; + echo '' . $value . ''; + echo '' . $value . '
' . __("Total confirmed") . ''; + echo '' . $value . ''; + echo '' . $value . '
'; + echo '
'; + +} else { + echo ''; +} +?> + + +
diff --git a/application/views/awards/wpx/wpx_details.php b/application/views/awards/wpx/wpx_details.php new file mode 100644 index 000000000..122e2747b --- /dev/null +++ b/application/views/awards/wpx/wpx_details.php @@ -0,0 +1,60 @@ +

+ +session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); +} else { + // Get Default date format from /config/wavelog.php + $custom_date_format = $this->config->item('qso_date_format'); +} + + $i = 1; + if (!empty($results)): ?> + + + + + + + + + + + + + + col_time_on); + ?> + + + + + + + + + + + +
#
wpx_prefix; ?>col_call; ?>col_band; ?>col_submode ?? $qso->col_mode; ?>col_qsl_rcvd, $qso->col_lotw_qsl_rcvd, $qso->col_eqsl_qsl_rcvd, $qso->COL_QRZCOM_QSO_DOWNLOAD_STATUS, $qso->COL_CLUBLOG_QSO_DOWNLOAD_STATUS); ?>
+ +
No QSOs found for .
+-'; } + + return '
' . $string . '
'; +} + +?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index a52240e46..3b0b1bb3c 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1867,7 +1867,7 @@ $(document).ready(function(){ -uri->segment(2) == "dxcc" || $this->uri->segment(2) == "wae") { ?> +uri->segment(2) == "dxcc" || $this->uri->segment(2) == "wae" || $this->uri->segment(2) == "wpx") { ?> - uri->segment(2) == "wae") { ?> + uri->segment(2) == "wae" || $this->uri->segment(2) == "wpx") { ?>