Merge pull request #2747 from AndreasK79/waja_award

[Awards] Added WAJA
This commit is contained in:
Andreas Kristiansen 2023-11-30 11:02:03 +01:00 committed by GitHub
commit f83c88d4c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 859 additions and 99 deletions

View File

@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
$config['migration_version'] = 155;
$config['migration_version'] = 156;
/*
|--------------------------------------------------------------------------

View File

@ -167,6 +167,80 @@ class Awards extends CI_Controller {
$this->load->view('interface_assets/footer');
}
public function waja () {
$footerData = [];
$footerData['scripts'] = [
'assets/js/sections/wajamap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wajamap.js"))
];
$this->load->model('waja');
$this->load->model('modes');
$this->load->model('bands');
$data['worked_bands'] = $this->bands->get_worked_bands('waja');
$data['modes'] = $this->modes->active();
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->security->xss_clean($this->input->post('qsl'));
$postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw'));
$postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl'));
$postdata['worked'] = $this->security->xss_clean($this->input->post('worked'));
$postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed'));
$postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked'));
$postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted'));
$postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa'));
$postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia'));
$postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe'));
$postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica'));
$postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica'));
$postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania'));
$postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica'));
$postdata['band'] = $this->security->xss_clean($this->input->post('band'));
$postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
}
else { // Setting default values at first load of page
$postdata['qsl'] = 1;
$postdata['lotw'] = 1;
$postdata['eqsl'] = 0;
$postdata['worked'] = 1;
$postdata['confirmed'] = 1;
$postdata['notworked'] = 1;
$postdata['includedeleted'] = 0;
$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';
}
$data['waja_array'] = $this->waja->get_waja_array($bands, $postdata);
$data['waja_summary'] = $this->waja->get_waja_summary($bands, $postdata);
// Render Page
$data['page_title'] = "Awards - WAJA";
$this->load->view('interface_assets/header', $data);
$this->load->view('awards/waja/index');
$this->load->view('interface_assets/footer');
}
public function vucc() {
$this->load->model('vucc');
$this->load->model('bands');

View File

@ -1,93 +1,94 @@
<?php
defined('BASEPATH') OR exit('Не е разрешен директен достъп до скрипта');
$lang['menu_badge_developer_mode'] = 'Developer Mode';
$lang['menu_logbook'] = 'Logbook';
$lang['menu_overview'] = 'Overview';
$lang['menu_advanced'] = 'Advanced';
$lang['menu_qso'] = 'QSO';
$lang['menu_live_qso'] = 'Live QSO';
$lang['menu_post_qso'] = 'Post QSO';
$lang['menu_fast_log_entry'] = "Simple Fast Log Entry";
$lang['menu_live_contest_logging'] = 'Live Contest Logging';
$lang['menu_post_contest_logging'] = 'Post Contest Logging';
$lang['menu_bandmap'] = 'Bandmap';
$lang['menu_view_qsl'] = 'View QSL Cards';
$lang['menu_view_eqsl'] = 'View eQSL Cards';
$lang['menu_notes'] = 'Notes';
$lang['menu_analytics'] = 'Analytics';
$lang['menu_statistics'] = 'Statistics';
$lang['menu_gridsquares'] = 'Gridsquares';
$lang['menu_gridmap'] = 'Gridsquare Map';
$lang['menu_activated_gridsquares'] = 'Activated Gridsquares';
$lang['menu_gridsquare_activators'] = 'Gridsquare Activators';
$lang['menu_distances_worked'] = 'Distances Worked';
$lang['menu_days_with_qsos'] = 'Days with QSOs';
$lang['menu_timeline'] = 'Timeline';
$lang['menu_accumulated_statistics'] = 'Accumulated Statistics';
$lang['menu_timeplotter'] = 'Timeplotter';
$lang['menu_custom_maps'] = 'Custom Maps';
$lang['menu_continents'] = 'Continents';
$lang['menu_awards'] = 'Awards';
$lang['menu_cq'] = 'CQ';
$lang['menu_dok'] = 'DOK';
$lang['menu_dxcc'] = 'DXCC';
$lang['menu_iota'] = 'IOTA';
$lang['menu_pota'] = 'POTA';
$lang['menu_sig'] = 'SIG';
$lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';
$lang['menu_admin'] = 'Admin';
$lang['menu_user_account'] = 'User Accounts';
$lang['menu_global_options'] = 'Global Options';
$lang['menu_modes'] = 'Modes';
$lang['menu_contests'] = 'Contests';
$lang['menu_themes'] = 'Themes';
$lang['menu_backup'] = 'Backup';
$lang['menu_update_country_files'] = 'Update Country Files';
$lang['menu_debug_information'] = 'Debug Information';
$lang['menu_search_text'] = 'Search Callsign';
$lang['menu_search_text_quicklog'] = "Add/Search Callsign";
$lang['menu_search_button'] = 'Search';
$lang['menu_search_button_qicksearch_log'] = "Log";
$lang['menu_login_button'] = 'Login';
$lang['menu_account'] = 'Account';
$lang['menu_station_logbooks'] = 'Station Logbooks';
$lang['menu_station_locations'] = 'Station Locations';
$lang['menu_bands'] = 'Bands';
$lang['menu_adif_import_export'] = 'ADIF Import / Export';
$lang['menu_kml_export'] = 'KML Export';
$lang['menu_dx_atlas_gridsquare_export'] = 'DX Atlas Gridsquare Export';
$lang['menu_sota_csv_export'] = 'SOTA CSV Export';
$lang['menu_cabrillo_export'] = 'Cabrillo Export';
$lang['menu_oqrs_requests'] = 'OQRS Requests';
$lang['menu_print_requested_qsls'] = 'Print Requested QSLs';
$lang['menu_labels'] = 'Labels';
$lang['menu_logbook_of_the_world'] = 'Logbook of the World';
$lang['menu_eqsl_import_export'] = 'eQSL Import / Export';
$lang['menu_qrz_logbook'] = 'QRZ Logbook';
$lang['menu_hrd_logbook'] = 'HRDLog Logbook';
$lang['menu_qo_100_dx_club_upload'] = 'QO-100 Dx Club Upload';
$lang['menu_api_keys'] = 'API Keys';
$lang['menu_hardware_interfaces'] = 'Hardware Interfaces';
$lang['menu_help'] = 'Help';
$lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_ffma'] = "Fred Fish Memorial Award";
$lang['menu_ja_gridmaster'] = 'JA Gridmaster';
$lang['menu_maintenance']='Maintenance';
<?php
defined('BASEPATH') OR exit('Не е разрешен директен достъп до скрипта');
$lang['menu_badge_developer_mode'] = 'Developer Mode';
$lang['menu_logbook'] = 'Logbook';
$lang['menu_overview'] = 'Overview';
$lang['menu_advanced'] = 'Advanced';
$lang['menu_qso'] = 'QSO';
$lang['menu_live_qso'] = 'Live QSO';
$lang['menu_post_qso'] = 'Post QSO';
$lang['menu_fast_log_entry'] = "Simple Fast Log Entry";
$lang['menu_live_contest_logging'] = 'Live Contest Logging';
$lang['menu_post_contest_logging'] = 'Post Contest Logging';
$lang['menu_bandmap'] = 'Bandmap';
$lang['menu_view_qsl'] = 'View QSL Cards';
$lang['menu_view_eqsl'] = 'View eQSL Cards';
$lang['menu_notes'] = 'Notes';
$lang['menu_analytics'] = 'Analytics';
$lang['menu_statistics'] = 'Statistics';
$lang['menu_gridsquares'] = 'Gridsquares';
$lang['menu_gridmap'] = 'Gridsquare Map';
$lang['menu_activated_gridsquares'] = 'Activated Gridsquares';
$lang['menu_gridsquare_activators'] = 'Gridsquare Activators';
$lang['menu_distances_worked'] = 'Distances Worked';
$lang['menu_days_with_qsos'] = 'Days with QSOs';
$lang['menu_timeline'] = 'Timeline';
$lang['menu_accumulated_statistics'] = 'Accumulated Statistics';
$lang['menu_timeplotter'] = 'Timeplotter';
$lang['menu_custom_maps'] = 'Custom Maps';
$lang['menu_continents'] = 'Continents';
$lang['menu_awards'] = 'Awards';
$lang['menu_cq'] = 'CQ';
$lang['menu_dok'] = 'DOK';
$lang['menu_dxcc'] = 'DXCC';
$lang['menu_iota'] = 'IOTA';
$lang['menu_pota'] = 'POTA';
$lang['menu_sig'] = 'SIG';
$lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';
$lang['menu_admin'] = 'Admin';
$lang['menu_user_account'] = 'User Accounts';
$lang['menu_global_options'] = 'Global Options';
$lang['menu_modes'] = 'Modes';
$lang['menu_contests'] = 'Contests';
$lang['menu_themes'] = 'Themes';
$lang['menu_backup'] = 'Backup';
$lang['menu_update_country_files'] = 'Update Country Files';
$lang['menu_debug_information'] = 'Debug Information';
$lang['menu_search_text'] = 'Search Callsign';
$lang['menu_search_text_quicklog'] = "Add/Search Callsign";
$lang['menu_search_button'] = 'Search';
$lang['menu_search_button_qicksearch_log'] = "Log";
$lang['menu_login_button'] = 'Login';
$lang['menu_account'] = 'Account';
$lang['menu_station_logbooks'] = 'Station Logbooks';
$lang['menu_station_locations'] = 'Station Locations';
$lang['menu_bands'] = 'Bands';
$lang['menu_adif_import_export'] = 'ADIF Import / Export';
$lang['menu_kml_export'] = 'KML Export';
$lang['menu_dx_atlas_gridsquare_export'] = 'DX Atlas Gridsquare Export';
$lang['menu_sota_csv_export'] = 'SOTA CSV Export';
$lang['menu_cabrillo_export'] = 'Cabrillo Export';
$lang['menu_oqrs_requests'] = 'OQRS Requests';
$lang['menu_print_requested_qsls'] = 'Print Requested QSLs';
$lang['menu_labels'] = 'Labels';
$lang['menu_logbook_of_the_world'] = 'Logbook of the World';
$lang['menu_eqsl_import_export'] = 'eQSL Import / Export';
$lang['menu_qrz_logbook'] = 'QRZ Logbook';
$lang['menu_hrd_logbook'] = 'HRDLog Logbook';
$lang['menu_qo_100_dx_club_upload'] = 'QO-100 Dx Club Upload';
$lang['menu_api_keys'] = 'API Keys';
$lang['menu_hardware_interfaces'] = 'Hardware Interfaces';
$lang['menu_help'] = 'Help';
$lang['menu_forum'] = 'Forum';
$lang['menu_logout'] = 'Logout';
$lang['menu_ffma'] = "Fred Fish Memorial Award";
$lang['menu_ja_gridmaster'] = 'JA Gridmaster';
$lang['menu_maintenance']='Maintenance';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US okresy';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -47,6 +47,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'USA Osavaltiot';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -47,6 +47,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'USA:s grevskap';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -45,6 +45,7 @@ $lang['menu_sota'] = 'SOTA';
$lang['menu_us_counties'] = 'US Counties';
$lang['menu_us_gridmaster'] = 'US Gridmaster';
$lang['menu_vucc'] = 'VUCC';
$lang['menu_waja'] = 'WAJA';
$lang['menu_was'] = 'WAS';
$lang['menu_wwff'] = 'WWFF';

View File

@ -0,0 +1,23 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_waja_bandxuser extends CI_Migration
{
public function up()
{
$fields = array(
'waja TINYINT NOT NULL DEFAULT 1',
);
if (!$this->db->field_exists('waja', 'bandxuser')) {
$this->dbforge->add_column('bandxuser', $fields);
}
}
public function down()
{
if ($this->db->field_exists('waja', 'bandxuser')) {
$this->dbforge->drop_column('bandxuser', 'waja');
}
}
}

View File

@ -386,6 +386,10 @@ class Logbook_model extends CI_Model {
case 'DOK':
$this->db->where('COL_DARC_DOK', $searchphrase);
break;
case 'WAJA':
$this->db->where('COL_STATE', $searchphrase);
$this->db->where_in('COL_DXCC', ['339']);
break;
case 'QSLRDATE':
$this->db->where('date(COL_QSLRDATE)=date(SYSDATE())');
break;
@ -584,7 +588,7 @@ class Logbook_model extends CI_Model {
$this->mark_clublog_qsos_sent($last_id);
}
}
$result = '';
$result = $this->exists_hrdlog_code($data['station_id']);
// Push qso to hrdlog if code is set, and realtime upload is enabled, and we're not importing an adif-file
@ -738,7 +742,7 @@ class Logbook_model extends CI_Model {
} else {
$returner['status']=$response;
}
curl_close ($request);
curl_close ($request);
return ($returner);
}

402
application/models/Waja.php Normal file
View File

@ -0,0 +1,402 @@
<?php
class WAJA extends CI_Model {
public $jaPrefectures = array(
'01' => 'Hokkaido',
'02' => 'Aomori',
'03' => 'Iwate',
'04' => 'Akita',
'05' => 'Yamagata',
'06' => 'Miyagi',
'07' => 'Fukushima',
'08' => 'Niigata',
'09' => 'Nagano',
'10' => 'Tokyo',
'11' => 'Kanagawa',
'12' => 'Chiba',
'13' => 'Saitama',
'14' => 'Ibaraki',
'15' => 'Tochigi',
'16' => 'Gunma',
'17' => 'Yamanashi',
'18' => 'Shizuoka',
'19' => 'Gifu',
'20' => 'Aichi',
'21' => 'Mie',
'22' => 'Kyoto',
'23' => 'Shiga',
'24' => 'Nara',
'25' => 'Osaka',
'26' => 'Wakayama',
'27' => 'Hyogo',
'28' => 'Toyama',
'29' => 'Fukui',
'30' => 'Ishikawa',
'31' => 'Okayama',
'32' => 'Shimane',
'33' => 'Yamaguchi',
'34' => 'Tottori',
'35' => 'Hiroshima',
'36' => 'Kagawa',
'37' => 'Tokushima',
'38' => 'Ehime',
'39' => 'Kochi',
'40' => 'Fukuoka',
'41' => 'Saga',
'42' => 'Nagasaki',
'43' => 'Kumamoto',
'44' => 'Oita',
'45' => 'Miyazaki',
'46' => 'Kagoshima',
'47' => 'Okinawa');
public $prefectureString = '01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47';
function get_waja_array($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)."'";
$wajaArray = explode(',', $this->prefectureString);
$prefectures = array(); // Used for keeping track of which states that are not worked
$qsl = "";
if ($postdata['confirmed'] != NULL) {
if ($postdata['qsl'] != NULL ) {
$qsl .= "Q";
}
if ($postdata['lotw'] != NULL ) {
$qsl .= "L";
}
if ($postdata['eqsl'] != NULL ) {
$qsl .= "E";
}
}
foreach ($wajaArray as $state) { // Generating array for use in the table
$prefectures[$state]['count'] = 0; // Inits each state's count
}
foreach ($bands as $band) {
foreach ($wajaArray as $state) { // Generating array for use in the table
$bandWaja[$state]['Number'] = $state;
$bandWaja[$state]['Prefecture'] = $this->jaPrefectures[$state];
$bandWaja[$state][$band] = '-'; // Sets all to dash to indicate no result
}
if ($postdata['worked'] != NULL) {
$wajaBand = $this->getWajaWorked($location_list, $band, $postdata);
foreach ($wajaBand as $line) {
$bandWaja[$line->col_state][$band] = '<div class="bg-danger awardsBgDanger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAJA", "")\'>W</a></div>';
$prefectures[$line->col_state]['count']++;
}
}
if ($postdata['confirmed'] != NULL) {
$wajaBand = $this->getWajaConfirmed($location_list, $band, $postdata);
foreach ($wajaBand as $line) {
$bandWaja[$line->col_state][$band] = '<div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAJA", "'.$qsl.'")\'>C</a></div>';
$prefectures[$line->col_state]['count']++;
}
}
}
// We want to remove the worked states in the list, since we do not want to display them
if ($postdata['worked'] == NULL) {
$wajaBand = $this->getWajaWorked($location_list, $postdata['band'], $postdata);
foreach ($wajaBand as $line) {
unset($bandWaja[$line->col_state]);
}
}
// We want to remove the confirmed states in the list, since we do not want to display them
if ($postdata['confirmed'] == NULL) {
$wasBand = $this->getWajaConfirmed($location_list, $postdata['band'], $postdata);
foreach ($wasBand as $line) {
unset($bandWaja[$line->col_state]);
}
}
if ($postdata['notworked'] == NULL) {
foreach ($wajaArray as $state) {
if ($prefectures[$state]['count'] == 0) {
unset($bandWaja[$state]);
};
}
}
if (isset($bandWaja)) {
return $bandWaja;
}
else {
return 0;
}
}
function getWajaBandConfirmed($location_list, $band, $postdata) {
$sql = "select adif as waja, 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 getWajaBandWorked($location_list, $band, $postdata) {
$sql = "select adif as waja, 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 returns all worked, but not confirmed states
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getWajaWorked($location_list, $band, $postdata) {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ")";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addStateToQuery();
$sql .= $this->addBandToQuery($band);
$sql .= " and not exists (select 1 from ". $this->config->item('table_name') .
" where station_id in (". $location_list . ")" .
" and col_state = thcv.col_state";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);
$sql .= $this->addStateToQuery();
$sql .= ")";
$query = $this->db->query($sql);
return $query->result();
}
/*
* Function returns all confirmed states on given band and on LoTW or QSL
* $postdata contains data from the form, in this case Lotw or QSL are used
*/
function getWajaConfirmed($location_list, $band, $postdata) {
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
where station_id in (" . $location_list . ")";
if ($postdata['mode'] != 'All') {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
$sql .= $this->addStateToQuery();
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($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['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'");
}
$sql .= implode(' or ', $qsl);
$sql .= ')';
}
return $sql;
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
function get_waja_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);
$wajaSummary['worked'][$band] = $worked[0]->count;
$wajaSummary['confirmed'][$band] = $confirmed[0]->count;
}
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
$wajaSummary['worked']['Total'] = $workedTotal[0]->count;
$wajaSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
return $wajaSummary;
}
function getSummaryByBand($band, $postdata, $location_list)
{
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
$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('was');
$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->addStateToQuery();
$query = $this->db->query($sql);
return $query->result();
}
function getSummaryByBandConfirmed($band, $postdata, $location_list)
{
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
$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('was');
$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);
$sql .= $this->addStateToQuery();
$query = $this->db->query($sql);
return $query->result();
}
function addStateToQuery() {
$sql = '';
$sql .= " and COL_DXCC in ('339')";
$sql .= " and COL_STATE in ($this->prefectureString)";
return $sql;
}
}
?>

View File

@ -0,0 +1,206 @@
<style>
#dxccmap {
height: calc(100vh - 500px) !important;
max-height: 900px !important;
}
/*Legend specific*/
.legend {
padding: 6px 8px;
font: 14px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255, 255, 255, 0.8);
line-height: 24px;
color: #555;
}
.legend h4 {
text-align: center;
font-size: 16px;
margin: 2px 12px 8px;
color: #777;
}
.legend span {
position: relative;
bottom: 3px;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin: 0 8px 0 0;
opacity: 0.7;
}
</style>
<div class="container">
<!-- Award Info Box -->
<br>
<div id="awardInfoButton">
<h2><?php echo $page_title; ?></h2>
</div>
<!-- End of Award Info Box -->
<form class="form" action="<?php echo site_url('awards/waja'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<div class="mb-3 row">
<div class="col-md-2" for="checkboxes">Worked / Confirmed</div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="worked" id="worked" value="1" <?php if ($this->input->post('worked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="worked">Show worked</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="confirmed" id="confirmed" value="1" <?php if ($this->input->post('confirmed') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="confirmed">Show confirmed</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="notworked" id="notworked" value="1" <?php if ($this->input->post('notworked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="notworked">Show not worked</label>
</div>
</div>
</div>
<div class="mb-3 row">
<div class="col-md-2">QSL Type</div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qsl" value="1" id="qsl" <?php if ($this->input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qsl">QSL</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="lotw" value="1" id="lotw" <?php if ($this->input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="lotw">LoTW</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="eqsl" value="1" id="eqsl" <?php if ($this->input->post('eqsl')) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="eqsl">eQSL</label>
</div>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="band">Band</label>
<div class="col-md-2">
<select id="band2" name="band" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> >Every band</option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
if ($this->input->post('band') == $band) echo ' selected';
echo '>' . $band . '</option>'."\n";
} ?>
</select>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="mode">Mode</label>
<div class="col-md-2">
<select id="mode" name="mode" class="form-select form-select-sm">
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>>All</option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode') == $mode->mode) echo ' selected';
echo '>'. $mode->mode . '</option>'."\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode') == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>'."\n";
}
}
?>
</select>
</div>
</div>
<div class="mb-3 row">
<label class="col-md-2 control-label" for="button1id"></label>
<div class="col-md-10">
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary">Show</button>
</div>
</div>
</fieldset>
</form>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="table-tab" data-bs-toggle="tab" href="#table" role="tab" aria-controls="table" aria-selected="true">Table</a>
</li>
</ul>
<br />
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade" id="dxccmaptab" role="tabpanel" aria-labelledby="home-tab">
<br />
<div id="dxccmap"></div>
</div>
<div class="tab-pane fade show active" id="table" role="tabpanel" aria-labelledby="table-tab">
<?php
$i = 1;
if ($waja_array) {
echo '
<table style="width:100%" class="table-sm table tablewaja table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>
<td>Number</td>
<td>Prefecture</td>';
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '</tr>
</thead>
<tbody>';
foreach ($waja_array as $dxcc => $value) { // Fills the table with the data
echo '<tr>';
foreach ($value as $name => $key) {
echo '<td style="text-align: center">' . $key . '</td>';
}
echo '</tr>';
}
echo '</table>
<h2>Summary</h2>
<table class="table-sm tablesummary table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr><td></td>';
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '<td>Total</td>
</tr>
</thead>
<tbody>
<tr><td>Total worked</td>';
foreach ($waja_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr><tr>
<td>Total confirmed</td>';
foreach ($waja_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr>
</table>
</div>';
}
else {
echo '<div class="alert alert-danger" role="alert"><a href="#" class="btn-close" data-bs-dismiss="alert" aria-label="close">&times;</a>Nothing found!</div>';
}
?>
</div>
</div>
</div>

View File

@ -12,7 +12,7 @@
</script>
<script>
/*
/*
General Language
*/
var lang_general_word_qso_data = "<?php echo lang('general_word_qso_data'); ?>";
@ -78,7 +78,7 @@ function load_was_map() {
type: 'POST',
});
});
</script>
<?php } ?>
@ -761,7 +761,7 @@ function showActivatorsMap(call, count, grids) {
<?php if ($this->uri->segment(1) == "" || $this->uri->segment(1) == "dashboard" ) { ?>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script>
<script id="leafembed" type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js" tileUrl="<?php echo $this->optionslib->get_option('option_map_tile_server');?>"></script>
<script type="text/javascript">
$(function () {
$('[data-bs-toggle="tooltip"]').tooltip()
@ -1918,6 +1918,40 @@ $(document).ready(function(){
</script>
<?php } ?>
<?php if ($this->uri->segment(2) == "waja") { ?>
<script>
$('.tablewaja').DataTable({
"pageLength": 25,
responsive: false,
ordering: false,
"scrollY": "400px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
dom: 'Bfrtip',
buttons: [
'csv'
]
});
$('.tablesummary').DataTable({
info: false,
searching: false,
ordering: false,
"paging": false,
dom: 'Bfrtip',
buttons: [
'csv'
]
});
// change color of csv-button if dark mode is chosen
if (isDarkModeTheme()) {
$(".buttons-csv").css("color", "white");
}
</script>
<?php } ?>
<?php if ($this->uri->segment(2) == "vucc_band") { ?>
<script>
$('.tablevucc').DataTable({

View File

@ -161,6 +161,8 @@
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/vucc'); ?>"><i class="fas fa-trophy"></i> <?php echo lang('menu_vucc'); ?></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/waja'); ?>"><i class="fas fa-trophy"></i> <?php echo lang('menu_waja'); ?></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/was'); ?>"><i class="fas fa-trophy"></i> <?php echo lang('menu_was'); ?></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('awards/wwff'); ?>"><i class="fas fa-trophy"></i> <?php echo lang('menu_wwff'); ?></a>