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 @@
-