mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-23 10:47:16 +00:00
* config file for directory userdata * userdir for eqsl * change name to userdata * userdata for qsl * fix name on comment * add generic function file * remove model class on view, use generic function * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay * paths libary * Dev (#2) * Added Windows, MariaDB and PHP-Versions * Release 1.0 * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay --------- Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> * [eQSL] only locations with a eQSL nickname should be displayed (#74) * only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import * add proper error message * improve usability --------- Co-authored-by: Christoph Kottke <dg0tm@darc.de> * html fixes * show flashdata if no station has eqsl nick * removed openssl check, not required * accumulate stats language * multilanguage support * prettier * Prevent leaking data out of other station_location * moved qrg to first tab * Fix a PHP 8.1 deprecated bug. * [Contesting] Fix for table qso count * Fixed error when data was empty. Also clear table before inserting again. * Refactor to get the table to load * Need to clear datatable when session is deleted * Prevent Racecondition * Fixed a few null-checks which will fail on fresh accounts * Allow for longer gridsquare in station profile * Show IOTA/SOTA ref on station location tab * [LBA] Fixed mapping of selected QSOs * Trying to convert the QSO-Post to an ajax call PHP/Part * JS Part * Dev (#3) * Added Windows, MariaDB and PHP-Versions * Release 1.0 * Re-added forum link * add stations_id to eqsl functions * remove 'v' in Version Dialog * Update README.md added Link to demo instance * Update index.php * We should be MIT Conform * [Debug] Added information about when files were last updated, and links to update * Added custom data format * Remove leftover-index * Migration * Check if index is there * [LBA] Can disable maidenhead overlay * [eQSL] only locations with a eQSL nickname should be displayed (#74) * only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import * add proper error message * improve usability --------- Co-authored-by: Christoph Kottke <dg0tm@darc.de> * html fixes * show flashdata if no station has eqsl nick * removed openssl check, not required * accumulate stats language * multilanguage support * prettier * Prevent leaking data out of other station_location * moved qrg to first tab * Fix a PHP 8.1 deprecated bug. * [Contesting] Fix for table qso count * Fixed error when data was empty. Also clear table before inserting again. * Refactor to get the table to load * Need to clear datatable when session is deleted * Prevent Racecondition * Fixed a few null-checks which will fail on fresh accounts * Allow for longer gridsquare in station profile * Show IOTA/SOTA ref on station location tab * [LBA] Fixed mapping of selected QSOs --------- Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> Co-authored-by: dg0tm <schieberjunge@gmx.net> * First POC * Handling of AJAX result (started) * Change qso-save to ajax-return * Added notification and reloading of QSO-Table * JS-Part * Set Focus to qso after (successful) log * Resetting timers (successful) * Info is now shown / faded * Small adjustments * More Beauty * Make consequent use of SIG-References from station_profile * Delete application/views/welcome directory Leftovers. Security Flaw! * Update Dashboard.php Remove redir to welcome * Delete application/controllers/Welcome.php security flaw * Hint for 8.3. friendly Usertest * Update config.sample.php default should be commented out * [LBA] Checkbox to turn on/off path lines in map * Styling for pathlines-checkbox * [LBA] Checkbox tweaks * updated comment in config.php (sample and installer) * Removed popup regarding unsaved changes (wasn't functional at all) * Added locking for sending a qso twice * added spinner to save button * Also include SIG and SIG_INFO * [Logbook] Removed profiler * [LBA] Added fitbounds to map * [LBA] Added CQ Zone overlay * Make clearer that overview filters on logbook rather than locations * baesURL has a trailing slash already * active logbook hint * Update .gitignore added userdata * [LBA] ITU zone overlay * Minor wording * [LBA] Added custom mapping icons * [LBA] Path line follows icon color * [LBA] Added icon anchoring * [LBA] Added easyprint for easy map saving * [LBA] Added default colors when icon settings does not exist in db * Check refs before trimming them * [LBA] Fixed another default issue with markers and colors * Removed dangerous functions where User can accidently shift profiles * Rmoeve more unused leftovers from 1.0 to 2.0. * Header refactoring (#110) * splitted up header * resorted header menu * main rebuild * header behaviour hover * dropdown toggle rotate * fix case where landscape is small menu and portrait normal view * submenu thirdparty services * removed custom maps from the header * matching search bar * border * matched border to themes * [Custom Map] Removed code * [Gridmap] Broke map by accident. Thanks @phl0 for poke. * Optical support for SAT directions and elevation * [LBA] Added coordinates at the bottom of the map * Align numbers and arrows * Reset RST after saving via AJAX * Cfd export (#117) * Added CFD Export for toplist.darc.de to Wavelog --------- Co-authored-by: phl0 <github@florian-wolters.de> * special thx to contributors * tag 1.1 * typo --------- Co-authored-by: abarrau <hesky378@gmail.com> Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com> Co-authored-by: Christoph Kottke <dg0tm@darc.de> Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com> Co-authored-by: int2001 <joerg@dj7nt.de> Co-authored-by: Florian (DF2ET) <github@florian-wolters.de> Co-authored-by: dg0tm <schieberjunge@gmx.net>
501 lines
14 KiB
PHP
501 lines
14 KiB
PHP
<?php
|
|
|
|
class DXCC extends CI_Model {
|
|
|
|
/**
|
|
* Function: mostactive
|
|
* Information: Returns the most active band
|
|
**/
|
|
function info($callsign) {
|
|
$exceptions = $this->db->query('
|
|
SELECT *
|
|
FROM `dxcc_exceptions`
|
|
WHERE `prefix` = \''.$callsign.'\'
|
|
LIMIT 1
|
|
');
|
|
|
|
if ($exceptions->num_rows() > 0) {
|
|
return $exceptions;
|
|
} else {
|
|
$query = $this->db->query('
|
|
SELECT *
|
|
FROM dxcc_entities
|
|
WHERE prefix = SUBSTRING( \''.$callsign.'\', 1, LENGTH( prefix ) )
|
|
ORDER BY LENGTH( prefix ) DESC
|
|
LIMIT 1
|
|
');
|
|
|
|
return $query;
|
|
}
|
|
}
|
|
|
|
function search(){
|
|
print_r($this->input->get());
|
|
return;
|
|
}
|
|
|
|
function empty_table($table) {
|
|
$this->db->empty_table($table);
|
|
}
|
|
|
|
/*
|
|
* Fetches a list of all dxcc's, both current and deleted
|
|
*/
|
|
function list() {
|
|
$this->db->order_by('name', 'ASC');
|
|
return $this->db->get('dxcc_entities');
|
|
}
|
|
|
|
/*
|
|
* Fetches a list of all current dxcc's (non-deleted)
|
|
*/
|
|
function list_current($orderer = 'name') {
|
|
$this->db->where('end', null);
|
|
|
|
if ($orderer == 'name') {
|
|
$this->db->order_by('name', 'ASC');
|
|
} elseif ($orderer == 'prefix') {
|
|
$this->db->order_by('prefix', 'ASC');
|
|
}
|
|
return $this->db->get('dxcc_entities');
|
|
}
|
|
|
|
function get_dxcc_array($dxccArray, $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;
|
|
}
|
|
|
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
|
|
|
$qsl = "";
|
|
if ($postdata['confirmed'] != NULL) {
|
|
if ($postdata['qsl'] != NULL ) {
|
|
$qsl .= "Q";
|
|
}
|
|
if ($postdata['lotw'] != NULL ) {
|
|
$qsl .= "L";
|
|
}
|
|
if ($postdata['eqsl'] != NULL ) {
|
|
$qsl .= "E";
|
|
}
|
|
if ($postdata['qrz'] != NULL ) {
|
|
$qsl .= "Z";
|
|
}
|
|
}
|
|
|
|
foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display
|
|
foreach ($dxccArray as $dxcc) {
|
|
$dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/");
|
|
$dxccMatrix[$dxcc->adif]['Dxccprefix'] = $dxcc->prefix;
|
|
if ($postdata['includedeleted'])
|
|
$dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? 1 : 0;
|
|
$dxccMatrix[$dxcc->adif][$band] = '-';
|
|
}
|
|
|
|
// If worked is checked, we add worked entities to the array
|
|
if ($postdata['worked'] != NULL) {
|
|
$workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata);
|
|
foreach ($workedDXCC as $wdxcc) {
|
|
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="bg-danger awardsBgDanger" ><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC", "")\'>W</a></div>';
|
|
}
|
|
}
|
|
|
|
// If confirmed is checked, we add confirmed entities to the array
|
|
if ($postdata['confirmed'] != NULL) {
|
|
$confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata);
|
|
foreach ($confirmedDXCC as $cdxcc) {
|
|
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $cdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC","'.$qsl.'")\'>C</a></div>';
|
|
}
|
|
}
|
|
}
|
|
|
|
// We want to remove the worked dxcc's in the list, since we do not want to display them
|
|
if ($postdata['worked'] == NULL) {
|
|
$workedDxcc = $this->getDxccWorked($location_list, $postdata);
|
|
foreach ($workedDxcc as $wdxcc) {
|
|
if (array_key_exists($wdxcc->dxcc, $dxccMatrix)) {
|
|
unset($dxccMatrix[$wdxcc->dxcc]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// We want to remove the confirmed dxcc's in the list, since we do not want to display them
|
|
if ($postdata['confirmed'] == NULL) {
|
|
$confirmedDxcc = $this->getDxccConfirmed($location_list, $postdata);
|
|
foreach ($confirmedDxcc as $cdxcc) {
|
|
if (array_key_exists($cdxcc->dxcc, $dxccMatrix)) {
|
|
unset($dxccMatrix[$cdxcc->dxcc]);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (isset($dxccMatrix)) {
|
|
return $dxccMatrix;
|
|
} else {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
function getDxccBandConfirmed($location_list, $band, $postdata) {
|
|
$sql = "select adif as dxcc, name from dxcc_entities
|
|
join (
|
|
select col_dxcc from ".$this->config->item('table_name')." thcv
|
|
where station_id in (" . $location_list .
|
|
") and col_dxcc > 0";
|
|
|
|
$sql .= $this->addBandToQuery($band);
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= $this->addQslToQuery($postdata);
|
|
|
|
$sql .= " group by col_dxcc
|
|
) x on dxcc_entities.adif = x.col_dxcc";
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and dxcc_entities.end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
function getDxccBandWorked($location_list, $band, $postdata) {
|
|
$sql = "select adif as dxcc, name from dxcc_entities
|
|
join (
|
|
select col_dxcc from ".$this->config->item('table_name')." thcv
|
|
where station_id in (" . $location_list .
|
|
") and col_dxcc > 0";
|
|
$sql .= $this->addBandToQuery($band);
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
$sql .= " group by col_dxcc
|
|
) x on dxcc_entities.adif = x.col_dxcc";;
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and dxcc_entities.end is null";
|
|
}
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
$query = $this->db->query($sql);
|
|
return $query->result();
|
|
}
|
|
|
|
function addBandToQuery($band) {
|
|
$sql = '';
|
|
if ($band != 'All') {
|
|
if ($band == 'SAT') {
|
|
$sql .= " and col_prop_mode ='" . $band . "'";
|
|
} else {
|
|
$sql .= " and col_prop_mode !='SAT'";
|
|
$sql .= " and col_band ='" . $band . "'";
|
|
}
|
|
}
|
|
return $sql;
|
|
}
|
|
|
|
function fetchDxcc($postdata) {
|
|
$CI =& get_instance();
|
|
$CI->load->model('logbooks_model');
|
|
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
|
|
|
if (!$logbooks_locations_array) {
|
|
return null;
|
|
}
|
|
|
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
|
|
|
$sql = "select adif, prefix, name, date(end) Enddate, date(start) Startdate, lat, `long`
|
|
from dxcc_entities";
|
|
|
|
if ($postdata['notworked'] == NULL) {
|
|
$sql .= " join (select col_dxcc from " . $this->config->item('table_name') . " where station_id in (" . $location_list . ") and col_dxcc > 0";
|
|
|
|
if ($postdata['band'] != 'All') {
|
|
if ($postdata['band'] == 'SAT') {
|
|
$sql .= " and col_prop_mode ='" . $postdata['band'] . "'";
|
|
} else {
|
|
$sql .= " and col_prop_mode !='SAT'";
|
|
$sql .= " and col_band ='" . $postdata['band'] . "'";
|
|
}
|
|
}
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= ' group by col_dxcc) x on dxcc_entities.adif = x.col_dxcc';
|
|
}
|
|
|
|
$sql .= " where 1 = 1";
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
|
|
$sql .= ' order by prefix';
|
|
$query = $this->db->query($sql);
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
function getDxccWorked($location_list, $postdata) {
|
|
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
|
join (
|
|
select col_dxcc
|
|
from ".$this->config->item('table_name')." thcv
|
|
where station_id in (" . $location_list .
|
|
") and col_dxcc > 0";
|
|
$sql .= $this->addBandToQuery($postdata['band']);
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id in (". $location_list .") and col_dxcc = thcv.col_dxcc and col_dxcc > 0";
|
|
$sql .= $this->addBandToQuery($postdata['band']);
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= $this->addQslToQuery($postdata);
|
|
$sql .= ')';
|
|
$sql .= " group by col_dxcc
|
|
) ll on dxcc_entities.adif = ll.col_dxcc
|
|
where 1=1";
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and dxcc_entities.end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
$query = $this->db->query($sql);
|
|
return $query->result();
|
|
}
|
|
|
|
function getDxccConfirmed($location_list, $postdata) {
|
|
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
|
join (
|
|
select col_dxcc
|
|
from ".$this->config->item('table_name')." thcv
|
|
where station_id in (". $location_list .
|
|
") and col_dxcc > 0";
|
|
|
|
$sql .= $this->addBandToQuery($postdata['band']);
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= $this->addQslToQuery($postdata);
|
|
|
|
$sql .= " group by col_dxcc
|
|
) ll on dxcc_entities.adif = ll.col_dxcc
|
|
where 1=1";
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and dxcc_entities.end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
// Made function instead of repeating this several times
|
|
function addQslToQuery($postdata) {
|
|
$sql = '';
|
|
$qsl = array();
|
|
if ($postdata['qrz'] != NULL || $postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) {
|
|
$sql .= ' and (';
|
|
if ($postdata['qsl'] != NULL) {
|
|
array_push($qsl, "col_qsl_rcvd = 'Y'");
|
|
}
|
|
if ($postdata['lotw'] != NULL) {
|
|
array_push($qsl, "col_lotw_qsl_rcvd = 'Y'");
|
|
}
|
|
if ($postdata['eqsl'] != NULL) {
|
|
array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'");
|
|
}
|
|
if ($postdata['qrz'] != NULL) {
|
|
array_push($qsl, "COL_QRZCOM_QSO_DOWNLOAD_STATUS = 'Y'");
|
|
}
|
|
if (count($qsl) > 0) {
|
|
$sql .= implode(' or ', $qsl);
|
|
} else {
|
|
$sql .= '1=0';
|
|
}
|
|
$sql .= ')';
|
|
} else {
|
|
$sql.=' and 1=0';
|
|
}
|
|
return $sql;
|
|
}
|
|
|
|
|
|
// Made function instead of repeating this several times
|
|
function addContinentsToQuery($postdata) {
|
|
$sql = '';
|
|
if ($postdata['Africa'] == NULL) {
|
|
$sql .= " and cont <> 'AF'";
|
|
}
|
|
|
|
if ($postdata['Europe'] == NULL) {
|
|
$sql .= " and cont <> 'EU'";
|
|
}
|
|
|
|
if ($postdata['Asia'] == NULL) {
|
|
$sql .= " and cont <> 'AS'";
|
|
}
|
|
|
|
if ($postdata['SouthAmerica'] == NULL) {
|
|
$sql .= " and cont <> 'SA'";
|
|
}
|
|
|
|
if ($postdata['NorthAmerica'] == NULL) {
|
|
$sql .= " and cont <> 'NA'";
|
|
}
|
|
|
|
if ($postdata['Oceania'] == NULL) {
|
|
$sql .= " and cont <> 'OC'";
|
|
}
|
|
|
|
if ($postdata['Antarctica'] == NULL) {
|
|
$sql .= " and cont <> 'AN'";
|
|
}
|
|
return $sql;
|
|
}
|
|
|
|
/*
|
|
* Function gets worked and confirmed summary on each band on the active stationprofile
|
|
*/
|
|
function get_dxcc_summary($bands, $postdata) {
|
|
$CI =& get_instance();
|
|
$CI->load->model('logbooks_model');
|
|
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
|
|
|
if (!$logbooks_locations_array) {
|
|
return null;
|
|
}
|
|
|
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
|
|
|
foreach ($bands as $band) {
|
|
$worked = $this->getSummaryByBand($band, $postdata, $location_list);
|
|
$confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
|
|
$dxccSummary['worked'][$band] = $worked[0]->count;
|
|
$dxccSummary['confirmed'][$band] = $confirmed[0]->count;
|
|
}
|
|
|
|
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
|
|
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
|
|
|
|
$dxccSummary['worked']['Total'] = $workedTotal[0]->count;
|
|
$dxccSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
|
|
|
return $dxccSummary;
|
|
}
|
|
|
|
function getSummaryByBand($band, $postdata, $location_list) {
|
|
$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv";
|
|
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
|
|
|
|
$sql .= " where station_id in (" . $location_list . ") and col_dxcc > 0";
|
|
|
|
if ($band == 'SAT') {
|
|
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
|
} else if ($band == 'All') {
|
|
$this->load->model('bands');
|
|
|
|
$bandslots = $this->bands->get_worked_bands('dxcc');
|
|
|
|
$bandslots_list = "'".implode("','",$bandslots)."'";
|
|
|
|
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
|
|
" and thcv.col_prop_mode !='SAT'";
|
|
} else {
|
|
$sql .= " and thcv.col_prop_mode !='SAT'";
|
|
$sql .= " and thcv.col_band ='" . $band . "'";
|
|
}
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and d.end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
function getSummaryByBandConfirmed($band, $postdata, $location_list) {
|
|
$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv";
|
|
$sql .= " join dxcc_entities d on thcv.col_dxcc = d.adif";
|
|
|
|
$sql .= " where station_id in (" . $location_list . ")";
|
|
|
|
if ($band == 'SAT') {
|
|
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
|
} else if ($band == 'All') {
|
|
$this->load->model('bands');
|
|
|
|
$bandslots = $this->bands->get_worked_bands('dxcc');
|
|
|
|
$bandslots_list = "'".implode("','",$bandslots)."'";
|
|
|
|
$sql .= " and thcv.col_band in (" . $bandslots_list . ")" .
|
|
" and thcv.col_prop_mode !='SAT'";
|
|
} else {
|
|
$sql .= " and thcv.col_prop_mode !='SAT'";
|
|
$sql .= " and thcv.col_band ='" . $band . "'";
|
|
}
|
|
|
|
if ($postdata['mode'] != 'All') {
|
|
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
|
}
|
|
|
|
$sql .= $this->addQslToQuery($postdata);
|
|
|
|
|
|
if ($postdata['includedeleted'] == NULL) {
|
|
$sql .= " and d.end is null";
|
|
}
|
|
|
|
$sql .= $this->addContinentsToQuery($postdata);
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
return $query->result();
|
|
}
|
|
|
|
function lookup_country($country) {
|
|
$query = $this->db->query('
|
|
SELECT *
|
|
FROM dxcc_entities
|
|
WHERE name = "'.$country.'"
|
|
ORDER BY LENGTH( prefix ) DESC
|
|
LIMIT 1
|
|
');
|
|
|
|
return $query->row();
|
|
}
|
|
}
|
|
?>
|