diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 95cb05ff..c7f180cc 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -473,7 +473,7 @@ class Logbook extends CI_Controller { $html = ""; if(!empty($logbooks_locations_array)) { - $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); + $this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_FREQ, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, '.$this->config->item('table_name').'.COL_MY_GRIDSQUARE, '.$this->config->item('table_name').'.COL_CONTEST_ID, station_profile.*'); $this->db->from($this->config->item('table_name')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); @@ -494,14 +494,10 @@ class Logbook extends CI_Controller { $html .= ""; $html .= "Date"; $html .= "Callsign"; - $html .= "Mode"; - $html .= "RST (S)"; - $html .= "RST (R)"; - if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - $html .= "Frequency"; - } else { - $html .= "Band"; - } + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + $html .= $this->part_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); switch($this->session->userdata('user_previous_qsl_type')) { case 0: $html .= "".lang('gen_hamradio_qsl').""; @@ -536,21 +532,10 @@ class Logbook extends CI_Controller { $html .= ""; $html .= "".date($custom_date_format, $timestamp). date(' H:i',strtotime($row->COL_TIME_ON)) . ""; $html .= "" . str_replace('0','Ø',strtoupper($row->COL_CALL)) . ""; - if ($row->COL_SUBMODE==null) - $html .= "".$row->COL_MODE.""; - else - $html .= "".$row->COL_SUBMODE.""; - $html .= "".$row->COL_RST_SENT.""; - $html .= "".$row->COL_RST_RCVD.""; - if($row->COL_SAT_NAME != null) { - $html .= "".$row->COL_SAT_NAME.""; - } else { - if ($this->session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - $html .= "".$this->frequency->hz_to_mhz($row->COL_FREQ).""; - } else { - $html .= "".$row->COL_BAND.""; - } - } + $html .= $this->part_table_col($row, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + $html .= $this->part_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); if ($this->session->userdata('user_previous_qsl_type') == 1) { $html .= ""; $html .= "db->get(); } + function part_table_header_col($ctx, $name) { + $ret=''; + switch($name) { + case 'Mode': $ret.= ''.$ctx->lang->line('gen_hamradio_mode').''; break; + case 'RSTS': $ret.= ''.$ctx->lang->line('gen_hamradio_rsts').''; break; + case 'RSTR': $ret.= ''.$ctx->lang->line('gen_hamradio_rstr').''; break; + case 'Country': $ret.= ''.$ctx->lang->line('general_word_country').''; break; + case 'IOTA': $ret.= ''.$ctx->lang->line('gen_hamradio_iota').''; break; + case 'SOTA': $ret.= ''.$ctx->lang->line('gen_hamradio_sota').''; break; + case 'WWFF': $ret.= ''.$ctx->lang->line('gen_hamradio_wwff').''; break; + case 'POTA': $ret.= ''.$ctx->lang->line('gen_hamradio_pota').''; break; + case 'State': $ret.= ''.$ctx->lang->line('gen_hamradio_state').''; break; + case 'Grid': $ret.= ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; + case 'Distance': $ret.= ''.$ctx->lang->line('gen_hamradio_distance').''; break; + case 'Band': $ret.= ''.$ctx->lang->line('gen_hamradio_band').''; break; + case 'Frequency': $ret.= ''.$ctx->lang->line('gen_hamradio_frequency').''; break; + case 'Operator': $ret.= ''.$ctx->lang->line('gen_hamradio_operator').''; break; + } + return $ret; + } + + function part_QrbCalcLink($mygrid, $grid, $vucc) { + $ret=''; + if (!empty($grid)) { + $ret.= $grid . ' '; + } else if (!empty($vucc)) { + $ret.= $vucc .' '; + } + return $ret; + } + + function part_table_col($row, $name) { + $ret=''; + $ci =& get_instance(); + switch($name) { + case 'Mode': $ret.= ''; $ret.= $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . ''; break; + case 'RSTS': $ret.= '' . $row->COL_RST_SENT; if ($row->COL_STX) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; $ret.=sprintf("%03d", $row->COL_STX); $ret.= '';} if ($row->COL_STX_STRING) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} $ret.= ''; break; + case 'RSTR': $ret.= '' . $row->COL_RST_RCVD; if ($row->COL_SRX) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; $ret.=sprintf("%03d", $row->COL_SRX); $ret.= '';} if ($row->COL_SRX_STRING) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '';} $ret.= ''; break; + case 'Country': $ret.= '' . ucwords(strtolower(($row->COL_COUNTRY))); if ($row->end != NULL) $ret.= ' '.$ci->lang->line('gen_hamradio_deleted_dxcc').'' . ''; break; + case 'IOTA': $ret.= '' . ($row->COL_IOTA) . ''; break; + case 'SOTA': $ret.= '' . ($row->COL_SOTA_REF) . ''; break; + case 'WWFF': $ret.= '' . ($row->COL_WWFF_REF) . ''; break; + case 'POTA': $ret.= '' . ($row->COL_POTA_REF) . ''; break; + case 'Grid': $ret.= '' . $this->part_QrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE) . ''; break; + case 'Distance': $ret.= '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; break; + case 'Band': $ret.= ''; if($row->COL_SAT_NAME != null) { $ret.= ''.$row->COL_SAT_NAME.''; } else { $ret.= strtolower($row->COL_BAND); } $ret.= ''; break; + case 'Frequency': $ret.= ''; if($row->COL_SAT_NAME != null) { $ret.= ''.$row->COL_SAT_NAME.''; } else { if($row->COL_FREQ != null) { $ret.= $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { $ret.= strtolower($row->COL_BAND); } } $ret.= ''; break; + case 'State': $ret.= '' . ($row->COL_STATE) . ''; break; + case 'Operator': $ret.= '' . ($row->COL_OPERATOR) . ''; break; + } + return $ret; + } } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 42fe8bbc..481cb39f 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1132,7 +1132,7 @@ class Logbook_model extends CI_Model { $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if(!empty($logbooks_locations_array)) { - $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); + $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_STX, COL_STX_STRING, COL_VUCC_GRIDS, COL_GRIDSQUARE, COL_MY_GRIDSQUARE'); $this->db->where_in('station_id', $logbooks_locations_array); $this->db->order_by("COL_TIME_ON", "desc"); $this->db->limit($num); diff --git a/application/views/qso/components/previous_contacts.php b/application/views/qso/components/previous_contacts.php index 7c13761c..8b99dc63 100644 --- a/application/views/qso/components/previous_contacts.php +++ b/application/views/qso/components/previous_contacts.php @@ -4,17 +4,14 @@ - - - - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - ?> - + + session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + echo_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + echo_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + echo_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); + ?> + COL_CALL)); ?> - - - - COL_SAT_NAME != null) { ?> - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - } ?> - + session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); + echo_table_col($row, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); + echo_table_col($row, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); + echo_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); + ?> +
/'.lang('gen_hamradio_frequency').''.lang('gen_hamradio_band').'
COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>COL_SAT_NAME; ?>'; - if ($row->COL_FREQ != null) { - echo $this->frequency->hz_to_mhz($row->COL_FREQ); - } else { - echo $row->COL_BAND; - } - echo ''.$row->COL_BAND.'
- \ No newline at end of file + + +'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . ''; break; + case 'RSTS': echo '' . $row->COL_RST_SENT; if ($row->COL_STX) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '';} if ($row->COL_STX_STRING) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '';} echo ''; break; + case 'RSTR': echo '' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_SRX); echo '';} if ($row->COL_SRX_STRING) { echo ' COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '';} echo ''; break; + case 'Country': echo '' . ucwords(strtolower(($row->COL_COUNTRY))); if ($row->end != NULL) echo ' '.$ci->lang->line('gen_hamradio_deleted_dxcc').'' . ''; break; + case 'IOTA': echo '' . ($row->COL_IOTA) . ''; break; + case 'SOTA': echo '' . ($row->COL_SOTA_REF) . ''; break; + case 'WWFF': echo '' . ($row->COL_WWFF_REF) . ''; break; + case 'POTA': echo '' . ($row->COL_POTA_REF) . ''; break; + case 'Grid': echo ''; echoQrbCalcLink($row->COL_MY_GRIDSQUARE, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE); echo ''; break; + case 'Distance': echo '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; break; + case 'Band': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { echo strtolower($row->COL_BAND); } echo ''; break; + case 'Frequency': echo ''; if($row->COL_SAT_NAME != null) { echo ''.$row->COL_SAT_NAME.''; } else { if($row->COL_FREQ != null) { echo $ci->frequency->hz_to_mhz($row->COL_FREQ); } else { echo strtolower($row->COL_BAND); } } echo ''; break; + case 'State': echo '' . ($row->COL_STATE) . ''; break; + case 'Operator': echo '' . ($row->COL_OPERATOR) . ''; break; + } +} + +function echo_table_header_col($ctx, $name) { + switch($name) { + case 'Mode': echo ''.$ctx->lang->line('gen_hamradio_mode').''; break; + case 'RSTS': echo ''.$ctx->lang->line('gen_hamradio_rsts').''; break; + case 'RSTR': echo ''.$ctx->lang->line('gen_hamradio_rstr').''; break; + case 'Country': echo ''.$ctx->lang->line('general_word_country').''; break; + case 'IOTA': echo ''.$ctx->lang->line('gen_hamradio_iota').''; break; + case 'SOTA': echo ''.$ctx->lang->line('gen_hamradio_sota').''; break; + case 'WWFF': echo ''.$ctx->lang->line('gen_hamradio_wwff').''; break; + case 'POTA': echo ''.$ctx->lang->line('gen_hamradio_pota').''; break; + case 'State': echo ''.$ctx->lang->line('gen_hamradio_state').''; break; + case 'Grid': echo ''.$ctx->lang->line('gen_hamradio_gridsquare').''; break; + case 'Distance': echo ''.$ctx->lang->line('gen_hamradio_distance').''; break; + case 'Band': echo ''.$ctx->lang->line('gen_hamradio_band').''; break; + case 'Frequency': echo ''.$ctx->lang->line('gen_hamradio_frequency').''; break; + case 'Operator': echo ''.$ctx->lang->line('gen_hamradio_operator').''; break; + } +} + +function echoQrbCalcLink($mygrid, $grid, $vucc) { + if (!empty($grid)) { + echo $grid . ' '; + } else if (!empty($vucc)) { + echo $vucc .' '; + } +} +?> diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 5c257555..3f9a6850 100755 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -597,70 +597,8 @@
-
+
-
- - - - - - - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - ?> - - - session->userdata('user_date_format')) { - // If Logged in and session exists - $custom_date_format = $this->session->userdata('user_date_format'); - } else { - // Get Default date format from /config/cloudlog.php - $custom_date_format = $this->config->item('qso_date_format'); - } - - $i = 0; - if($query != false) { - foreach ($query->result() as $row) { - echo ''; - echo ' - - - - - COL_SAT_NAME != null) { ?> - - session->userdata('user_column1')=='Frequency' || $this->session->userdata('user_column2')=='Frequency' || $this->session->userdata('user_column3')=='Frequency' || $this->session->userdata('user_column4')=='Frequency' || $this->session->userdata('user_column5')=='Frequency') { - echo ''; - } else { - echo ''; - } - } ?> - - -
/'.lang('gen_hamradio_frequency').''.lang('gen_hamradio_band').'
'; - $timestamp = strtotime($row->COL_TIME_ON); - echo date($custom_date_format, $timestamp); - echo date(' H:i',strtotime($row->COL_TIME_ON)); - ?> - - COL_CALL)); ?> - COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>COL_SAT_NAME; ?>'; - if ($row->COL_FREQ != null) { - echo $this->frequency->hz_to_mhz($row->COL_FREQ); - } else { - echo $row->COL_BAND; - } - echo ''.$row->COL_BAND.'
-