diff --git a/application/config/migration.php b/application/config/migration.php
index ada7ac419..1d9283c0a 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
-$config['migration_version'] = 181;
+$config['migration_version'] = 182;
/*
|--------------------------------------------------------------------------
diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php
index 44b8c9482..7e42a57f2 100644
--- a/application/controllers/Awards.php
+++ b/application/controllers/Awards.php
@@ -644,67 +644,64 @@ class Awards extends CI_Controller {
}
public function iota () {
- $this->load->model('iota');
- $this->load->model('modes');
- $this->load->model('bands');
+ $this->load->model('iota');
+ $this->load->model('modes');
+ $this->load->model('bands');
- $data['worked_bands'] = $this->bands->get_worked_bands('iota'); // Used in the view for band select
+ $data['worked_bands'] = $this->bands->get_worked_bands('iota'); // Used in the view for band select
- if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
- if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
- $bands = $data['worked_bands'];
- }
- else {
- $bands[] = $this->security->xss_clean($this->input->post('band'));
- }
- }
- else {
- $bands = $data['worked_bands'];
- }
+ if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
+ if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
+ $bands = $data['worked_bands'];
+ } else {
+ $bands[] = $this->security->xss_clean($this->input->post('band'));
+ }
+ } else {
+ $bands = $data['worked_bands'];
+ }
- $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
- $data['modes'] = $this->modes->active(); // Used in the view for mode select
+ $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
+ $data['modes'] = $this->modes->active(); // Used in the view for mode select
- if($this->input->method() === 'post') {
- $postdata['worked'] = $this->security->xss_clean($this->input->post('worked'));
- $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed'));
- $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked'));
- $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted'));
- $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa'));
- $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia'));
- $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe'));
- $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica'));
- $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica'));
- $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania'));
- $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica'));
- $postdata['band'] = $this->security->xss_clean($this->input->post('band'));
- $postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
- }
- else { // Setting default values at first load of page
- $postdata['worked'] = 1;
- $postdata['confirmed'] = 1;
- $postdata['notworked'] = 1;
- $postdata['includedeleted'] = 0;
- $postdata['Africa'] = 1;
- $postdata['Asia'] = 1;
- $postdata['Europe'] = 1;
- $postdata['NorthAmerica'] = 1;
- $postdata['SouthAmerica'] = 1;
- $postdata['Oceania'] = 1;
- $postdata['Antarctica'] = 1;
- $postdata['band'] = 'All';
- $postdata['mode'] = 'All';
- }
+ if($this->input->method() === 'post') {
+ $postdata['worked'] = $this->security->xss_clean($this->input->post('worked'));
+ $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed'));
+ $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked'));
+ $postdata['includedeleted'] = $this->security->xss_clean($this->input->post('includedeleted'));
+ $postdata['Africa'] = $this->security->xss_clean($this->input->post('Africa'));
+ $postdata['Asia'] = $this->security->xss_clean($this->input->post('Asia'));
+ $postdata['Europe'] = $this->security->xss_clean($this->input->post('Europe'));
+ $postdata['NorthAmerica'] = $this->security->xss_clean($this->input->post('NorthAmerica'));
+ $postdata['SouthAmerica'] = $this->security->xss_clean($this->input->post('SouthAmerica'));
+ $postdata['Oceania'] = $this->security->xss_clean($this->input->post('Oceania'));
+ $postdata['Antarctica'] = $this->security->xss_clean($this->input->post('Antarctica'));
+ $postdata['band'] = $this->security->xss_clean($this->input->post('band'));
+ $postdata['mode'] = $this->security->xss_clean($this->input->post('mode'));
+ } else { // Setting default values at first load of page
+ $postdata['worked'] = 1;
+ $postdata['confirmed'] = 1;
+ $postdata['notworked'] = 1;
+ $postdata['includedeleted'] = 0;
+ $postdata['Africa'] = 1;
+ $postdata['Asia'] = 1;
+ $postdata['Europe'] = 1;
+ $postdata['NorthAmerica'] = 1;
+ $postdata['SouthAmerica'] = 1;
+ $postdata['Oceania'] = 1;
+ $postdata['Antarctica'] = 1;
+ $postdata['band'] = 'All';
+ $postdata['mode'] = 'All';
+ }
- $iotalist = $this->iota->fetchIota($postdata);
- $data['iota_array'] = $this->iota->get_iota_array($iotalist, $bands, $postdata);
- $data['iota_summary'] = $this->iota->get_iota_summary($bands, $postdata);
+ $iotalist = $this->iota->fetchIota($postdata);
+ $data['iota_array'] = $this->iota->get_iota_array($iotalist, $bands, $postdata);
+ $data['iota_summary'] = $this->iota->get_iota_summary($bands, $postdata);
- // Render Page
- $data['page_title'] = "Awards - IOTA (Islands On The Air)";
- $this->load->view('interface_assets/header', $data);
- $this->load->view('awards/iota/index');
- $this->load->view('interface_assets/footer');
+ // Render Page
+ $data['page_title'] = "Awards - IOTA (Islands On The Air)";
+ $this->load->view('interface_assets/header', $data);
+ $this->load->view('awards/iota/index');
+ $this->load->view('interface_assets/footer');
}
public function counties() {
diff --git a/application/migrations/182_main_recreate_iota_idx.php b/application/migrations/182_main_recreate_iota_idx.php
new file mode 100644
index 000000000..7e783db2f
--- /dev/null
+++ b/application/migrations/182_main_recreate_iota_idx.php
@@ -0,0 +1,31 @@
+add_ix('HRD_IDX_COL_IOTA','`station_id`,`COL_IOTA`');
+ }
+
+
+ public function down(){
+ $this->rm_ix('HRD_IDX_COL_IOTA');
+ }
+
+ private function add_ix($index,$cols) {
+ $ix_exist = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = '".$index."'")->num_rows();
+ if ($ix_exist == 0) {
+ $sql = "ALTER TABLE ".$this->config->item('table_name')." ADD INDEX `".$index."` (".$cols.");";
+ $this->db->query($sql);
+ }
+ }
+
+ private function rm_ix($index) {
+ $ix_exist = $this->db->query("SHOW INDEX FROM ".$this->config->item('table_name')." WHERE Key_name = '".$index."'")->num_rows();
+ if ($ix_exist >= 1) {
+ $sql = "ALTER TABLE ".$this->config->item('table_name')." DROP INDEX `".$index."`;";
+ $this->db->query($sql);
+ }
+ }
+}
diff --git a/application/models/Iota.php b/application/models/Iota.php
index a543c6503..d34c86225 100644
--- a/application/models/Iota.php
+++ b/application/models/Iota.php
@@ -2,70 +2,69 @@
class IOTA extends CI_Model {
- function get_iota_array($iotaArray, $bands, $postdata) {
+ function get_iota_array($iotaArray, $bands, $postdata) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->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)."'";
- foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display
- foreach ($iotaArray as $iota) {
- $iotaMatrix[$iota->tag]['prefix'] = $iota->prefix;
- $iotaMatrix[$iota->tag]['name'] = $iota->name;
- if ($postdata['includedeleted'])
- $iotaMatrix[$iota->tag]['Deleted'] = isset($iota->status) && $iota->status == 'D' ? "
Y
" : '';
- $iotaMatrix[$iota->tag][$band] = '-';
- }
+ foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display
+ foreach ($iotaArray as $iota) {
+ $iotaMatrix[$iota->tag]['prefix'] = $iota->prefix;
+ $iotaMatrix[$iota->tag]['name'] = $iota->name;
+ if ($postdata['includedeleted'])
+ $iotaMatrix[$iota->tag]['Deleted'] = isset($iota->status) && $iota->status == 'D' ? "Y
" : '';
+ $iotaMatrix[$iota->tag][$band] = '-';
+ }
- // If worked is checked, we add worked iotas to the array
- if ($postdata['worked'] != NULL) {
- $workedIota = $this->getIotaBandWorked($location_list, $band, $postdata);
- foreach ($workedIota as $wiota) {
- $iotaMatrix[$wiota->tag][$band] = '';
- }
- }
+ // If worked is checked, we add worked iotas to the array
+ if ($postdata['worked'] ?? '' != '') {
+ $workedIota = $this->getIotaBandWorked($location_list, $band, $postdata);
+ foreach ($workedIota as $wiota) {
+ $iotaMatrix[$wiota->tag][$band] = '';
+ }
+ }
- // If confirmed is checked, we add confirmed iotas to the array
- if ($postdata['confirmed'] != NULL) {
- $confirmedIota = $this->getIotaBandConfirmed($location_list, $band, $postdata);
- foreach ($confirmedIota as $ciota) {
- $iotaMatrix[$ciota->tag][$band] = '';
- }
- }
- }
+ // If confirmed is checked, we add confirmed iotas to the array
+ if ($postdata['confirmed'] ?? '' != '') {
+ $confirmedIota = $this->getIotaBandConfirmed($location_list, $band, $postdata);
+ foreach ($confirmedIota as $ciota) {
+ $iotaMatrix[$ciota->tag][$band] = '';
+ }
+ }
+ }
- // We want to remove the worked iotas in the list, since we do not want to display them
- if ($postdata['worked'] == NULL) {
- $workedIota = $this->getIotaWorked($location_list, $postdata);
- foreach ($workedIota as $wiota) {
- if (array_key_exists($wiota->tag, $iotaMatrix)) {
- unset($iotaMatrix[$wiota->tag]);
- }
- }
- }
+ // We want to remove the worked iotas in the list, since we do not want to display them
+ if ($postdata['worked'] ?? '' == '') {
+ $workedIota = $this->getIotaWorked($location_list, $postdata);
+ foreach ($workedIota as $wiota) {
+ if (array_key_exists($wiota->tag, $iotaMatrix)) {
+ unset($iotaMatrix[$wiota->tag]);
+ }
+ }
+ }
- // We want to remove the confirmed iotas in the list, since we do not want to display them
- if ($postdata['confirmed'] == NULL) {
- $confirmedIOTA = $this->getIotaConfirmed($location_list, $postdata);
- foreach ($confirmedIOTA as $ciota) {
- if (array_key_exists($ciota->tag, $iotaMatrix)) {
- unset($iotaMatrix[$ciota->tag]);
- }
- }
- }
+ // We want to remove the confirmed iotas in the list, since we do not want to display them
+ if ($postdata['confirmed'] ?? '' == '') {
+ $confirmedIOTA = $this->getIotaConfirmed($location_list, $postdata);
+ foreach ($confirmedIOTA as $ciota) {
+ if (array_key_exists($ciota->tag, $iotaMatrix)) {
+ unset($iotaMatrix[$ciota->tag]);
+ }
+ }
+ }
- if (isset($iotaMatrix)) {
- return $iotaMatrix;
- }
- else {
- return 0;
- }
- }
+ if (isset($iotaMatrix)) {
+ return $iotaMatrix;
+ } else {
+ return 0;
+ }
+ }
function getIotaBandConfirmed($location_list, $band, $postdata) {
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
@@ -80,7 +79,7 @@ class IOTA extends CI_Model {
$sql .= $this->addBandToQuery($band);
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
@@ -103,7 +102,7 @@ class IOTA extends CI_Model {
$sql .= $this->addBandToQuery($band);
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
@@ -115,47 +114,47 @@ class IOTA extends CI_Model {
}
function fetchIota($postdata) {
- $CI =& get_instance();
- $CI->load->model('logbooks_model');
- $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
+ $CI =& get_instance();
+ $CI->load->model('logbooks_model');
+ $logbooks_locations_array = $CI->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 tag, name, prefix, dxccid, status, lat1, lat2, lon1, lon2 from iota where 1=1";
+ $sql = "select tag, name, prefix, dxccid, status, lat1, lat2, lon1, lon2 from iota where 1=1";
- if ($postdata['includedeleted'] == NULL) {
- $sql .= " and coalesce(iota.status, '') <> 'D'";
- }
+ if ($postdata['includedeleted'] ?? '' == '') {
+ $sql .= " and coalesce(iota.status, '') <> 'D'";
+ }
- $sql .= $this->addContinentsToQuery($postdata);
+ $sql .= $this->addContinentsToQuery($postdata);
- if ($postdata['notworked'] == NULL) {
- $sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id in (". $location_list . ") and col_iota = iota.tag";
+ if ($postdata['notworked'] ?? '' == '') {
+ $sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id in (". $location_list . ") and col_iota = iota.tag";
- if ($postdata['mode'] != 'All') {
- $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
- }
+ if ($postdata['mode'] != 'All') {
+ $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
+ }
- if ($postdata['band'] != 'All') {
- if ($postdata['band'] == 'SAT') {
- $sql .= " and col_prop_mode ='" . $postdata['band'] . "'";
- }
- else {
- $sql .= " and col_prop_mode !='SAT'";
- $sql .= " and col_band ='" . $postdata['band'] . "'";
- }
- }
- $sql .= ")";
- }
+ if ($postdata['band'] != 'All') {
+ if ($postdata['band'] == 'SAT') {
+ $sql .= " and col_prop_mode ='" . $postdata['band'] . "'";
+ }
+ else {
+ $sql .= " and col_prop_mode !='SAT'";
+ $sql .= " and col_band ='" . $postdata['band'] . "'";
+ }
+ }
+ $sql .= ")";
+ }
- $sql .= ' order by tag';
- $query = $this->db->query($sql);
+ $sql .= ' order by tag';
+ $query = $this->db->query($sql);
- return $query->result();
+ return $query->result();
}
function getIotaWorked($location_list, $postdata) {
@@ -176,7 +175,7 @@ class IOTA extends CI_Model {
$sql .= $this->addBandToQuery($postdata['band']);
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
@@ -202,7 +201,7 @@ class IOTA extends CI_Model {
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
}
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
@@ -218,31 +217,31 @@ class IOTA extends CI_Model {
// Made function instead of repeating this several times
function addContinentsToQuery($postdata) {
$sql = '';
- if ($postdata['Africa'] == NULL) {
+ if ($postdata['Africa'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'AF'";
}
- if ($postdata['Europe'] == NULL) {
+ if ($postdata['Europe'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'EU'";
}
- if ($postdata['Asia'] == NULL) {
+ if ($postdata['Asia'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'AS'";
}
- if ($postdata['SouthAmerica'] == NULL) {
+ if ($postdata['SouthAmerica'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'SA'";
}
- if ($postdata['NorthAmerica'] == NULL) {
+ if ($postdata['NorthAmerica'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'NA'";
}
- if ($postdata['Oceania'] == NULL) {
+ if ($postdata['Oceania'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'OC'";
}
- if ($postdata['Antarctica'] == NULL) {
+ if ($postdata['Antarctica'] ?? '' == '') {
$sql .= " and left(tag, 2) <> 'AN'";
}
return $sql;
@@ -302,7 +301,7 @@ class IOTA extends CI_Model {
$sql .= " and thcv.col_band ='" . $band . "'";
}
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}
@@ -340,7 +339,7 @@ class IOTA extends CI_Model {
$sql .= " and thcv.col_band ='" . $band . "'";
}
- if ($postdata['includedeleted'] == NULL) {
+ if ($postdata['includedeleted'] ?? '' == '') {
$sql .= " and coalesce(iota.status, '') <> 'D'";
}