From a48858acda39401e0a3eab0d7405a440093ae3de Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:30:12 +0200 Subject: [PATCH] [Cabrillo export] Added more info to the form --- application/controllers/Cabrillo.php | 31 +++-- application/libraries/Cabrilloformat.php | 24 +++- application/views/cabrillo/export.php | 4 +- application/views/cabrillo/index.php | 139 +++++++++++++++++++++++ assets/js/sections/cabrillo.js | 7 +- 5 files changed, 192 insertions(+), 13 deletions(-) diff --git a/application/controllers/Cabrillo.php b/application/controllers/Cabrillo.php index d23e5a87..4d02e015 100644 --- a/application/controllers/Cabrillo.php +++ b/application/controllers/Cabrillo.php @@ -78,6 +78,8 @@ class Cabrillo extends CI_Controller { $this->load->model('stations'); + $this->load->model('user_model'); + $station_id = $this->security->xss_clean($this->input->post('station_id')); $contest_id = $this->security->xss_clean($this->input->post('contestid')); @@ -88,18 +90,33 @@ class Cabrillo extends CI_Controller { $station = $station->row(); + $userinfo = $this->user_model->get_by_id($this->session->userdata('user_id')); + + $userinfo = $userinfo->row(); + $data['qsos'] = $this->Contesting_model->export_custom($from, $to, $contest_id, $station_id); $data['contest_id'] = $contest_id; $data['callsign'] = $station->station_callsign; $data['claimed_score'] = ''; - $data['operators'] = ''; - $data['club'] = ''; - $data['name'] = ''; - $data['address1'] = ''; - $data['address2'] = ''; - $data['address3'] = ''; - $data['soapbox'] = ''; + $data['categoryoperator'] = $this->security->xss_clean($this->input->post('categoryoperator')); + $data['categoryassisted'] = $this->security->xss_clean($this->input->post('categoryassisted')); + $data['categoryband'] = $this->security->xss_clean($this->input->post('categoryband')); + $data['categorymode'] = $this->security->xss_clean($this->input->post('categorymode')); + $data['categorypower'] = $this->security->xss_clean($this->input->post('categorypower')); + $data['categorystation'] = $this->security->xss_clean($this->input->post('categorystation')); + $data['categorytransmitter'] = $this->security->xss_clean($this->input->post('categorytransmitter')); + $data['categoryoverlay'] = $this->security->xss_clean($this->input->post('categoryoverlay')); + $data['operators'] = $this->security->xss_clean($this->input->post('operators')); + $data['club'] = $this->security->xss_clean($this->input->post('club')); + $data['name'] = $userinfo->user_firstname . ' ' . $userinfo->user_lastname; + $data['email'] = $userinfo->user_email; + $data['address'] = $this->security->xss_clean($this->input->post('address')); + $data['addresscity'] = $this->security->xss_clean($this->input->post('addresscity')); + $data['addressstateprovince'] = $this->security->xss_clean($this->input->post('addressstateprovince')); + $data['addresspostalcode'] = $this->security->xss_clean($this->input->post('addresspostalcode')); + $data['addresscountry'] = $this->security->xss_clean($this->input->post('addresscountry')); + $data['soapbox'] = $this->security->xss_clean($this->input->post('soapbox')); $data['gridlocator'] = $station->station_gridsquare; $this->load->view('cabrillo/export', $data); diff --git a/application/libraries/Cabrilloformat.php b/application/libraries/Cabrilloformat.php index 56b698e1..55b83f29 100644 --- a/application/libraries/Cabrilloformat.php +++ b/application/libraries/Cabrilloformat.php @@ -2,7 +2,9 @@ class Cabrilloformat { - public function header($contest_id, $callsign, $claimed_score, $operators, $club, $name, $address1, $address2, $address3, $soapbox, $gridlocator) { + public function header($contest_id, $callsign, $claimed_score, + $operators, $club, $name, $address, $addresscity, $addressstateprovince, $addresspostalcode, $addresscountry, $soapbox, $gridlocator, + $categoryoverlay, $categorytransmitter, $categorystation, $categorypower, $categorymode, $categoryband, $categoryassisted, $categoryoperator, $email) { $cab_header = ""; $cab_header .= "START-OF-LOG: 3.0"."\r\n"; $cab_header .= "CONTEST: ".$contest_id."\r\n"; @@ -18,16 +20,30 @@ class Cabrilloformat { $cab_header .= "CLUB: ".$club."\r\n"; } + $cab_header .= "CATEGORY-OPERATOR: ".$categoryoperator."\r\n"; + $cab_header .= "CATEGORY-BAND: ".$categoryassisted."\r\n"; + $cab_header .= "CATEGORY-ASSISTED: ".$categoryband."\r\n"; + $cab_header .= "CATEGORY-MODE: ".$categorymode."\r\n"; + $cab_header .= "CATEGORY-POWER: ".$categorypower."\r\n"; + $cab_header .= "CATEGORY-STATION: ".$categorystation."\r\n"; + $cab_header .= "CATEGORY-TRANSMITTER: ".$categorytransmitter."\r\n"; + $cab_header .= "CATEGORY-OVERLAY: ".$categoryoverlay."\r\n"; + $cab_header .= "NAME: ".$name."\r\n"; - $cab_header .= "ADDRESS: ".$address1."\r\n"; - $cab_header .= "ADDRESS: ".$address2."\r\n"; - $cab_header .= "ADDRESS: ".$address3."\r\n"; + $cab_header .= "ADDRESS: ".$address."\r\n"; + $cab_header .= "ADDRESS-CITY: ".$addresscity."\r\n"; + $cab_header .= "ADDRESS-STATE-PROVINCE: ".$addressstateprovince."\r\n"; + $cab_header .= "ADDRESS-POSTALCODE: ".$addresspostalcode."\r\n"; + $cab_header .= "ADDRESS-COUNTRY: ".$addresscountry."\r\n"; + $cab_header .= "EMAIL: ".$email."\r\n"; $cab_header .= "SOAPBOX: ".$soapbox."\r\n"; if($gridlocator != null) { $cab_header .= "GRID-LOCATOR: ".$gridlocator."\r\n"; } + $cab_header .= "CREATED-BY: Cloudlog"."\r\n"; + return $cab_header; } diff --git a/application/views/cabrillo/export.php b/application/views/cabrillo/export.php index d4e5e6f0..5b189564 100644 --- a/application/views/cabrillo/export.php +++ b/application/views/cabrillo/export.php @@ -5,7 +5,9 @@ header('Content-Disposition: attachment; filename="'.$callsign.'-'.$contest_id.' $CI =& get_instance(); $CI->load->library('Cabrilloformat'); -echo $CI->cabrilloformat->header($contest_id, $callsign, $claimed_score, $operators, $club, $name, $address1, $address2, $address3, $soapbox, $gridlocator); +echo $CI->cabrilloformat->header($contest_id, $callsign, $claimed_score, + $operators, $club, $name, $address, $addresscity, $addressstateprovince, $addresspostalcode, $addresscountry, $soapbox, $gridlocator, + $categoryoverlay, $categorytransmitter, $categorystation, $categorypower, $categorymode, $categoryband, $categoryassisted, $categoryoperator, $email); foreach ($qsos->result() as $row) { echo $CI->cabrilloformat->qso($row); } diff --git a/application/views/cabrillo/index.php b/application/views/cabrillo/index.php index bec0fbfe..e1c3e29e 100644 --- a/application/views/cabrillo/index.php +++ b/application/views/cabrillo/index.php @@ -33,6 +33,145 @@
+ + + + + + + + + + + + + + + + + ' + '' + - ' '); + ' '); $.each(data, function(key, value) { $('#contestdatesfrom') @@ -83,4 +84,8 @@ function loadContestDates() { }); } }); +} + +function addAdditionalInfo() { + $(".additionalinfo").removeAttr("hidden"); } \ No newline at end of file