Bindings for the activated-gm-controller

This commit is contained in:
int2001
2024-10-12 06:05:36 +00:00
parent eff579f3f0
commit 5032ca8157

View File

@@ -3,7 +3,7 @@
class Activated_gridmap_model extends CI_Model {
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit, $propagation) {
$bindings=[];
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@@ -20,35 +20,42 @@ class Activated_gridmap_model extends CI_Model {
. 'AND station_profile.station_id in ('.$location_list.')';
if ($band != 'All') {
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name ='" . $sat . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
$sql .= " and col_band ='" . $band . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$band;
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name = ?";
$bindings[]=$sat;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
$sql .= " and col_band = ?";
$bindings[]=$band;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
}
if ($mode != 'All') {
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
}
if ($mode != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$mode;
$bindings[]=$mode;
}
$sql .= $this->addOrbitToQuery($orbit);
$sql .= $this->addOrbitToQuery($orbit,$bindings);
$sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz);
return $this->db->query($sql);
return $this->db->query($sql, $bindings);
}
function get_band($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit, $propagation) {
$bindings=[];
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@@ -65,34 +72,41 @@ class Activated_gridmap_model extends CI_Model {
. 'AND station_profile.station_id in ('.$location_list.')';
if ($band != 'All') {
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name ='" . $sat . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
$sql .= " and col_band ='" . $band . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$band;
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name = ?";
$bindings[]=$sat;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
$sql .= " and col_band = ?";
$bindings[]=$band;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
}
if ($mode != 'All') {
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
}
if ($mode != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$mode;
$bindings[]=$mode;
}
$sql .= $this->addOrbitToQuery($orbit);
$sql .= $this->addOrbitToQuery($orbit,$bindings);
return $this->db->query($sql);
return $this->db->query($sql,$bindings);
}
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit, $propagation) {
$bindings=[];
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@@ -109,35 +123,43 @@ class Activated_gridmap_model extends CI_Model {
.$location_list.') AND COL_VUCC_GRIDS != ""';
if ($band != 'All') {
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name ='" . $sat . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
$sql .= " and col_band ='" . $band . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$band;
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name = ?";
$bindings[]=$sat;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
$sql .= " and col_band = ?";
$bindings[]=$band;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
}
if ($mode != 'All') {
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
}
if ($mode != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$mode;
$bindings[]=$mode;
}
$sql .= $this->addOrbitToQuery($orbit);
$sql .= $this->addOrbitToQuery($orbit,$bindings);
return null;
return $this->db->query($sql);
return $this->db->query($sql,$bindings);
}
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit, $propagation) {
$bindings=[];
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@@ -153,34 +175,42 @@ class Activated_gridmap_model extends CI_Model {
.' WHERE station_id in ('
.$location_list.') AND COL_VUCC_GRIDS != ""';
if ($band != 'All') {
if ($band == 'SAT') {
$sql .= " and col_prop_mode ='" . $band . "'";
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name ='" . $sat . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
$sql .= " and col_band ='" . $band . "'";
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode ='" . $propagation . "'";
}
}
if ($band == 'SAT') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$band;
if ($sat != 'All' && $sat != '') {
$sql .= " and col_sat_name = ?";
$bindings[]=$sat;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
$sql .= " and col_band = ?";
$bindings[]=$band;
}
} else {
if ($propagation != '') {
$sql .= " and col_prop_mode = ?";
$bindings[]=$propagation;
}
}
if ($mode != 'All') {
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
}
if ($mode != 'All') {
$sql .= " and (col_mode = ? or col_submode = ?)";
$bindings[]=$mode;
$bindings[]=$mode;
}
$sql .= $this->addOrbitToQuery($orbit);
$sql .= $this->addOrbitToQuery($orbit,$bindings);
$sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz);
return null;
return $this->db->query($sql);
return $this->db->query($sql,$bindings);
}
// Adds confirmation to query
@@ -208,10 +238,11 @@ class Activated_gridmap_model extends CI_Model {
}
// Adds orbit type to query
function addOrbitToQuery($orbit) {
function addOrbitToQuery($orbit,&$bindings) {
$sql = '';
if ($orbit != 'All') {
$sql .= ' AND satellite.orbit = \''.$orbit.'\'';
$sql .= ' AND satellite.orbit = ?';
$bindings[]=$orbit;
}
return $sql;