diff --git a/application/config/migration.php b/application/config/migration.php index 09355286..49ca7587 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -4,7 +4,7 @@ | Enable/Disable Migrations |-------------------------------------------------------------------------- | -| Migrations are disabled by default but should be enabled +| Migrations are disabled by default but should be enabled | whenever you intend to do a schema migration. | */ @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 62; +$config['migration_version'] = 63; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Contesting.php b/application/controllers/Contesting.php index c466a08d..b9996ccb 100644 --- a/application/controllers/Contesting.php +++ b/application/controllers/Contesting.php @@ -13,7 +13,7 @@ class Contesting extends CI_Controller { { parent::__construct(); $this->lang->load('contesting'); - + $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } } @@ -26,13 +26,14 @@ class Contesting extends CI_Controller { $this->load->model('logbook_model'); $this->load->model('user_model'); $this->load->model('modes'); + $this->load->model('contesting_model'); $data['active_station_profile'] = $this->stations->find_active(); $data['notice'] = false; $data['stations'] = $this->stations->all(); $data['radios'] = $this->cat->radios(); - $data['dxcc'] = $this->logbook_model->fetchDxcc(); $data['modes'] = $this->modes->active(); + $data['contestnames'] = $this->contesting_model->getActivecontests(); $this->load->library('form_validation'); @@ -71,4 +72,90 @@ class Contesting extends CI_Controller { return json_encode($data); } -} \ No newline at end of file + + public function create() + { + $this->load->model('Contesting_model'); + $this->load->library('form_validation'); + + $this->form_validation->set_rules('name', 'Contest Name', 'required'); + $this->form_validation->set_rules('adifname', 'Contest Adif Name', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $data['page_title'] = "Create Mode"; + $this->load->view('contesting/create', $data); + } + else + { + $this->Contesting_model->add(); + } + } + + public function add() { + $this->load->model('Contesting_model'); + + $data['contests'] = $this->Contesting_model->getAllContests(); + + // Render Page + $data['page_title'] = "Contests"; + $this->load->view('interface_assets/header', $data); + $this->load->view('contesting/add'); + $this->load->view('interface_assets/footer'); + } + + public function edit($id) + { + $this->load->library('form_validation'); + + $this->load->model('Contesting_model'); + + $item_id_clean = $this->security->xss_clean($id); + + $data['contest'] = $this->Contesting_model->contest($item_id_clean); + + $data['page_title'] = "Edit Contest"; + + $this->form_validation->set_rules('name', 'Contest Name', 'required'); + $this->form_validation->set_rules('adifname', 'Adif Contest Name', 'required'); + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('interface_assets/header', $data); + $this->load->view('contesting/edit'); + $this->load->view('interface_assets/footer'); + } + else + { + $this->Contesting_model->edit($item_id_clean); + + $data['notice'] = "Contest ".$this->security->xss_clean($this->input->post('name', true))." Updated"; + + redirect('contesting/add'); + } + } + + public function delete() { + $id = $this->input->post('id'); + $this->load->model('Contesting_model'); + $this->Contesting_model->delete($id); + } + + public function activate() { + $id = $this->input->post('id'); + $this->load->model('Contesting_model'); + $this->Contesting_model->activate($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } + + public function deactivate() { + $id = $this->input->post('id'); + $this->load->model('Contesting_model'); + $this->Contesting_model->deactivate($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } +} diff --git a/application/migrations/063_add_contest_table.php b/application/migrations/063_add_contest_table.php new file mode 100644 index 00000000..24444d07 --- /dev/null +++ b/application/migrations/063_add_contest_table.php @@ -0,0 +1,243 @@ +db->query("create table contest (id integer not null auto_increment, name varchar(256), adifname varchar(256), active integer default 1, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); + + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Other','Other',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS Great Pumpkin Sprint','070-160M-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS Three Day Weekend','070-3-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS 31 Flavors','070-31-FLAVORS',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS 40m Firecracker Sprint','070-40M-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS 80m Jay Hudak Memorial Sprint','070-80M-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS PSKFest','070-PSKFEST',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS St. Patricks Day','070-ST-PATS-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PODXS Valentine Sprint','070-VALENTINE-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ten-Meter RTTY Contest (2011 onwards)','10-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Open Season Ten Meter QSO Party','1010-OPEN-SEASON',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('7th-Area QSO Party','7QP',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Alabama QSO Party','AL-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('JARL All Asian DX Contest (CW)','ALL-ASIAN-DX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('JARL All Asian DX Contest (PHONE)','ALL-ASIAN-DX-PHONE',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ANARTS WW RTTY','ANARTS-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Anatolian WW RTTY','ANATOLIAN-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Asia - Pacific Sprint','AP-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Arkansas QSO Party','AR-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARI DX Contest','ARI-DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL 10 Meter Contest','ARRL-10',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL 10 GHz and Up Contest','ARRL-10-GHZ',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL 160 Meter Contest','ARRL-160',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL 222 MHz and Up Distance Contest','ARRL-222',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL International DX Contest (CW)','ARRL-DX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL International DX Contest (Phone)','ARRL-DX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL EME contest','ARRL-EME',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL Field Day','ARRL-FIELD-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL Rookie Roundup (CW)','ARRL-RR-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL Rookie Roundup (RTTY)','ARRL-RR-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL Rookie Roundup (Phone)','ARRL-RR-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL RTTY Round-Up','ARRL-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL School Club Roundup','ARRL-SCR',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL November Sweepstakes (CW)','ARRL-SS-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL November Sweepstakes (Phone)','ARRL-SS-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL August UHF Contest','ARRL-UHF-AUG',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL January VHF Sweepstakes','ARRL-VHF-JAN',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL June VHF QSO Party','ARRL-VHF-JUN',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('ARRL September VHF QSO Party','ARRL-VHF-SEP',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Arizona QSO Party','AZ-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('BARTG Spring RTTY Contest','BARTG-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('BARTG Sprint Contest','BARTG-SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('British Columbia QSO Party','BC-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('California QSO Party','CA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CIS DX Contest','CIS-DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Colorado QSO Party','CO-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW 160 Meter DX Contest (CW)','CQ-160-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW 160 Meter DX Contest (SSB)','CQ-160-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ-M International DX Contest','CQ-M',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ World-Wide VHF Contest','CQ-VHF',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW WPX Contest (CW)','CQ-WPX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ/RJ WW RTTY WPX Contest','CQ-WPX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW WPX Contest (SSB)','CQ-WPX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW DX Contest (CW)','CQ-WW-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ/RJ WW RTTY DX Contest','CQ-WW-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CQ WW DX Contest (SSB)','CQ-WW-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Connecticut QSO Party','CT-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Concurso Verde e Amarelo DX CW Contest','CVA-DX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Concurso Verde e Amarelo DX SSB Contest','CVA-DX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CWops CW Open Competition','CWOPS-CW-OPEN',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('CWops Mini-CWT Test','CWOPS-CWT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WAE DX Contest (CW)','DARC-WAEDC-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WAE DX Contest (RTTY)','DARC-WAEDC-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WAE DX Contest (SSB)','DARC-WAEDC-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('DARC Worked All Germany','DARC-WAG',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Delaware QSO Party','DE-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('DL-DX RTTY Contest','DL-DX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('DMC RTTY Contest','DMC-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Concurso Nacional de Telegrafía','EA-CNCW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Municipios Españoles','EA-DME',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('EA PSK63','EA-PSK63',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Unión de Radioaficionados Españoles RTTY Contest','EA-RTTY (import-only)',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Su Majestad El Rey de España - CW','EA-SMRE-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Su Majestad El Rey de España - SSB','EA-SMRE-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Atlántico V-UHF','EA-VHF-ATLANTIC',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Combinado de V-UHF','EA-VHF-COM',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Costa del Sol V-UHF','EA-VHF-COSTA-SOL',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Nacional VHF','EA-VHF-EA',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Segovia EA1RCS V-UHF','EA-VHF-EA1RCS',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('QSL V-UHF & 50MHz','EA-VHF-QSL',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Sant Sadurni V-UHF','EA-VHF-SADURNI',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Unión de Radioaficionados Españoles RTTY Contest','EA-WW-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PSK63 QSO Party','EPC-PSK63',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('EU Sprint','EU Sprint',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('EU HF Championship','EU-HF',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('EU PSK DX Contest','EU-PSK-DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('European CW Association 160m CW Party','EUCW160M',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('FISTS Fall Sprint','FALL SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Florida QSO Party','FL-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Georgia QSO Party','GA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Hungarian DX Contest','HA-DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Helvetia Contest','HELVETIA',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Hawaiian QSO Party','HI-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('IARC Holyland Contest','HOLYLAND',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Iowa QSO Party','IA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('DARC IARU Region 1 Field Day','IARU-FIELD-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('IARU HF World Championship','IARU-HF',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Idaho QSO Party','ID-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Illinois QSO Party','IL QSO Party',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Indiana QSO Party','IN-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('JARTS WW RTTY','JARTS-WW-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Japan International DX Contest (CW)','JIDX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Japan International DX Contest (SSB)','JIDX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Mongolian RTTY DX Contest','JT-DX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Kansas QSO Party','KS-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Kentucky QSO Party','KY-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Louisiana QSO Party','LA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('DRCG Long Distance Contest (RTTY)','LDC-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('LZ DX Contest','LZ DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Maritimes QSO Party','MAR-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Maryland QSO Party','MD-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Maine QSO Party','ME-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Michigan QSO Party','MI-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Mid-Atlantic QSO Party','MIDATLANTIC-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Minnesota QSO Party','MN-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Missouri QSO Party','MO-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Mississippi QSO Party','MS-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Montana QSO Party','MT-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America Sprint (CW)','NA-SPRINT-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America Sprint (RTTY)','NA-SPRINT-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America Sprint (Phone)','NA-SPRINT-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America QSO Party (CW)','NAQP-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America QSO Party (RTTY)','NAQP-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North America QSO Party (Phone)','NAQP-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North Carolina QSO Party','NC-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('North Dakota QSO Party','ND-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Nebraska QSO Party','NE-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('New England QSO Party','NEQP',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('New Hampshire QSO Party','NH-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('New Jersey QSO Party','NJ-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('New Mexico QSO Party','NM-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('NRAU-Baltic Contest (CW)','NRAU-BALTIC-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('NRAU-Baltic Contest (SSB)','NRAU-BALTIC-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Nevada QSO Party','NV-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('New York QSO Party','NY-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Oceania DX Contest (CW)','OCEANIA-DX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Oceania DX Contest (SSB)','OCEANIA-DX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ohio QSO Party','OH-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Czech Radio Club OK DX Contest','OK-DX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Czech Radio Club OK-OM DX Contest','OK-OM-DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Oklahoma QSO Party','OK-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Old Man International Sideband Society QSO Party','OMISS-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ontario QSO Party','ON-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Oregon QSO Party','OR-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Pennsylvania QSO Party','PA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Dutch PACC Contest','PACC',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('MDXA PSK DeathMatch (2005-2010)','PSK-DEATHMATCH',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Quebec QSO Party','QC-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Canadian Amateur Radio Society Contest','RAC (import-only)',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('RAC Canada Day Contest','RAC-CANADA-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('RAC Canada Winter Contest','RAC-CANADA-WINTER',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Russian District Award Contest','RDAC',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Russian DX Contest','RDXC',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Reseau des Emetteurs Francais 160m Contest','REF-160M',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Reseau des Emetteurs Francais Contest (CW)','REF-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Reseau des Emetteurs Francais Contest (SSB)','REF-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Rede dos Emissores Portugueses Portugal Day HF Contest','REP-PORTUGAL-DAY-HF',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Rhode Island QSO Party','RI-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('1.8MHz Contest','RSGB-160',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('21/28 MHz Contest (CW)','RSGB-21/28-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('21/28 MHz Contest (SSB)','RSGB-21/28-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('80m Club Championships','RSGB-80M-CC',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Affiliated Societies Team Contest (CW)','RSGB-AFS-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Affiliated Societies Team Contest (SSB)','RSGB-AFS-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Club Calls','RSGB-CLUB-CALLS',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Commonwealth Contest','RSGB-COMMONWEALTH',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('IOTA Contest','RSGB-IOTA',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Low Power Field Day','RSGB-LOW-POWER',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('National Field Day','RSGB-NFD',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('RoPoCo','RSGB-ROPOCO',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SSB Field Day','RSGB-SSB-FD',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Russian Radio RTTY Worldwide Contest','RUSSIAN-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Scandinavian Activity Contest (CW)','SAC-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Scandinavian Activity Contest (SSB)','SAC-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SARTG WW RTTY','SARTG-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('South Carolina QSO Party','SC-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SCC RTTY Championship','SCC-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('South Dakota QSO Party','SD-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SSA Portabeltest','SMP-AUG',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SSA Portabeltest','SMP-MAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('PRC SPDX Contest (RTTY)','SP-DX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SPAR Winter Field Day','SPAR-WINTER-FD',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('SP DX Contest','SPDXContest',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('FISTS Spring Sprint','SPRING SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Scottish-Russian Marathon','SR-MARATHON',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Stew Perry Topband Distance Challenge','STEW-PERRY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('FISTS Summer Sprint','SUMMER SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('TARA Grid Dip PSK-RTTY Shindig','TARA-GRID-DIP',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('TARA RTTY Mêlée','TARA-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('TARA Rumble PSK Contest','TARA-RUMBLE',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('TARA Skirmish Digital Prefix Contest','TARA-SKIRMISH',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ten-Meter RTTY Contest (before 2011)','TEN-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('The Makrothen Contest','TMC-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Tennessee QSO Party','TN-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Texas QSO Party','TX-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('UBA Contest (CW)','UBA-DX-CW',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('UBA Contest (SSB)','UBA-DX-SSB',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('European PSK Club BPSK63 Contest','UK-DX-BPSK63',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('UK DX RTTY Contest','UK-DX-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Open Ukraine RTTY Championship','UKR-CHAMP-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ukrainian DX','UKRAINIAN DX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('UKSMG 6m Marathon','UKSMG-6M-MARATHON',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('UKSMG Summer Es Contest','UKSMG-SUMMER-ES',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Ukrainian DX Contest','URE-DX (import-only)',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Mobile Amateur Awards Club','US-COUNTIES-QSO',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Utah QSO Party','UT-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Virginia QSO Party','VA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('RCV Venezuelan Independence Day Contest','VENEZ-IND-DAY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Virginia QSO Party','VIRGINIA QSO PARTY (import-only)',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Alessandro Volta RTTY DX Contest','VOLTA-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Washington QSO Party','WA-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Wisconsin QSO Party','WI-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA Harry Angel Memorial 80m Sprint','WIA-HARRY ANGEL',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA John Moyle Memorial Field Day','WIA-JMMFD',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA Oceania DX (OCDX) Contest','WIA-OCDX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA Remembrance Day','WIA-REMEMBRANCE',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA Ross Hull Memorial VHF/UHF Contest','WIA-ROSS HULL',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA Trans Tasman Low Bands Challenge','WIA-TRANS TASMAN',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA VHF UHF Field Days','WIA-VHF/UHF FD',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('WIA VK Shires','WIA-VK SHIRES',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('FISTS Winter Sprint','WINTER SPRINT',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('West Virginia QSO Party','WV-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('World Wide Digi DX Contest','WW-DIGI',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Wyoming QSO Party','WY-QSO-PARTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('Mexico International Contest (RTTY)','XE-INTL-RTTY',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('YODX HF contest','YOHFDX',1);"); + $this->db->query("INSERT INTO contest (name, adifname, active) values ('YU DX Contest','YUDXC',1);"); + } + + public function down(){ + $this->db->query(""); + + } +} diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php index 5a0b022a..1b6d60d8 100644 --- a/application/models/Contesting_model.php +++ b/application/models/Contesting_model.php @@ -32,4 +32,91 @@ class Contesting_model extends CI_Model { header('Content-Type: application/json'); echo json_encode($data->result()); } -} \ No newline at end of file + + function getActivecontests() { + + $sql = "SELECT name, adifname FROM contest WHERE active = 1 ORDER BY name ASC"; + + $data = $this->db->query($sql); + + return($data->result_array()); + } + + function getAllContests() { + + $sql = "SELECT id, name, adifname, active FROM contest ORDER BY name ASC"; + + $data = $this->db->query($sql); + + return($data->result_array()); + } + + function delete($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + // Delete Contest + $this->db->delete('contest', array('id' => $clean_id)); + } + + function activate($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + $data = array( + 'active' => '1', + ); + + $this->db->where('id', $clean_id); + + $this->db->update('contest', $data); + + return true; + } + + function deactivate($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + $data = array( + 'active' => '0', + ); + + $this->db->where('id', $clean_id); + + $this->db->update('contest', $data); + + return true; + } + + function add() { + $data = array( + 'name' => xss_clean($this->input->post('name', true)), + 'adifname' => xss_clean($this->input->post('adifname', true)), + ); + + $this->db->insert('contest', $data); + } + + function contest($id) { + // Clean ID + $clean_id = $this->security->xss_clean($id); + + $sql = "SELECT id, name, adifname, active FROM contest where id =" . $clean_id; + + $data = $this->db->query($sql); + + return ($data->row()); + } + + function edit($id) { + $data = array( + 'name' => xss_clean($this->input->post('name', true)), + 'adifname' => xss_clean($this->input->post('adifname', true)), + 'active' => xss_clean($this->input->post('active', true)), + ); + + $this->db->where('id', $id); + $this->db->update('contest', $data); + } +} diff --git a/application/views/contesting/add.php b/application/views/contesting/add.php new file mode 100644 index 00000000..661b6830 --- /dev/null +++ b/application/views/contesting/add.php @@ -0,0 +1,64 @@ +
+ Using the contest list, you can control which Contests are shown when logging QSOs in a contest. +
++ Active contests will be shown in the Contest Name drop-down, while inactive contests will be hidden and cannot be selected. +
+| Name | +Adif mode | +Active | ++ | + | + |
|---|---|---|---|---|---|
| + | + | '> | ++ Deactivate"; + } else { + echo ""; + };?> + | ++ " class="btn btn-outline-primary btn-sm"> Edit + | ++ Delete + | +
| lang->line('gen_hamradio_exchange_recv_short'); ?> | - +
|---|