diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index b97049ba4..b883fe20d 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -61,6 +61,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')); $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')); $postdata['band'] = $this->security->xss_clean($this->input->post('band')); @@ -70,6 +71,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = 1; $postdata['eqsl'] = 0; $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['band'] = 'All'; @@ -109,25 +111,25 @@ class Awards extends CI_Controller { 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 { + } else { $bands[] = $this->security->xss_clean($this->input->post('band')); } - } - else { + } else { $bands = $data['worked_bands']; } $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $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['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; + $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; + $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; + $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; + $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; + $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')); @@ -140,8 +142,7 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); $postdata['sat'] = $this->security->xss_clean($this->input->post('sats')); $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbits')); - } - else { // Setting default values at first load of page + } else { // Setting default values at first load of page $postdata['qsl'] = 1; $postdata['lotw'] = 1; $postdata['eqsl'] = 0; @@ -182,67 +183,69 @@ class Awards extends CI_Controller { ]; $this->load->model('waja'); - $this->load->model('modes'); - $this->load->model('bands'); + $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('waja'); - $data['modes'] = $this->modes->active(); + $data['worked_bands'] = $this->bands->get_worked_bands('waja'); + $data['modes'] = $this->modes->active(); - 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['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $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['qsl'] = 1; - $postdata['lotw'] = 1; - $postdata['eqsl'] = 0; - $postdata['qrz'] = 0; - $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['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; + $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'; + } - $data['waja_array'] = $this->waja->get_waja_array($bands, $postdata); - $data['waja_summary'] = $this->waja->get_waja_summary($bands, $postdata); + $data['waja_array'] = $this->waja->get_waja_array($bands, $postdata); + $data['waja_summary'] = $this->waja->get_waja_summary($bands, $postdata); // Render Page $data['page_title'] = "Awards - WAJA"; @@ -259,67 +262,66 @@ class Awards extends CI_Controller { ]; $this->load->model('jcc_model'); - $this->load->model('modes'); - $this->load->model('bands'); + $this->load->model('modes'); + $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('jcc'); - $data['modes'] = $this->modes->active(); + $data['worked_bands'] = $this->bands->get_worked_bands('jcc'); + $data['modes'] = $this->modes->active(); - 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['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $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['qsl'] = 1; - $postdata['lotw'] = 1; - $postdata['eqsl'] = 0; - $postdata['qrz'] = 0; - $postdata['worked'] = 1; - $postdata['confirmed'] = 1; - $postdata['notworked'] = 0; - $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['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; + $postdata['worked'] = 1; + $postdata['confirmed'] = 1; + $postdata['notworked'] = 0; + $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'; + } - $data['jcc_array'] = $this->jcc_model->get_jcc_array($bands, $postdata); - $data['jcc_summary'] = $this->jcc_model->get_jcc_summary($bands, $postdata); + $data['jcc_array'] = $this->jcc_model->get_jcc_array($bands, $postdata); + $data['jcc_summary'] = $this->jcc_model->get_jcc_summary($bands, $postdata); // Render Page $data['page_title'] = "Awards - JCC"; @@ -328,86 +330,87 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer', $footerData); } - public function jcc_export() { - $this->load->model('Jcc_model'); - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $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['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + public function jcc_export() { + $this->load->model('Jcc_model'); + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $qsos = $this->Jcc_model->exportJcc($postdata); + $qsos = $this->Jcc_model->exportJcc($postdata); - $fp = fopen( 'php://output', 'w' ); - $i=1; - fputcsv($fp, array('No', 'Callsign', 'Date', 'Band', 'Mode', 'Remarks'), ';'); - foreach ($qsos as $qso) { - fputcsv($fp, array($i, $qso['call'], $qso['date'], ($qso['prop_mode'] != null ? $qso['band'].' / '.$qso['prop_mode'] : $qso['band']), $qso['mode'], $qso['cnty'].' - '.$qso['jcc']), ';'); - $i++; - } - fclose($fp); - return; - } + $fp = fopen( 'php://output', 'w' ); + $i=1; + fputcsv($fp, array('No', 'Callsign', 'Date', 'Band', 'Mode', 'Remarks'), ';'); + foreach ($qsos as $qso) { + fputcsv($fp, array($i, $qso['call'], $qso['date'], ($qso['prop_mode'] != null ? $qso['band'].' / '.$qso['prop_mode'] : $qso['band']), $qso['mode'], $qso['cnty'].' - '.$qso['jcc']), ';'); + $i++; + } + fclose($fp); + return; + } - public function jcc_cities() { - $this->load->model('Jcc_model'); - $data = $this->Jcc_model->jccCities(); - header('Content-Type: application/json'); - echo json_encode($data, JSON_PRETTY_PRINT); - } + public function jcc_cities() { + $this->load->model('Jcc_model'); + $data = $this->Jcc_model->jccCities(); + header('Content-Type: application/json'); + echo json_encode($data, JSON_PRETTY_PRINT); + } - public function vucc() { - $this->load->model('vucc'); - $this->load->model('bands'); - $data['worked_bands'] = $this->bands->get_worked_bands('vucc'); + public function vucc() { + $this->load->model('vucc'); + $this->load->model('bands'); + $data['worked_bands'] = $this->bands->get_worked_bands('vucc'); - $data['vucc_array'] = $this->vucc->get_vucc_array($data); + $data['vucc_array'] = $this->vucc->get_vucc_array($data); - // Render Page - $data['page_title'] = "Awards - VUCC"; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/vucc/index'); - $this->load->view('interface_assets/footer'); - } + // Render Page + $data['page_title'] = "Awards - VUCC"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/vucc/index'); + $this->load->view('interface_assets/footer'); + } - public function vucc_band(){ - $this->load->model('vucc'); - $band = str_replace('"', "", $this->security->xss_clean($this->input->get("Band"))); - $type = str_replace('"', "", $this->security->xss_clean($this->input->get("Type"))); - $data['vucc_array'] = $this->vucc->vucc_details($band, $type); - $data['type'] = $type; + public function vucc_band(){ + $this->load->model('vucc'); + $band = str_replace('"', "", $this->security->xss_clean($this->input->get("Band"))); + $type = str_replace('"', "", $this->security->xss_clean($this->input->get("Type"))); + $data['vucc_array'] = $this->vucc->vucc_details($band, $type); + $data['type'] = $type; - // Render Page - $data['page_title'] = "VUCC - " .$band . " Band"; - $data['filter'] = "band ".$band; - $data['band'] = $band; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/vucc/band'); - $this->load->view('interface_assets/footer'); - } + // Render Page + $data['page_title'] = "VUCC - " .$band . " Band"; + $data['filter'] = "band ".$band; + $data['band'] = $band; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/vucc/band'); + $this->load->view('interface_assets/footer'); + } - public function vucc_details_ajax(){ - $this->load->model('logbook_model'); + public function vucc_details_ajax(){ + $this->load->model('logbook_model'); - $gridsquare = str_replace('"', "", $this->security->xss_clean($this->input->post("Gridsquare"))); - $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); - $data['results'] = $this->logbook_model->vucc_qso_details($gridsquare, $band); + $gridsquare = str_replace('"', "", $this->security->xss_clean($this->input->post("Gridsquare"))); + $band = str_replace('"', "", $this->security->xss_clean($this->input->post("Band"))); + $data['results'] = $this->logbook_model->vucc_qso_details($gridsquare, $band); - // Render Page - $data['page_title'] = "Log View - VUCC"; - $data['filter'] = "vucc " . $gridsquare . " and band ".$band; - $this->load->view('awards/details', $data); - } + // Render Page + $data['page_title'] = "Log View - VUCC"; + $data['filter'] = "vucc " . $gridsquare . " and band ".$band; + $this->load->view('awards/details', $data); + } /* * Used to fetch QSOs from the logbook in the awards */ - public function qso_details_ajax(){ + public function qso_details_ajax() { $this->load->model('logbook_model'); $searchphrase = str_replace('"', "", $this->security->xss_clean($this->input->post("Searchphrase"))); @@ -415,7 +418,7 @@ class Awards extends CI_Controller { $mode = str_replace('"', "", $this->security->xss_clean($this->input->post("Mode"))); $sat = str_replace('"', "", $this->security->xss_clean($this->input->post("Sat"))); $orbit = str_replace('"', "", $this->security->xss_clean($this->input->post("Orbit"))); - $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); + $propagation = str_replace('"', "", $this->security->xss_clean($this->input->post("Propagation")) ?? ''); $type = $this->security->xss_clean($this->input->post('Type')); $qsl = $this->input->post('QSL') == null ? '' : $this->security->xss_clean($this->input->post('QSL')); $searchmode = $this->input->post('searchmode') == null ? '' : $this->security->xss_clean($this->input->post('searchmode')); @@ -442,6 +445,9 @@ class Awards extends CI_Controller { if (strpos($qsl, "Z") !== false) { $qsltype[] = "QRZ.com"; } + if (strpos($qsl, "C") !== false) { + $qsltype[] = "Clublog"; + } // Render Page $data['page_title'] = "Log View - " . $type; @@ -454,9 +460,9 @@ class Awards extends CI_Controller { $data['filter'] .= " and orbit type ".$orbit; } } - if ($propagation != '' && $propagation != null) { - $data['filter'] .= " and propagation ".$propagation; - } + if ($propagation != '' && $propagation != null) { + $data['filter'] .= " and propagation ".$propagation; + } if ($mode != null && strtolower($mode) != 'all') { $data['filter'] .= " and mode ".$mode; } @@ -524,9 +530,8 @@ class Awards extends CI_Controller { 'assets/js/sections/cqmap.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/cqmap.js")) ]; - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->load->model('cq'); $this->load->model('modes'); @@ -774,7 +779,7 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer', $footerData); } - public function iota () { + public function iota () { $this->load->model('iota'); $this->load->model('modes'); $this->load->model('bands'); @@ -795,6 +800,11 @@ class Awards extends CI_Controller { $data['modes'] = $this->modes->active(); // Used in the view for mode select if($this->input->method() === 'post') { + $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; + $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['worked'] = $this->security->xss_clean($this->input->post('worked')) ?? NULL; $postdata['confirmed'] = $this->security->xss_clean($this->input->post('confirmed')) ?? NULL; $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')) ?? NULL; @@ -809,6 +819,11 @@ class Awards extends CI_Controller { $postdata['band'] = $this->security->xss_clean($this->input->post('band')) ?? NULL; $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')) ?? NULL; } else { // Setting default values at first load of page + $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; + $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -1316,9 +1331,8 @@ class Awards extends CI_Controller { This displays the CQ Zone map and requires the $band_type and $mode_type */ public function cq_map() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->load->model('cq'); @@ -1328,6 +1342,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; @@ -1384,6 +1399,7 @@ class Awards extends CI_Controller { $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; $postdata['band'] = $this->security->xss_clean($this->input->post('band')); @@ -1436,6 +1452,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; @@ -1479,34 +1496,35 @@ class Awards extends CI_Controller { This displays the DXCC map */ public function jcc_map() { - $this->load->model('jcc_model'); - $this->load->model('bands'); + $this->load->model('jcc_model'); + $this->load->model('bands'); - $bands[] = $this->security->xss_clean($this->input->post('band')); + $bands[] = $this->security->xss_clean($this->input->post('band')); - $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; - $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; - $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; - $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; - $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; - $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; - $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; - $postdata['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['qsl'] = $this->input->post('qsl') == 0 ? NULL: 1; + $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; + $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; + $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; + $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; + $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; + $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; + $postdata['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - $jcc_wkd = $this->jcc_model->fetch_jcc_wkd($postdata); - $jcc_cnfm = $this->jcc_model->fetch_jcc_cnfm($postdata); + $jcc_wkd = $this->jcc_model->fetch_jcc_wkd($postdata); + $jcc_cnfm = $this->jcc_model->fetch_jcc_cnfm($postdata); - $jccs = []; - foreach ($jcc_wkd as $jcc) { - $jccs[$jcc->COL_CNTY] = array(1, 0); - } - foreach ($jcc_cnfm as $jcc) { - $jccs[$jcc->COL_CNTY][1] = 1; - } + $jccs = []; + foreach ($jcc_wkd as $jcc) { + $jccs[$jcc->COL_CNTY] = array(1, 0); + } + foreach ($jcc_cnfm as $jcc) { + $jccs[$jcc->COL_CNTY][1] = 1; + } - header('Content-Type: application/json'); - echo json_encode($jccs); + header('Content-Type: application/json'); + echo json_encode($jccs); } /* @@ -1525,7 +1543,7 @@ class Awards extends CI_Controller { $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; $postdata['band'] = $this->input->post('band'); - $postdata['mode'] = $this->input->post('mode'); + $postdata['mode'] = $this->input->post('mode'); $postdata['includedeleted'] = $this->input->post('includedeleted') == 0 ? NULL: 1; $postdata['Africa'] = $this->input->post('Africa') == 0 ? NULL: 1; $postdata['Asia'] = $this->input->post('Asia') == 0 ? NULL: 1; @@ -1575,89 +1593,97 @@ class Awards extends CI_Controller { } } - public function wab() { - $this->load->model('bands'); - $this->load->model('gridmap_model'); - $this->load->model('stations'); + public function wab() { + $this->load->model('bands'); + $this->load->model('gridmap_model'); + $this->load->model('stations'); - $data['modes'] = $this->gridmap_model->get_worked_modes(); - $data['bands'] = $this->bands->get_worked_bands(); - $data['orbits'] = $this->bands->get_worked_orbits(); - $data['sats_available'] = $this->bands->get_worked_sats(); + $data['modes'] = $this->gridmap_model->get_worked_modes(); + $data['bands'] = $this->bands->get_worked_bands(); + $data['orbits'] = $this->bands->get_worked_orbits(); + $data['sats_available'] = $this->bands->get_worked_sats(); - $data['user_default_band'] = $this->session->userdata('user_default_band'); - $data['user_default_confirmation'] = $this->session->userdata('user_default_confirmation'); + $data['user_default_band'] = $this->session->userdata('user_default_band'); + $data['user_default_confirmation'] = $this->session->userdata('user_default_confirmation'); - $footerData = []; - $footerData['scripts'] = [ - 'assets/js/sections/wab.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wab.js")) - ]; + $footerData = []; + $footerData['scripts'] = [ + 'assets/js/sections/wab.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/wab.js")) + ]; - // Render page - $data['page_title'] = "Awards - Worked All Britain"; - $this->load->view('interface_assets/header', $data); - $this->load->view('awards/wab/index'); - $this->load->view('interface_assets/footer', $footerData); - } + // Render page + $data['page_title'] = "Awards - Worked All Britain"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/wab/index'); + $this->load->view('interface_assets/footer', $footerData); + } - public function wab_map() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); - $sat = $this->security->xss_clean($this->input->post('sat')); - $orbit = $this->security->xss_clean($this->input->post('orbit')); + public function wab_map() { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->load->model('wab'); + $this->load->model('wab'); - if ($logbooks_locations_array) { - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $wab_array = $this->wab->get_wab_array($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); - } else { - $location_list = null; - $wab_array = null; - } + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $wab_array = $this->wab->get_wab_array($location_list, $postdata); + } else { + $location_list = null; + $wab_array = null; + } - header('Content-Type: application/json'); - echo json_encode($wab_array); - } + header('Content-Type: application/json'); + echo json_encode($wab_array); + } - public function wab_list() { - $band = $this->security->xss_clean($this->input->post('band')); - $mode = $this->security->xss_clean($this->input->post('mode')); - $qsl = $this->security->xss_clean($this->input->post('qsl')); - $lotw = $this->security->xss_clean($this->input->post('lotw')); - $eqsl = $this->security->xss_clean($this->input->post('eqsl')); - $qrz = $this->security->xss_clean($this->input->post('qrz')); - $sat = $this->security->xss_clean($this->input->post('sat')); - $orbit = $this->security->xss_clean($this->input->post('orbit')); + public function wab_list() { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['band'] = $this->security->xss_clean($this->input->post('band')); + $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['sat'] = $this->security->xss_clean($this->input->post('sat')); + $postdata['orbit'] = $this->security->xss_clean($this->input->post('orbit')); - $this->load->model('logbooks_model'); - $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - $this->load->model('wab'); + $this->load->model('wab'); - if ($logbooks_locations_array) { - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $wab_array = $this->wab->get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); - } else { - $location_list = null; - $wab_array = null; - } + if ($logbooks_locations_array) { + $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $wab_array = $this->wab->get_wab_list($location_list, $postdata); + } else { + $location_list = null; + $wab_array = null; + } - $data['wab_array'] = $wab_array; - $data['postdata']['band'] = $band; - $data['postdata']['mode'] = $mode; - $data['postdata']['sat'] = $sat; - $data['postdata']['orbit'] = $orbit; + $data['wab_array'] = $wab_array; + $data['postdata']['band'] = $postdata['band']; + $data['postdata']['mode'] = $postdata['mode']; + $data['postdata']['sat'] = $postdata['sat']; + $data['postdata']['orbit'] = $postdata['orbit']; - $this->load->view('awards/wab/list', $data); - } + $this->load->view('awards/wab/list', $data); + } public function itu() { $footerData = []; @@ -1690,22 +1716,24 @@ class Awards extends CI_Controller { $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view - if($this->input->method() === 'post') { - $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); - $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); - $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); - $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); - $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['band'] = $this->security->xss_clean($this->input->post('band')); - $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); - } + if($this->input->method() === 'post') { + $postdata['qsl'] = $this->security->xss_clean($this->input->post('qsl')); + $postdata['lotw'] = $this->security->xss_clean($this->input->post('lotw')); + $postdata['eqsl'] = $this->security->xss_clean($this->input->post('eqsl')); + $postdata['qrz'] = $this->security->xss_clean($this->input->post('qrz')); + $postdata['clublog'] = $this->security->xss_clean($this->input->post('clublog')); + $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['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['qsl'] = 1; $postdata['lotw'] = 1; $postdata['eqsl'] = 0; $postdata['qrz'] = 0; + $postdata['clublog'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -1746,6 +1774,7 @@ class Awards extends CI_Controller { $postdata['lotw'] = $this->input->post('lotw') == 0 ? NULL: 1; $postdata['eqsl'] = $this->input->post('eqsl') == 0 ? NULL: 1; $postdata['qrz'] = $this->input->post('qrz') == 0 ? NULL: 1; + $postdata['clublog'] = $this->input->post('clublog') == 0 ? NULL: 1; $postdata['worked'] = $this->input->post('worked') == 0 ? NULL: 1; $postdata['confirmed'] = $this->input->post('confirmed') == 0 ? NULL: 1; $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; diff --git a/application/controllers/Cfdexport.php b/application/controllers/Cfdexport.php index 7290cf214..8f9164a51 100644 --- a/application/controllers/Cfdexport.php +++ b/application/controllers/Cfdexport.php @@ -34,7 +34,6 @@ class Cfdexport extends CI_Controller { $fromdate = xss_clean($this->input->post('from')); $todate = xss_clean($this->input->post('to')); - $this->load->library('frequency'); // Get QSOs with Valid QRAs $qsos = $this->logbook_model->cfd_get_all_qsos($fromdate, $todate); $output=strtoupper($this->session->userdata('user_callsign'))."\n"; diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 006937caf..836919ee4 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -1302,7 +1302,6 @@ class Logbook extends CI_Controller { 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 text-bg-light">'; $ret.=sprintf("%03d", $row->COL_STX); $ret.= '';} if ($row->COL_STX_STRING) { $ret.= ' COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">' . $row->COL_STX_STRING . '';} $ret.= ''; break; @@ -1315,7 +1314,7 @@ class Logbook extends CI_Controller { 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 'Frequency': $ret.= ''; if($row->COL_SAT_NAME != null) { $ret.= ''.$row->COL_SAT_NAME.''; } else { if($row->COL_FREQ != null) { $ret.= $this->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; } diff --git a/application/controllers/Oqrs.php b/application/controllers/Oqrs.php index e59da7ff9..effb3d740 100644 --- a/application/controllers/Oqrs.php +++ b/application/controllers/Oqrs.php @@ -83,9 +83,8 @@ class Oqrs extends CI_Controller { public function requests() { $data['page_title'] = "OQRS Requests"; - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); if ($logbooks_locations_array) { $location_list = "'".implode("','",$logbooks_locations_array)."'"; diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 6b331ce2a..f8226f956 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -430,7 +430,6 @@ class QSO extends CI_Controller { function band_to_freq($band, $mode) { if ($band != null and $band != 'null') { - $this->load->library('frequency'); echo $this->frequency->convert_band($band, $mode); } diff --git a/application/controllers/Sattimers.php b/application/controllers/Sattimers.php index 00934b866..dcd1a6127 100644 --- a/application/controllers/Sattimers.php +++ b/application/controllers/Sattimers.php @@ -43,11 +43,10 @@ class Sattimers extends CI_Controller { $data['page_title'] = __("Satellite Timers"); - $CI =& get_instance(); - if($CI->session->userdata('user_date_format')) { - $data['custom_date_format'] = $CI->session->userdata('user_date_format'); + if($this->session->userdata('user_date_format')) { + $data['custom_date_format'] = $this->session->userdata('user_date_format'); } else { - $data['custom_date_format'] = $CI->config->item('qso_date_format'); + $data['custom_date_format'] = $this->config->item('qso_date_format'); } switch ($data['custom_date_format']) { diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index e2374d00e..26fcd0022 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -26,6 +26,7 @@ class Clublog_model extends CI_Model error_reporting(E_ALL); $this->load->helper('file'); + $this->load->library('AdifHelper'); $station_profiles = $this->all_with_count($clean_userid); diff --git a/application/models/Iota.php b/application/models/Iota.php index a70e5e530..e2de71761 100644 --- a/application/models/Iota.php +++ b/application/models/Iota.php @@ -5,360 +5,325 @@ class IOTA extends CI_Model { $this->load->library('Genfunctions'); } - 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')); + function get_iota_array($iotaArray, $bands, $postdata) { + $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)."'"; + 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] = '
tag.'","'. $band . '","All","All","'. $postdata['mode'] . '","IOTA")\'>W
'; + } + } - // 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] = '
tag.'","'. $band . '","All","All","'. $postdata['mode'] . '","IOTA")\'>W
'; - } - } + // 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] = '
tag.'","'. $band . '","All","All","'. $postdata['mode'] . '","IOTA")\'>C
'; + } + } + } - // 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] = '
tag.'","'. $band . '","All","All","'. $postdata['mode'] . '","IOTA")\'>C
'; - } - } - } + // 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'] == 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 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'] == NULL) { - $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 UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + function getIotaBandConfirmed($location_list, $band, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($band); - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->genfunctions->addQslToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function getIotaBandWorked($location_list, $band, $postdata) { - $sql = 'SELECT distinct UPPER(col_iota) as tag FROM ' . $this->config->item('table_name'). ' thcv - join iota on thcv.col_iota = iota.tag - where station_id in (' . $location_list . - ') and thcv.col_iota is not null'; + function getIotaBandWorked($location_list, $band, $postdata) { + $sql = 'SELECT distinct UPPER(col_iota) as tag FROM ' . $this->config->item('table_name'). ' thcv + join iota on thcv.col_iota = iota.tag + where station_id in (' . $location_list . + ') and thcv.col_iota is not null'; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($band); - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - 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')); + function fetchIota($postdata) { + $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)."'"; - $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'] == NULL) { + $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'] == 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['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) { - $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list . - " and col_iota = thcv.col_iota"; + function getIotaWorked($location_list, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null + and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list . " and col_iota = thcv.col_iota)"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y'))"; - - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - function getIotaConfirmed($location_list, $postdata) { - $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv - join iota on thcv.col_iota = iota.tag - where station_id in (" . $location_list . - ") and thcv.col_iota is not null - and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + function getIotaConfirmed($location_list, $postdata) { + $sql = "SELECT distinct UPPER(col_iota) as tag FROM " . $this->config->item('table_name') . " thcv + join iota on thcv.col_iota = iota.tag + where station_id in (" . $location_list . ") and thcv.col_iota is not null"; + $sql .= $this->genfunctions->addQslToQuery($postdata); if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } - $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->addContinentsToQuery($postdata); - $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); + $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - // Made function instead of repeating this several times - function addContinentsToQuery($postdata) { - $sql = ''; - if ($postdata['Africa'] == NULL) { - $sql .= " and left(tag, 2) <> 'AF'"; - } + // Made function instead of repeating this several times + function addContinentsToQuery($postdata) { + $sql = ''; + if ($postdata['Africa'] == NULL) { + $sql .= " and left(tag, 2) <> 'AF'"; + } - if ($postdata['Europe'] == NULL) { - $sql .= " and left(tag, 2) <> 'EU'"; - } + if ($postdata['Europe'] == NULL) { + $sql .= " and left(tag, 2) <> 'EU'"; + } - if ($postdata['Asia'] == NULL) { - $sql .= " and left(tag, 2) <> 'AS'"; - } + if ($postdata['Asia'] == NULL) { + $sql .= " and left(tag, 2) <> 'AS'"; + } - if ($postdata['SouthAmerica'] == NULL) { - $sql .= " and left(tag, 2) <> 'SA'"; - } + if ($postdata['SouthAmerica'] == NULL) { + $sql .= " and left(tag, 2) <> 'SA'"; + } - if ($postdata['NorthAmerica'] == NULL) { - $sql .= " and left(tag, 2) <> 'NA'"; - } + if ($postdata['NorthAmerica'] == NULL) { + $sql .= " and left(tag, 2) <> 'NA'"; + } - if ($postdata['Oceania'] == NULL) { - $sql .= " and left(tag, 2) <> 'OC'"; - } + if ($postdata['Oceania'] == NULL) { + $sql .= " and left(tag, 2) <> 'OC'"; + } - if ($postdata['Antarctica'] == NULL) { - $sql .= " and left(tag, 2) <> 'AN'"; - } - return $sql; - } + if ($postdata['Antarctica'] == NULL) { + $sql .= " and left(tag, 2) <> 'AN'"; + } + return $sql; + } - /* - * Function gets worked and confirmed summary on each band on the active stationprofile - */ - function get_iota_summary($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')); + /* + * Function gets worked and confirmed summary on each band on the active stationprofile + */ + function get_iota_summary($bands, $postdata) { + $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)."'"; - foreach ($bands as $band) { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); - $iotaSummary['worked'][$band] = $worked[0]->count; - $iotaSummary['confirmed'][$band] = $confirmed[0]->count; - } + foreach ($bands as $band) { + $worked = $this->getSummaryByBand($band, $postdata, $location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $iotaSummary['worked'][$band] = $worked[0]->count; + $iotaSummary['confirmed'][$band] = $confirmed[0]->count; + } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); - $iotaSummary['worked']['Total'] = $workedTotal[0]->count; - $iotaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; + $iotaSummary['worked']['Total'] = $workedTotal[0]->count; + $iotaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; - return $iotaSummary; - } - - function getSummaryByBand($band, $postdata, $location_list) - { - $sql = "SELECT count(distinct UPPER(thcv.col_iota)) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= ' join iota on thcv.col_iota = iota.tag'; - - $sql .= " where station_id in (" . $location_list . ")"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - } else if ($band == 'All') { - $this->load->model('bands'); + return $iotaSummary; + } + function getSummaryByBand($band, $postdata, $location_list) { + $sql = "SELECT count(distinct UPPER(thcv.col_iota)) as count FROM " . $this->config->item('table_name') . " thcv"; + $sql .= ' join iota on thcv.col_iota = iota.tag'; + $sql .= " where station_id in (" . $location_list . ")"; + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else if ($band == 'All') { + $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('iota'); - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band ='" . $band . "'"; - } - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } + $sql .= $this->addContinentsToQuery($postdata); + $query = $this->db->query($sql); + return $query->result(); + } - $sql .= $this->addContinentsToQuery($postdata); - - $query = $this->db->query($sql); - - return $query->result(); - } - - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { - $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= ' join iota on thcv.col_iota = iota.tag'; - - $sql .= " where station_id in (" . $location_list . ")"; - - if ($band == 'SAT') { - $sql .= " and thcv.col_prop_mode ='" . $band . "'"; - } else if ($band == 'All') { - $this->load->model('bands'); - + function getSummaryByBandConfirmed($band, $postdata, $location_list) { + $sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv"; + $sql .= ' join iota on thcv.col_iota = iota.tag'; + $sql .= " where station_id in (" . $location_list . ")"; + if ($band == 'SAT') { + $sql .= " and thcv.col_prop_mode ='" . $band . "'"; + } else if ($band == 'All') { + $this->load->model('bands'); $bandslots = $this->bands->get_worked_bands('iota'); - $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; - } else { - $sql .= " and thcv.col_prop_mode !='SAT'"; - $sql .= " and thcv.col_band ='" . $band . "'"; - } - - if ($postdata['includedeleted'] == NULL) { - $sql .= " and coalesce(iota.status, '') <> 'D'"; - } - + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; + } else { + $sql .= " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band ='" . $band . "'"; + } + if ($postdata['includedeleted'] == NULL) { + $sql .= " and coalesce(iota.status, '') <> 'D'"; + } if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } + $sql .= $this->addContinentsToQuery($postdata); + $sql .= $this->genfunctions->addQslToQuery($postdata); + log_message("Error",$sql); + $query = $this->db->query($sql); - $sql .= $this->addContinentsToQuery($postdata); - - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; - - $query = $this->db->query($sql); - - return $query->result(); - } + return $query->result(); + } } ?> diff --git a/application/models/Jcc_model.php b/application/models/Jcc_model.php index 7d99f4868..788a5fe90 100644 --- a/application/models/Jcc_model.php +++ b/application/models/Jcc_model.php @@ -2,8 +2,13 @@ class Jcc_model extends CI_Model { + + private $location_list=null; function __construct() { $this->load->library('Genfunctions'); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->location_list = "'".implode("','",$logbooks_locations_array)."'"; } public $jaCities = array( @@ -924,14 +929,6 @@ class Jcc_model extends CI_Model { ); function get_jcc_array($bands, $postdata) { - $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; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $jccArray = array_keys($this->jaCities); @@ -951,14 +948,14 @@ class Jcc_model extends CI_Model { } if ($postdata['worked'] != NULL) { - $jccBand = $this->getJccWorked($location_list, $band, $postdata); + $jccBand = $this->getJccWorked($this->location_list, $band, $postdata); foreach ($jccBand as $line) { $bandJcc[$line->col_cnty][$band] = '
col_cnty . '","' . $band . '","All","All","'. $postdata['mode'] . '","JCC", "")\'>W
'; $cities[$line->col_cnty]['count']++; } } if ($postdata['confirmed'] != NULL) { - $jccBand = $this->getJccConfirmed($location_list, $band, $postdata); + $jccBand = $this->getJccConfirmed($this->location_list, $band, $postdata); foreach ($jccBand as $line) { $bandJcc[$line->col_cnty][$band] = '
col_cnty . '","' . $band . '","All","All","'. $postdata['mode'] . '","JCC", "'.$qsl.'")\'>C
'; $cities[$line->col_cnty]['count']++; @@ -968,7 +965,7 @@ class Jcc_model extends CI_Model { // We want to remove the worked cities in the list, since we do not want to display them if ($postdata['worked'] == NULL) { - $jccBand = $this->getJccWorked($location_list, $postdata['band'], $postdata); + $jccBand = $this->getJccWorked($this->location_list, $postdata['band'], $postdata); foreach ($jccBand as $line) { unset($bandJcc[$line->col_cnty]); } @@ -976,7 +973,7 @@ class Jcc_model extends CI_Model { // We want to remove the confirmed cities in the list, since we do not want to display them if ($postdata['confirmed'] == NULL) { - $wasBand = $this->getJccConfirmed($location_list, $postdata['band'], $postdata); + $wasBand = $this->getJccConfirmed($this->location_list, $postdata['band'], $postdata); foreach ($wasBand as $line) { unset($bandJcc[$line->col_cnty]); } @@ -994,8 +991,7 @@ class Jcc_model extends CI_Model { if (isset($bandJcc)) { return $bandJcc; - } - else { + } else { return 0; } } @@ -1006,7 +1002,6 @@ class Jcc_model extends CI_Model { select col_dxcc from ".$this->config->item('table_name')." thcv where station_id in (" . $location_list . ") and col_dxcc > 0"; - $sql .= $this->genfunctions->addBandToQuery($band); if ($postdata['mode'] != 'All') { @@ -1014,7 +1009,6 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= " group by col_dxcc ) x on dxcc_entities.adif = x.col_dxcc"; @@ -1065,9 +1059,7 @@ class Jcc_model extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= " and not exists (select 1 from ". $this->config->item('table_name') . " where station_id in (". $location_list . ")" . " and col_cnty = thcv.col_cnty"; @@ -1077,11 +1069,8 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $sql .= ")"; $query = $this->db->query($sql); @@ -1116,35 +1105,25 @@ class Jcc_model extends CI_Model { /* * Function gets worked and confirmed summary on each band on the active stationprofile */ - function get_jcc_summary($bands, $postdata) - { - $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; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - + function get_jcc_summary($bands, $postdata) { foreach ($bands as $band) { if ($band != 'SAT') { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $worked = $this->getSummaryByBand($band, $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $this->location_list); $jccSummary['worked'][$band] = $worked[0]->count; $jccSummary['confirmed'][$band] = $confirmed[0]->count; } } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list); $jccSummary['worked']['Total'] = $workedTotal[0]->count; $jccSummary['confirmed']['Total'] = $confirmedTotal[0]->count; if (in_array('SAT', $bands)) { - $worked = $this->getSummaryByBand('SAT', $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed('SAT', $postdata, $location_list); + $worked = $this->getSummaryByBand('SAT', $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed('SAT', $postdata, $this->location_list); $jccSummary['worked']['SAT'] = $worked[0]->count; $jccSummary['confirmed']['SAT'] = $confirmed[0]->count; } @@ -1152,19 +1131,15 @@ class Jcc_model extends CI_Model { return $jccSummary; } - function getSummaryByBand($band, $postdata, $location_list) - { + function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); - $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . @@ -1185,19 +1160,15 @@ class Jcc_model extends CI_Model { return $query->result(); } - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { + function getSummaryByBandConfirmed($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_cnty) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); - $bandslots_list = "'".implode("','",$bandslots)."'"; $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . @@ -1212,11 +1183,8 @@ class Jcc_model extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $query = $this->db->query($sql); - return $query->result(); } @@ -1230,17 +1198,8 @@ class Jcc_model extends CI_Model { } function exportJcc($postdata) { - $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; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - $sql = "SELECT distinct col_cnty FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ")"; + where station_id in (" . $this->location_list . ")"; if ($postdata['mode'] != 'All') { $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; @@ -1259,7 +1218,7 @@ class Jcc_model extends CI_Model { } $qsos = array(); foreach($jccs as $jcc) { - $qso = $this->getFirstQso($location_list, $jcc, $postdata); + $qso = $this->getFirstQso($this->location_list, $jcc, $postdata); $qsos[] = array('call' => $qso[0]->COL_CALL, 'date' => $qso[0]->COL_TIME_ON, 'band' => $qso[0]->COL_BAND, 'mode' => $qso[0]->COL_MODE, 'prop_mode' => $qso[0]->COL_PROP_MODE, 'cnty' => $qso[0]->COL_CNTY, 'jcc' => $this->jaCities[$qso[0]->COL_CNTY]['name']); } @@ -1282,7 +1241,8 @@ class Jcc_model extends CI_Model { } function fetch_jcc_wkd($postdata) { - $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1'; + $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1 + and station_id in ('.$this->location_list.')'; $sql .= $this->addStateToQuery(); $sql .= $this->genfunctions->addBandToQuery($postdata['band']); if ($postdata['mode'] != 'All') { @@ -1294,7 +1254,8 @@ class Jcc_model extends CI_Model { } function fetch_jcc_cnfm($postdata) { - $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1'; + $sql = 'SELECT DISTINCT `COL_CNTY` FROM '.$this->config->item('table_name').' WHERE 1 + and station_id in ('.$this->location_list.')'; $sql .= $this->addStateToQuery(); $sql .= $this->genfunctions->addBandToQuery($postdata['band']); if ($postdata['mode'] != 'All') { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 7c83aab1b..f148b2c3d 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -561,6 +561,9 @@ class Logbook_model extends CI_Model { if (strpos($qsl, "Z") !== false) { $qslfilter[] = 'COL_QRZCOM_QSO_DOWNLOAD_STATUS = "Y"'; } + if (strpos($qsl, "C") !== false) { + $qslfilter[] = 'COL_CLUBLOG_QSO_DOWNLOAD_STATUS = "Y"'; + } $sql = "(".implode(' OR ', $qslfilter).")"; $this->db->where($sql); } @@ -3440,7 +3443,6 @@ function lotw_last_qsl_date($user_id) { return($returner); } - $this->load->library('frequency'); $my_error = ""; // Join date+time diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index f27ee4077..98c4e1344 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -541,7 +541,6 @@ class Logbookadvanced_model extends CI_Model { ", " . $this->config->item('table_name').".COL_FREQ_RX = ?" . " WHERE " . $this->config->item('table_name').".col_primary_key in ? and station_profile.user_id = ?"; - $this->load->library('frequency'); $frequencyBand = $this->frequency->defaultFrequencies[$value]['CW']; $frequencyBandRx = $bandrx == '' ? null : $this->frequency->defaultFrequencies[$bandrx]['CW']; diff --git a/application/models/Pota.php b/application/models/Pota.php index 1c5c8a40f..2a3329392 100644 --- a/application/models/Pota.php +++ b/application/models/Pota.php @@ -3,13 +3,12 @@ class Pota extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $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; - } + return null; + } $this->load->model('bands'); diff --git a/application/models/Sota.php b/application/models/Sota.php index 46d7e5f56..dbd4fc9b0 100644 --- a/application/models/Sota.php +++ b/application/models/Sota.php @@ -3,13 +3,12 @@ class Sota extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $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; - } + return null; + } $this->load->model('bands'); diff --git a/application/models/Wab.php b/application/models/Wab.php index e97980da3..ae8f355c0 100644 --- a/application/models/Wab.php +++ b/application/models/Wab.php @@ -6,13 +6,13 @@ class Wab extends CI_Model { $this->load->library('Genfunctions'); } - function get_wab_array($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { + function get_wab_array($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { $worked = array(); $confirmed = array(); - $worked = $this->getWabWorked($location_list, $band, $mode, $sat, $orbit); + $worked = $this->getWabWorked($location_list, $postdata); - $confirmed = $this->getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + $confirmed = $this->getWabConfirmed($location_list, $postdata); $wabarray = array(); @@ -38,15 +38,15 @@ class Wab extends CI_Model { } return $wabarray; - } + } - function get_wab_list($band, $location_list, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { + function get_wab_list($location_list, $postdata) { $worked = array(); $confirmed = array(); - $worked = $this->getWabWorked($location_list, $band, $mode, $sat, $orbit); + $worked = $this->getWabWorked($location_list, $postdata); - $confirmed = $this->getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit); + $confirmed = $this->getWabConfirmed($location_list, $postdata); $wabarray = array(); @@ -74,91 +74,62 @@ class Wab extends CI_Model { ksort($wabarray); return $wabarray; - } + } - /* - * Function returns all worked, but not confirmed states - * $postdata contains data from the form, in this case Lotw or QSL are used - */ - function getWabWorked($location_list, $band, $mode, $sat, $orbit) { - $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; + /* + * Function returns all worked, but not confirmed states + * $postdata contains data from the form, in this case Lotw or QSL are used + */ + function getWabWorked($location_list, $postdata) { // $mode, $sat, $orbit) { + $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv + where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - if ($band == 'SAT') { - if ($sat != 'All') { - $sql .= " and col_sat_name ='" . $sat . "'"; + if ($postdata['band'] == 'SAT') { + if ($postdata['sat'] != 'All') { + $sql .= " and col_sat_name ='" . $postdata['sat'] . "'"; } } - if ($mode != 'All') { - $sql .= " and (col_mode = '" . $mode . "' or col_submode = '" . $mode . "')"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->addOrbitToQuery($orbit); + $sql .= $this->addOrbitToQuery($postdata['orbit']); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } + return $query->result(); + } - /* - * Function returns all confirmed states on given band and on LoTW or QSL - * $postdata contains data from the form, in this case Lotw or QSL are used - */ - function getWabConfirmed($location_list, $band, $mode, $qsl, $lotw, $eqsl, $qrz, $sat, $orbit) { - $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv - where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; + /* + * Function returns all confirmed states on given band and on LoTW or QSL + * $postdata contains data from the form, in this case Lotw or QSL are used + */ + function getWabConfirmed($location_list, $postdata) { // $mode, $qsl, $lotw, $eqsl, $qrz, $clublog, $sat, $orbit) { + $sql = "SELECT distinct col_sig_info FROM " . $this->config->item('table_name') . " thcv + where station_id in (" . $location_list . ") and col_sig = 'WAB' and coalesce(col_sig_info, '') <> ''"; - $sql .= $this->genfunctions->addBandToQuery($band); + $sql .= $this->genfunctions->addBandToQuery($postdata['band']); - if ($band == 'SAT') { - if ($sat != 'All') { - $sql .= " and col_sat_name ='" . $sat . "'"; + if ($postdata['band'] == 'SAT') { + if ($postdata['sat'] != 'All') { + $sql .= " and col_sat_name ='" . $postdata['sat'] . "'"; } } - if ($mode != 'All') { - $sql .= " and (col_mode = '" . $mode . "' or col_submode = '" . $mode . "')"; + if ($postdata['mode'] != 'All') { + $sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')"; } - $sql .= $this->addOrbitToQuery($orbit); + $sql .= $this->addOrbitToQuery($postdata['orbit']); - $sql .= $this->addQslToQuery($qsl, $lotw, $eqsl, $qrz); + $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); + $query = $this->db->query($sql); - return $query->result(); - } - - function addQslToQuery($qsl, $lotw, $eqsl, $qrz) { - $sql = ''; - $qslarray = array(); - if ($qrz != NULL || $lotw != NULL || $qsl != NULL || $eqsl != NULL) { - $sql .= ' and ('; - if ($qsl != NULL) { - array_push($qslarray, "col_qsl_rcvd = 'Y'"); - } - if ($lotw != NULL) { - array_push($qslarray, "col_lotw_qsl_rcvd = 'Y'"); - } - if ($eqsl != NULL) { - array_push($qslarray, "col_eqsl_qsl_rcvd = 'Y'"); - } - if ($qrz != NULL) { - array_push($qslarray, "COL_QRZCOM_QSO_DOWNLOAD_STATUS = 'Y'"); - } - if (count($qslarray) > 0) { - $sql .= implode(' or ', $qslarray); - } else { - $sql .= '1=0'; - } - $sql .= ')'; - } else { - $sql.=' and 1=0'; - } - return $sql; + return $query->result(); } // Adds orbit type to query diff --git a/application/models/Waja.php b/application/models/Waja.php index 6c48fbd3a..4f31bed8d 100644 --- a/application/models/Waja.php +++ b/application/models/Waja.php @@ -2,8 +2,12 @@ class WAJA extends CI_Model { + private $location_list=null; function __construct() { $this->load->library('Genfunctions'); + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->location_list = "'".implode("','",$logbooks_locations_array)."'"; } public $jaPrefectures = array( @@ -56,15 +60,6 @@ class WAJA extends CI_Model { '47' => 'Okinawa'); function get_waja_array($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; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; $wajaArray = array_keys($this->jaPrefectures); @@ -84,14 +79,14 @@ class WAJA extends CI_Model { } if ($postdata['worked'] != NULL) { - $wajaBand = $this->getWajaWorked($location_list, $band, $postdata); + $wajaBand = $this->getWajaWorked($this->location_list, $band, $postdata); foreach ($wajaBand as $line) { $bandWaja[$line->col_state][$band] = '
col_state . '","' . $band . '","All","All","'. $postdata['mode'] . '","WAJA", "")\'>W
'; $prefectures[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { - $wajaBand = $this->getWajaConfirmed($location_list, $band, $postdata); + $wajaBand = $this->getWajaConfirmed($this->location_list, $band, $postdata); foreach ($wajaBand as $line) { $bandWaja[$line->col_state][$band] = '
col_state . '","' . $band . '","All","All","'. $postdata['mode'] . '","WAJA", "'.$qsl.'")\'>C
'; $prefectures[$line->col_state]['count']++; @@ -101,7 +96,7 @@ class WAJA extends CI_Model { // We want to remove the worked states in the list, since we do not want to display them if ($postdata['worked'] == NULL) { - $wajaBand = $this->getWajaWorked($location_list, $postdata['band'], $postdata); + $wajaBand = $this->getWajaWorked($this->location_list, $postdata['band'], $postdata); foreach ($wajaBand as $line) { unset($bandWaja[$line->col_state]); } @@ -109,8 +104,8 @@ class WAJA extends CI_Model { // We want to remove the confirmed states in the list, since we do not want to display them if ($postdata['confirmed'] == NULL) { - $wasBand = $this->getWajaConfirmed($location_list, $postdata['band'], $postdata); - foreach ($wasBand as $line) { + $wajaBand = $this->getWajaConfirmed($this->location_list, $postdata['band'], $postdata); + foreach ($wajaBand as $line) { unset($bandWaja[$line->col_state]); } } @@ -125,8 +120,7 @@ class WAJA extends CI_Model { if (isset($bandWaja)) { return $bandWaja; - } - else { + } else { return 0; } } @@ -196,7 +190,6 @@ class WAJA extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); $sql .= " and not exists (select 1 from ". $this->config->item('table_name') . @@ -208,13 +201,9 @@ class WAJA extends CI_Model { } $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $sql .= ")"; - $query = $this->db->query($sql); return $query->result(); @@ -233,41 +222,26 @@ class WAJA extends CI_Model { } $sql .= $this->addStateToQuery(); - $sql .= $this->genfunctions->addBandToQuery($band); - $sql .= $this->genfunctions->addQslToQuery($postdata); - $query = $this->db->query($sql); return $query->result(); } - /* * Function gets worked and confirmed summary on each band on the active stationprofile */ - function get_waja_summary($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; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - + function get_waja_summary($bands, $postdata) { foreach ($bands as $band) { - $worked = $this->getSummaryByBand($band, $postdata, $location_list); - $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list); + $worked = $this->getSummaryByBand($band, $postdata, $this->location_list); + $confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $this->location_list); $wajaSummary['worked'][$band] = $worked[0]->count; $wajaSummary['confirmed'][$band] = $confirmed[0]->count; } - $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list); - $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list); + $workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $this->location_list); + $confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $this->location_list); $wajaSummary['worked']['Total'] = $workedTotal[0]->count; $wajaSummary['confirmed']['Total'] = $confirmedTotal[0]->count; @@ -275,10 +249,8 @@ class WAJA extends CI_Model { return $wajaSummary; } - function getSummaryByBand($band, $postdata, $location_list) - { + function getSummaryByBand($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { @@ -286,12 +258,12 @@ class WAJA extends CI_Model { } else if ($band == 'All') { $this->load->model('bands'); - $bandslots = $this->bands->get_worked_bands('was'); + $bandslots = $this->bands->get_worked_bands('waja'); $bandslots_list = "'".implode("','",$bandslots)."'"; - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -308,23 +280,18 @@ class WAJA extends CI_Model { return $query->result(); } - function getSummaryByBandConfirmed($band, $postdata, $location_list) - { + function getSummaryByBandConfirmed($band, $postdata, $location_list) { $sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv"; - $sql .= " where station_id in (" . $location_list . ")"; if ($band == 'SAT') { $sql .= " and thcv.col_prop_mode ='" . $band . "'"; } else if ($band == 'All') { $this->load->model('bands'); - - $bandslots = $this->bands->get_worked_bands('was'); - + $bandslots = $this->bands->get_worked_bands('waja'); $bandslots_list = "'".implode("','",$bandslots)."'"; - - $sql .= " and thcv.col_band in (" . $bandslots_list . ")" . - " and thcv.col_prop_mode !='SAT'"; + $sql .= " and thcv.col_band in (" . $bandslots_list . ")"; + $sql .= " and thcv.col_prop_mode !='SAT'"; } else { $sql .= " and thcv.col_prop_mode !='SAT'"; $sql .= " and thcv.col_band ='" . $band . "'"; @@ -335,9 +302,7 @@ class WAJA extends CI_Model { } $sql .= $this->genfunctions->addQslToQuery($postdata); - $sql .= $this->addStateToQuery(); - $query = $this->db->query($sql); return $query->result(); diff --git a/application/models/Wwff.php b/application/models/Wwff.php index e15584c3b..a17b70a48 100644 --- a/application/models/Wwff.php +++ b/application/models/Wwff.php @@ -3,13 +3,12 @@ class Wwff extends CI_Model { function get_all() { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $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; - } + return null; + } $this->load->model('bands'); diff --git a/application/views/adif/data/clublog.php b/application/views/adif/data/clublog.php index 3f44b6bbc..46783add1 100644 --- a/application/views/adif/data/clublog.php +++ b/application/views/adif/data/clublog.php @@ -5,9 +5,7 @@ Wavelog ADIF export load->library('AdifHelper'); foreach ($qsos->result() as $qso) { - echo $CI->adifhelper->getAdifLine($qso); + echo $this->adifhelper->getAdifLine($qso); } diff --git a/application/views/awards/dok/index.php b/application/views/awards/dok/index.php index 7f6fea972..4d2dc3a32 100644 --- a/application/views/awards/dok/index.php +++ b/application/views/awards/dok/index.php @@ -66,6 +66,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index d4c6c126e..df57df266 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -72,6 +72,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/awards/iota/index.php b/application/views/awards/iota/index.php index fe9bbf40c..15ce2fb61 100644 --- a/application/views/awards/iota/index.php +++ b/application/views/awards/iota/index.php @@ -54,7 +54,7 @@
-
+
Continents
input->post('Antarctica') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> > diff --git a/application/views/awards/jcc/index.php b/application/views/awards/jcc/index.php index b8b354099..fbd8d94ba 100644 --- a/application/views/awards/jcc/index.php +++ b/application/views/awards/jcc/index.php @@ -63,6 +63,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> >
+
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/awards/wab/index.php b/application/views/awards/wab/index.php index 4aa9cd277..857e5badd 100644 --- a/application/views/awards/wab/index.php +++ b/application/views/awards/wab/index.php @@ -64,7 +64,7 @@
-
-
-
- '; ?>
+
+ '; ?> + +
diff --git a/application/views/awards/waja/index.php b/application/views/awards/waja/index.php index 11bf3e803..c5bcd38c0 100644 --- a/application/views/awards/waja/index.php +++ b/application/views/awards/waja/index.php @@ -64,6 +64,10 @@ input->post('qrz')) echo ' checked="checked"'; ?> > +
+ input->post('clublog')) echo ' checked="checked"'; ?> > + +
diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 6fa98ba92..40ad0fe5b 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -36,7 +36,6 @@ function echo_table_col($row, $name) { 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': - $ci->load->library('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; diff --git a/application/views/qso/components/previous_contacts.php b/application/views/qso/components/previous_contacts.php index fcdc764ab..8e712ed8c 100644 --- a/application/views/qso/components/previous_contacts.php +++ b/application/views/qso/components/previous_contacts.php @@ -67,7 +67,6 @@ function echo_table_col($row, $name) { 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': - $ci->load->library('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; diff --git a/application/views/view_log/partial/log_ajax.php b/application/views/view_log/partial/log_ajax.php index dd8c205de..012dfb1bd 100644 --- a/application/views/view_log/partial/log_ajax.php +++ b/application/views/view_log/partial/log_ajax.php @@ -36,10 +36,8 @@ function echo_table_col($row, $name) { echo '' . ($ci->qra->echoQrbCalcLink($row->station_gridsquare, $row->COL_VUCC_GRIDS, $row->COL_GRIDSQUARE)) . ''; break; case 'Distance':echo '' . ($row->COL_DISTANCE ? $row->COL_DISTANCE . ' km' : '') . ''; break; case 'Band': - $ci->load->library('frequency'); echo ''; if($row->COL_SAT_NAME ?? '' != '') { echo ''.$row->COL_SAT_NAME.''; } else { if ($row->COL_FREQ ?? ''!= '') { echo ' '. strtolower($row->COL_BAND ?? '').''; } else { echo strtolower($row->COL_BAND ?? ''); } } echo ''; break; case 'Frequency': - $ci->load->library('frequency'); echo ''; if($row->COL_SAT_NAME ?? '' != '') { echo ''; if ($row->COL_FREQ != null) { echo ' '.$row->COL_SAT_NAME.''; } else { echo $row->COL_SAT_NAME; } echo ''; } 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; diff --git a/application/views/visitor/index.php b/application/views/visitor/index.php index adfa26a2f..6978cad2c 100644 --- a/application/views/visitor/index.php +++ b/application/views/visitor/index.php @@ -105,7 +105,6 @@ function echo_table_col($row, $name) echo ''; break; case 'Frequency': - $CI->load->library('frequency'); echo ''; if ($row->COL_FREQ != null) { echo $CI->frequency->hz_to_mhz($row->COL_FREQ); diff --git a/assets/js/sections/iotamap.js b/assets/js/sections/iotamap.js index 683d71d03..7968f2412 100644 --- a/assets/js/sections/iotamap.js +++ b/assets/js/sections/iotamap.js @@ -13,6 +13,9 @@ function load_iota_map() { notworked: +$('#notworked').prop('checked'), qsl: +$('#qsl').prop('checked'), lotw: +$('#lotw').prop('checked'), + eqsl: +$('#eqsl').prop('checked'), + qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), includedeleted: +$('#includedeleted').prop('checked'), Africa: +$('#Africa').prop('checked'), Asia: +$('#Asia').prop('checked'), diff --git a/assets/js/sections/jcc.js b/assets/js/sections/jcc.js index 89bec3c2c..07931f2a7 100644 --- a/assets/js/sections/jcc.js +++ b/assets/js/sections/jcc.js @@ -34,6 +34,7 @@ function export_qsos() { lotw: +$('#lotw').prop('checked'), qrz: +$('#qrz').prop('checked'), eqsl: +$('#eqsl').prop('checked'), + clublog: +$('#clublog').prop('checked'), includedeleted: +$('#includedeleted').prop('checked'), Africa: +$('#Africa').prop('checked'), Asia: +$('#Asia').prop('checked'), diff --git a/assets/js/sections/jccmap.js b/assets/js/sections/jccmap.js index 39bdfdb31..0d314e833 100644 --- a/assets/js/sections/jccmap.js +++ b/assets/js/sections/jccmap.js @@ -14,6 +14,7 @@ function load_jcc_map() { qsl: +$('#qsl').prop('checked'), lotw: +$('#lotw').prop('checked'), qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), eqsl: +$('#eqsl').prop('checked'), }, success: function(data) { diff --git a/assets/js/sections/wajamap.js b/assets/js/sections/wajamap.js index 18ca4d51b..e12df68d8 100644 --- a/assets/js/sections/wajamap.js +++ b/assets/js/sections/wajamap.js @@ -74,6 +74,7 @@ function load_waja_map() { lotw: +$('#lotw').prop('checked'), eqsl: +$('#eqsl').prop('checked'), qrz: +$('#qrz').prop('checked'), + clublog: +$('#clublog').prop('checked'), }, success: function(data) { prefectures = data;