diff --git a/application/controllers/Activators.php b/application/controllers/Activators.php index 6c66d5420..13852f0af 100644 --- a/application/controllers/Activators.php +++ b/application/controllers/Activators.php @@ -1,75 +1,62 @@ load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + if (!$this->user_model->authorize(2)) { + $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); + redirect('dashboard'); + } } public function index() { - // Render Page $data['page_title'] = "Gridsquare Activators"; $this->load->model('Activators_model'); if ($this->input->post('band') != NULL) { // Band is not set when page first loads. $band = $this->input->post('band'); - } - else { + } else { $band = 'All'; } + if ($this->input->post('mincount') != NULL) { // mincount is not set when page first loads. + $mincount = $this->input->post('mincount'); + } else { + $mincount = 2; + } + + if ($this->input->post('leogeo') != NULL) { // orbit is not set when page first loads. + $orbit = $this->input->post('leogeo'); + } else { + $orbit = 'both'; + } + $this->load->model('bands'); $data['worked_bands'] = $this->bands->get_worked_bands(); + $data['mincount'] = $mincount; $data['maxactivatedgrids'] = $this->Activators_model->get_max_activated_grids(); - $data['activators_array'] = $this->Activators_model->get_activators($band, $this->input->post('mincount'), $this->input->post('leogeo')); - $data['activators_vucc_array'] = $this->Activators_model->get_activators_vucc($band, $this->input->post('leogeo')); + $data['orbit'] = $orbit; + $data['activators_array'] = $this->Activators_model->get_activators($band, $mincount, $orbit); + $data['activators_vucc_array'] = $this->Activators_model->get_activators_vucc($band, $orbit); $data['bandselect'] = $band; + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/activators.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/activators.js")), + ]; + $this->load->view('interface_assets/header', $data); $this->load->view('activators/index'); - $this->load->view('interface_assets/footer'); - } - - public function details() { - $this->load->model('logbook_model'); - - $call = str_replace('"', "", $this->input->post("Callsign")); - $band = str_replace('"', "", $this->input->post("Band")); - $leogeo = str_replace('"', "", $this->input->post("LeoGeo")); - $data['results'] = $this->logbook_model->activator_details($call, $band, $leogeo); - $data['filter'] = "Call ".$call; - switch($band) { - case 'All': $data['page_title'] = "Log View All Bands"; - $data['filter'] .= " and Band All"; - break; - case 'SAT': $data['page_title'] = "Log View SAT"; - $data['filter'] .= " and Band SAT"; - break; - default: $data['page_title'] = "Log View Band"; - $data['filter'] .= " and Band ".$band; - break; - } - if ($band == "SAT") { - switch($leogeo) { - case 'both': $data['filter'] .= " and GEO/LEO"; - break; - case 'leo': $data['filter'] .= " and LEO"; - break; - case 'geo': $data['filter'] .= " and GEO"; - break; - } - } - - - $this->load->view('activators/details', $data); + $this->load->view('interface_assets/footer', $footerData); } } diff --git a/application/models/Activators_model.php b/application/models/Activators_model.php index a3585715d..b863021d4 100644 --- a/application/models/Activators_model.php +++ b/application/models/Activators_model.php @@ -3,115 +3,121 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); class Activators_model extends CI_Model { - function get_activators($band, $mincount, $leogeo) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + function get_activators($band, $mincount, $leogeo) + { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if ($mincount == '' || $mincount == 0 || ! is_numeric($mincount)) { + if ($mincount == '' || $mincount == 0 || !is_numeric($mincount)) { $mincount = 2; } - if (!$logbooks_locations_array) { - return null; - } + if (!$logbooks_locations_array) { + return null; + } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; - $sql = "select COL_CALL as `call`, COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count`, GROUP_CONCAT(DISTINCT SUBSTR(`COL_GRIDSQUARE`,1,4) ORDER BY `COL_GRIDSQUARE` SEPARATOR ', ') AS `grids` from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")"; - if ($band != 'All') { - if ($band == 'SAT') { - switch ($leogeo) { - case 'both' : + $sql = "SELECT COL_CALL as `call`, + COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count`, + GROUP_CONCAT(DISTINCT SUBSTR(`COL_GRIDSQUARE`,1,4) ORDER BY `COL_GRIDSQUARE` SEPARATOR ', ') AS `grids` + FROM " . $this->config->item('table_name') . " WHERE station_id in (" . $location_list . ")"; + + if ($band != 'All') { + if ($band == 'SAT') { + switch ($leogeo) { + case 'both': $sql .= " and col_prop_mode ='" . $band . "'"; break; - case 'leo' : + case 'leo': $sql .= " and col_prop_mode = '" . $band . "'"; $sql .= " and col_sat_name != 'QO-100'"; break; - case 'geo' : + case 'geo': $sql .= " and col_prop_mode = '" . $band . "'"; $sql .= " and col_sat_name = 'QO-100'"; break; - default : + default: $sql .= " and col_prop_mode ='" . $band . "'"; break; - } } - else { - $sql .= " and col_prop_mode !='SAT'"; - $sql .= " and COL_BAND ='" . $band . "'"; - } - } - $sql .= " AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` HAVING `count` >= ".$mincount." ORDER BY `count` DESC;"; + } else { + $sql .= " and col_prop_mode !='SAT'"; + $sql .= " and COL_BAND ='" . $band . "'"; + } + } + $sql .= " AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` HAVING `count` >= " . $mincount . " ORDER BY `count` DESC;"; - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function get_activators_vucc($band, $leogeo) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + function get_activators_vucc($band, $leogeo) + { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if (!$logbooks_locations_array) { - return null; - } + if (!$logbooks_locations_array) { + return null; + } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; - $sql = "SELECT DISTINCT COL_CALL AS `call`, GROUP_CONCAT(COL_VUCC_GRIDS) AS `vucc_grids` FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")"; - if ($band != 'All') { - if ($band == 'SAT') { - switch ($leogeo) { - case 'both' : + $sql = "SELECT DISTINCT COL_CALL AS `call`, + GROUP_CONCAT(COL_VUCC_GRIDS) AS `vucc_grids` FROM " . $this->config->item('table_name') . + " WHERE station_id in (" . $location_list . ")"; + + if ($band != 'All') { + if ($band == 'SAT') { + switch ($leogeo) { + case 'both': $sql .= " and col_prop_mode ='" . $band . "'"; break; - case 'leo' : + case 'leo': $sql .= " and col_prop_mode = '" . $band . "'"; $sql .= " and col_sat_name != 'QO-100'"; break; - case 'geo' : + case 'geo': $sql .= " and col_prop_mode = '" . $band . "'"; $sql .= " and col_sat_name = 'QO-100'"; break; - default : + default: $sql .= " and col_prop_mode ='" . $band . "'"; break; - } } - else { - $sql .= " and col_prop_mode !='SAT'"; - $sql .= " and COL_BAND ='" . $band . "'"; - } - } + } else { + $sql .= " and col_prop_mode !='SAT'"; + $sql .= " and COL_BAND ='" . $band . "'"; + } + } $sql .= " AND COL_VUCC_GRIDS != '' GROUP BY COL_CALL;"; - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } - function get_max_activated_grids() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + return $query->result(); + } + function get_max_activated_grids() + { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - if (!$logbooks_locations_array) { - return array(); - } + if (!$logbooks_locations_array) { + return array(); + } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $location_list = "'" . implode("','", $logbooks_locations_array) . "'"; - // Get max no of activated grids of single operator - $data = $this->db->query( - "select COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from " . $this->config->item('table_name') . " WHERE station_id in (" . $location_list . ") AND `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1" - ); - foreach($data->result() as $row){ - $max = $row->count; - } - - return ($max ?? 0); - } + // Get max no of activated grids of single operator + $data = $this->db->query( + "SELECT COUNT(DISTINCT(SUBSTR(COL_GRIDSQUARE,1,4))) AS `count` from " . $this->config->item('table_name') . + " WHERE station_id in (" . $location_list . ") AND + `COL_GRIDSQUARE` != '' GROUP BY `COL_CALL` ORDER BY `count` DESC LIMIT 1" + ); + foreach ($data->result() as $row) { + $max = $row->count; + } + return ($max ?? 0); + } } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index ac8ab93a0..b52665ee3 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -413,6 +413,9 @@ class Logbook_model extends CI_Model { $this->db->join('satellite', 'satellite.name = '.$this->config->item('table_name').'.col_sat_name', 'left outer'); } switch ($type) { + case 'CALL': + $this->db->where('COL_CALL', $searchphrase); + break; case 'DXCC': $this->db->where('COL_COUNTRY', $searchphrase); if ($band == 'SAT' && $type == 'DXCC') { @@ -4892,7 +4895,32 @@ function lotw_last_qsl_date($user_id) { if ($row->COL_NAME != null) { $plot['html'] .= "Name: ".$row->COL_NAME."
"; } - $plot['html'] .= "Date/Time: ".$row->COL_TIME_ON."
"; + $date_cat = "Date"; + + // Get Date format + if($this->session->userdata('user_date_format')) { + // If Logged in and session exists + $user_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/wavelog.php + $user_date_format = $this->config->item('qso_date_format'); + } + + $qso_time_on = new DateTime($row->COL_TIME_ON); + + if ($this->uri->segment(1) == 'visitor') { + $visitor_date_format = $this->config->item('qso_date_format'); + if ($this->config->item('show_time')) { + $visitor_date_format .= ' H:i'; + $date_cat .= "/Time"; + } + $qso_time_on = $qso_time_on->format($visitor_date_format); + } else { + $qso_time_on = $qso_time_on->format($user_date_format.' H:i'); + $date_cat .= "/Time"; + } + + $plot['html'] .= $date_cat.": ".$qso_time_on."
"; $plot['html'] .= ($row->COL_SAT_NAME != null) ? ("SAT: ".$row->COL_SAT_NAME."
") : ("Band: ".$row->COL_BAND."
"); $plot['html'] .= "Mode: ".($row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE)."
"; diff --git a/application/views/activators/details.php b/application/views/activators/details.php deleted file mode 100644 index 52b59c929..000000000 --- a/application/views/activators/details.php +++ /dev/null @@ -1,4 +0,0 @@ -
-
- - load->view('view_log/partial/log_ajax') ?> diff --git a/application/views/activators/index.php b/application/views/activators/index.php index bcc6041b2..2fcaa853c 100644 --- a/application/views/activators/index.php +++ b/application/views/activators/index.php @@ -3,59 +3,59 @@
-
- -
- -
-
-
- -
- -
-
-
- -
- -
- -
- -
- -
- -
+
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
- session->userdata('user_date_format')) { + if ($this->session->userdata('user_date_format')) { // If Logged in and session exists $custom_date_format = $this->session->userdata('user_date_format'); } else { @@ -63,21 +63,18 @@ $custom_date_format = $this->config->item('qso_date_format'); } ?> - call] = $line->vucc_grids; - } + foreach ($activators_vucc_array as $line) { + $vucc_grids[$line->call] = $line->vucc_grids; + } } - if( $this->input->post('band') != NULL) { - if ($activators_array) { + if ($activators_array) { - $result = write_activators($activators_array, $vucc_grids, $custom_date_format, $this->input->post('band'), $this->input->post('leogeo')); - } - else { - echo ''; - } + $result = write_activators($activators_array, $vucc_grids, $custom_date_format, $bandselect, $orbit); + } else { + echo ''; } ?> @@ -86,12 +83,13 @@ @@ -113,16 +111,16 @@ function write_activators($activators_array, $vucc_grids, $custom_date_format, $ $grids = $line->grids; $count = $line->count; if (array_key_exists($line->call, $vucc_grids)) { - foreach(explode(',', $vucc_grids[$line->call]) as $vgrid) { - if(!strpos($grids, $vgrid)) { - $grids .= ','.$vgrid; - } - } - $grids = str_replace(' ', '', $grids); - $grid_array = explode(',', $grids); - sort($grid_array); - $count = count($grid_array); - $grids = implode(', ', $grid_array); + foreach (explode(',', $vucc_grids[$line->call]) as $vgrid) { + if (!strpos($grids, $vgrid)) { + $grids .= ',' . $vgrid; + } + } + $grids = str_replace(' ', '', $grids); + $grid_array = explode(',', $grids); + sort($grid_array); + $count = count($grid_array); + $grids = implode(', ', $grid_array); } array_push($activators, array($count, $call, $grids)); } @@ -130,11 +128,11 @@ function write_activators($activators_array, $vucc_grids, $custom_date_format, $ foreach ($activators as $line) { echo ' ' . $i++ . ' - '.$line[1].' - '.$line[0].' - '.$line[2].' - - + ' . $line[1] . ' + ' . $line[0] . ' + ' . $line[2] . ' + + '; } echo '
'; diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 8bc899375..5b4ff1bd7 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1981,75 +1981,7 @@ $(document).ready(function(){ } - uri->segment(1) == "activators") { ?> - - + uri->segment(1) == "mode") { ?> diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index 4a0f185b0..f7bab19f0 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -68,18 +68,20 @@ function echo_table_col($row, $name) { echo_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); echo_table_header_col($this, $this->session->userdata('user_column5')); - if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?> + if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { + if ( strpos($this->session->userdata('user_default_confirmation'),'Q') !== false ) { ?> QSL - session->userdata('user_default_confirmation'),'E')>0 && ($this->session->userdata('user_eqsl_name') != "") ) { ?> + + session->userdata('user_default_confirmation'),'E') !== false && ($this->session->userdata('user_eqsl_name') != "") ) { ?> eQSL - session->userdata('user_default_confirmation'),'L')>0 && ($this->session->userdata('user_lotw_name') != "") ) { ?> + session->userdata('user_default_confirmation'),'L') !== false && ($this->session->userdata('user_lotw_name') != "") ) { ?> LoTW - session->userdata('user_default_confirmation'),'Z')>0 && ($this->session->userdata('hasQrzKey') != "") ) { ?> + session->userdata('user_default_confirmation'),'Z') !== false && ($this->session->userdata('hasQrzKey') != "") ) { ?> QRZ - session->userdata('user_default_confirmation'),'C')>0 ) { ?> + session->userdata('user_default_confirmation'),'C') !== false ) { ?> Clublog @@ -131,7 +133,8 @@ function echo_table_col($row, $name) { echo_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4')); echo_table_col($row, $this->session->userdata('user_column5')); - if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { ?> + if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') >= 2)) { + if ( strpos($this->session->userdata('user_default_confirmation'),'Q') !== false ) { ?> COL_QSL_SENT != "N") { switch ($row->COL_QSL_SENT) { @@ -211,7 +214,7 @@ function echo_table_col($row, $name) { } ?>">▼ - session->userdata('user_default_confirmation'),'E')>0 && ($this->session->userdata('user_eqsl_name') != "")){ ?> + session->userdata('user_default_confirmation'),'E') !== false && ($this->session->userdata('user_eqsl_name') != "")){ ?> COL_EQSL_QSL_SENT == "Y") { echo "title=\"".lang('eqsl_short')." ".lang('general_word_sent'); if ($row->COL_EQSL_QSLSDATE != null) { $timestamp = strtotime($row->COL_EQSL_QSLSDATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="eqsl-COL_EQSL_QSL_SENT=='Y')?'green':'red'?>">▲ COL_EQSL_QSL_RCVD == "Y") { echo "title=\"".lang('eqsl_short')." ".lang('general_word_received'); if ($row->COL_EQSL_QSLRDATE != null) { $timestamp = strtotime($row->COL_EQSL_QSLRDATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="eqsl-COL_EQSL_QSL_RCVD=='Y')?'green':'red'?>"> @@ -224,14 +227,14 @@ function echo_table_col($row, $name) { - session->userdata('user_default_confirmation'),'L')>0 && ($this->session->userdata('user_lotw_name') != "") ) { ?> + session->userdata('user_default_confirmation'),'L') !== false && ($this->session->userdata('user_lotw_name') != "") ) { ?> COL_LOTW_QSL_SENT == "Y") { echo "title=\"".lang('lotw_short')." ".lang('general_word_sent'); if ($row->COL_LOTW_QSLSDATE != null) { $timestamp = strtotime($row->COL_LOTW_QSLSDATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="lotw-COL_LOTW_QSL_SENT=='Y')?'green':'red'?>">▲ COL_LOTW_QSL_RCVD == "Y") { echo "title=\"".lang('lotw_short')." ".lang('general_word_received'); if ($row->COL_LOTW_QSLRDATE != null) { $timestamp = strtotime($row->COL_LOTW_QSLRDATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="lotw-COL_LOTW_QSL_RCVD=='Y')?'green':'red'?>">▼ - session->userdata('user_default_confirmation'),'Z')>0 && ($this->session->userdata('hasQrzKey') != "") ) { ?> + session->userdata('user_default_confirmation'),'Z') !== false && ($this->session->userdata('hasQrzKey') != "") ) { ?> COL_QRZCOM_QSO_UPLOAD_STATUS == "Y") { echo "title=\"QRZ ".lang('general_word_sent'); if ($row->COL_QRZCOM_QSO_UPLOAD_DATE != null) { $timestamp = strtotime($row->COL_QRZCOM_QSO_UPLOAD_DATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="qrz-COL_QRZCOM_QSO_UPLOAD_STATUS=='Y')?'green':'red'?>">▲ COL_QRZCOM_QSO_DOWNLOAD_STATUS == "Y") { echo "title=\"QRZ ".lang('general_word_received'); if ($row->COL_QRZCOM_QSO_DOWNLOAD_DATE != null) { $timestamp = strtotime($row->COL_QRZCOM_QSO_DOWNLOAD_DATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="qrz-COL_QRZCOM_QSO_DOWNLOAD_STATUS=='Y')?'green':'red'?>">▼ @@ -239,7 +242,7 @@ function echo_table_col($row, $name) { - session->userdata('user_default_confirmation'),'C')>0 ) { ?> + session->userdata('user_default_confirmation'),'C') !== false ) { ?> COL_CLUBLOG_QSO_UPLOAD_STATUS == "Y") { echo "title=\"Clublog ".lang('general_word_sent'); if ($row->COL_CLUBLOG_QSO_UPLOAD_DATE != null) { $timestamp = strtotime($row->COL_CLUBLOG_QSO_UPLOAD_DATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="clublog-COL_CLUBLOG_QSO_UPLOAD_STATUS=='Y')?'green':'red'?>">▲ COL_CLUBLOG_QSO_DOWNLOAD_STATUS == "Y") { echo "title=\"Clublog ".lang('general_word_received'); if ($row->COL_CLUBLOG_QSO_DOWNLOAD_DATE != null) { $timestamp = strtotime($row->COL_CLUBLOG_QSO_DOWNLOAD_DATE); echo " ".($timestamp!=''?date($custom_date_format, $timestamp):''); } echo "\" data-bs-toggle=\"tooltip\""; } ?> class="clublog-COL_CLUBLOG_QSO_DOWNLOAD_STATUS=='Y')?'green':'red'?>">▼ diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index d01b2a8ca..801df51e4 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -45,8 +45,9 @@ function echo_table_col($row, $name) {
-optionslib->get_option('public_maps') == 'true') { ?> -
+optionslib->get_option('public_maps') ?? 'true'; + if ($public_maps_option == 'true') { ?> +
diff --git a/application/views/visitor/layout/header.php b/application/views/visitor/layout/header.php index 801277900..1b395cd73 100644 --- a/application/views/visitor/layout/header.php +++ b/application/views/visitor/layout/header.php @@ -62,7 +62,8 @@