From b634a802a999fdafeed6230fa0fac2f41627d649 Mon Sep 17 00:00:00 2001 From: int2001 Date: Fri, 23 Aug 2024 05:45:47 +0000 Subject: [PATCH] Refactoring of ONLY DXCC Timeline incl. details --- application/controllers/Timeline.php | 10 +++-- application/models/Timeline_model.php | 41 ++++++++++++------- application/views/interface_assets/footer.php | 3 +- application/views/timeline/index.php | 13 +++--- 4 files changed, 43 insertions(+), 24 deletions(-) diff --git a/application/controllers/Timeline.php b/application/controllers/Timeline.php index 8b43bb156..0650f43ad 100644 --- a/application/controllers/Timeline.php +++ b/application/controllers/Timeline.php @@ -22,10 +22,14 @@ class Timeline extends CI_Controller { $band = 'All'; } - if ($this->input->post('propmode') != NULL) { + if (($this->input->post('propmode') != NULL) && ($this->input->post('propmode') != '0')) { // Setted, but not "All" $propmode = $this->security->xss_clean($this->input->post('propmode')); } else { - $propmode = 'All'; + if (($this->session->userdata('user_default_band') == 'SAT') && ($this->input->post('propmode') == NULL)){ // Not setted, and empty and default is SAT? + $propmode='SAT'; + } else { // Not setted and empty and no SAT as default? + $propmode = 'All'; + } } if ($this->input->post('mode') != NULL) { @@ -91,7 +95,7 @@ class Timeline extends CI_Controller { $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); $type = str_replace('"', "", $this->security->xss_clean($this->input->post("Type"))); - $propmode = str_replace('"', "", $this->security->xss_clean($this->input->post("propmode"))); + $propmode = str_replace('"', "", $this->security->xss_clean($this->input->post("Propmode"))); $data['results'] = $this->timeline_model->timeline_qso_details($querystring, $band, $propmode, $mode, $type); diff --git a/application/models/Timeline_model.php b/application/models/Timeline_model.php index d9f562402..e4ad4b993 100644 --- a/application/models/Timeline_model.php +++ b/application/models/Timeline_model.php @@ -31,20 +31,21 @@ class Timeline_model extends CI_Model { join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif where station_id in (" . $location_list . ")"; - if ($band == 'SAT') { // SAT == Don't care for band but for prop + if ($band == 'SAT') { // Left for compatibility reasons $sql .= " and col_prop_mode = ?"; $binding[] = $band; - } else { // Not SAT - if ($band != 'All') { + } else { // Not SAT + if ($band != 'All') { // Band set? Take care of it $sql .= " and col_band = ?"; $binding[] = $band; - } - if ( $propmode == 'All' ) { // Not SAT and Prop=All -> Show everything but not prop_mode SAT + } + if ( $propmode == 'NoSAT' ) { // All without SAT $sql .= " and col_prop_mode !='SAT'"; - } elseif ($propmode == 'None') { // Not SAT and prop=None --> Take only care of Band (if set) - ; - // No filter - } else { // Not SAT and not All and no prop in ('All','None') take care of band and propmode + } elseif ($propmode == 'None') { // Empty Propmode + $sql .= " and (trim(col_prop_mode)='' or col_prop_mode is null)"; + } elseif ($propmode == 'All') { // Dont care for propmode + ; // No Prop-Filter + } else { // Propmode set, taker care of it $sql .= " and col_prop_mode = ?"; $binding[] = $propmode; } @@ -238,12 +239,24 @@ class Timeline_model extends CI_Model { $this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer'); $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); - if ($band != 'All') { - if ($band == 'SAT') { - $this->db->where('col_prop_mode', $band); - } else { - $this->db->where('COL_PROP_MODE !=', 'SAT'); + if ($band == 'SAT') { // Left for compatibility reasons + $this->db->where('col_prop_mode', $band); + } else { // Not SAT + if ($band != 'All') { // Band set? Take care of it $this->db->where('col_band', $band); + } + if ( $propmode == 'NoSAT' ) { // All without SAT + $this->db->where('col_prop_mode !=', 'SAT'); + } elseif ($propmode == 'None') { // Empty Propmode + $sql .= " and (trim(col_prop_mode)='' or col_prop_mode is null)"; + $this->db->group_start(); + $this->db->where('trim(col_prop_mode)', ''); + $this->db->or_where('col_prop_mode is null'); + $this->db->group_end(); + } elseif ($propmode == 'All') { // Dont care for propmode + ; // No Prop-Filter + } else { // Propmode set, taker care of it + $this->db->where('col_prop_mode =', $propmode); } } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index aa76df56b..b8214d1a4 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1971,7 +1971,7 @@ $(document).ready(function(){ $(".buttons-csv").css("color", "white"); } - function displayTimelineContacts(querystring, band, mode, type) { + function displayTimelineContacts(querystring, band, mode, propmode, type) { var baseURL= ""; $.ajax({ url: baseURL + 'index.php/timeline/details', @@ -1979,6 +1979,7 @@ $(document).ready(function(){ data: {'Querystring': querystring, 'Band': band, 'Mode': mode, + 'Propmode': propmode, 'Type': type }, success: function(html) { diff --git a/application/views/timeline/index.php b/application/views/timeline/index.php index 4e5886e89..f1f5147b9 100644 --- a/application/views/timeline/index.php +++ b/application/views/timeline/index.php @@ -73,8 +73,9 @@
- + + @@ -91,7 +92,7 @@ - + @@ -122,7 +123,7 @@ if ($timeline_array) { switch ($this->input->post('award')) { - case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break; + case 'dxcc': $result = write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $propmode, $this->input->post('award')); break; case 'was': $result = write_was_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break; case 'iota': $result = write_iota_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break; case 'waz': $result = write_waz_timeline($timeline_array, $custom_date_format, $bandselect, $modeselect, $this->input->post('award')); break; @@ -139,7 +140,7 @@ @@ -166,7 +167,7 @@ function write_dxcc_timeline($timeline_array, $custom_date_format, $bandselect, if (!empty($line->end)) echo ''.__("Deleted DXCC").''; echo ' ' . $line->end . ' - adif . '","'. $bandselect . '","'. $modeselect . '","' . $award .'")>'.__("Show").' + adif . '","'. $bandselect . '","'. $modeselect . '","' . $propmode .'","' . $award .'")>'.__("Show").' '; } echo '
';