diff --git a/application/controllers/Activated_grids.php b/application/controllers/Activated_grids.php deleted file mode 100644 index 57853c6f..00000000 --- a/application/controllers/Activated_grids.php +++ /dev/null @@ -1,365 +0,0 @@ -lang->load(array( - 'gridsquares', - )); - } - - - public function index() { - // if there are no satellite QSOs redirect to band selection directly - $this->load->model('logbook_model'); - $this->load->model('bands'); - $total_sat = $this->logbook_model->total_sat(); - if ($total_sat->num_rows() == 0) { - redirect('activated_grids/band/2m'); - return; - } - - $data['page_title'] = "Activated Gridsquare Map"; - $data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true); - - $this->load->view('interface_assets/header', $data); - $this->load->view('activated_grids/main.php'); - $this->load->view('interface_assets/footer'); - } - - public function satellites() - { - $this->load->model('activated_grids_model'); - - $data['page_title'] = "Satellite Activated Gridsquare Map"; - - - $array_grid_2char = array(); - $array_grid_4char = array(); - $array_grid_6char = array(); - - - $array_confirmed_grid_2char = array(); - $array_confirmed_grid_4char = array(); - $array_confirmed_grid_6char = array(); - - $grid_2char = ""; - $grid_4char = ""; - $grid_6char = ""; - - $grid_2char_confirmed = ""; - $grid_4char_confirmed = ""; - $grid_6char_confirmed = ""; - - - // Get Confirmed LoTW & Paper Activated Squares (non VUCC) - $query = $this->activated_grids_model->get_activated_confirmed_sat_squares(); - - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - /* Handle VUCC squares */ - if (strpos($row->SAT_SQUARE, ",") > 0) { - $subsquares = explode(",", $row->SAT_SQUARE); - foreach ($subsquares as &$subsquare) { - $grid_two = strtoupper(substr($subsquare,0,2)); - $grid_four = strtoupper(substr($subsquare,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($subsquare,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_two); - } - - if(!in_array($grid_four, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_four); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_confirmed_grid_6char)){ - array_push($array_confirmed_grid_6char, $grid_six); - } - } - } - - } else { - - $grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_2char_confirmed); - } - - if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_4char_confirmed); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_6char_confirmed, $array_confirmed_grid_6char)){ - array_push($array_confirmed_grid_6char, $grid_6char_confirmed); - } - } - - } - - - } - } - - // Get activated squares - $query = $this->activated_grids_model->get_activated_sat_squares(); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - /* Handle VUCC squares */ - if (strpos($row->SAT_SQUARE, ",") > 0) { - $subsquares = explode(",", $row->SAT_SQUARE); - foreach ($subsquares as &$subsquare) { - $grid_two = strtoupper(substr($subsquare,0,2)); - $grid_four = strtoupper(substr($subsquare,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($subsquare,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); - } - } - } - - } else { - - $grid_two = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_four = strtoupper(substr($row->SAT_SQUARE,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($row->SAT_SQUARE,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); - } - } - - } - - - } - } - - function js_str($s) - { - return '"' . addcslashes($s, "\0..\37\"\\") . '"'; - } - - function js_array($array) - { - $temp = array_map('js_str', $array); - return '[' . implode(',', $temp) . ']'; - } - - $data['grid_2char_confirmed'] = js_array($array_confirmed_grid_2char); - $data['grid_4char_confirmed'] = js_array($array_confirmed_grid_4char); - $data['grid_6char_confirmed'] = js_array($array_confirmed_grid_6char); - - $data['grid_2char'] = js_array($array_grid_2char); - $data['grid_4char'] = js_array($array_grid_4char); - $data['grid_6char'] = js_array($array_grid_6char); - - - $this->load->view('interface_assets/header', $data); - $this->load->view('activated_grids/index.php'); - $this->load->view('interface_assets/footer'); - } - - public function band($band) - { - $this->load->model('activated_grids_model'); - - $data['page_title'] = strtoupper($band)." Activated Gridsquare Map"; - - $array_grid_2char = array(); - $array_grid_4char = array(); - $array_grid_6char = array(); - - $array_grid_2char_confirmed = array(); - $array_grid_4char_confirmed = array(); - $array_grid_6char_confirmed = array(); - - $grid_2char = ""; - $grid_4char = ""; - $grid_6char = ""; - - $grid_2char_confirmed = ""; - $grid_4char_confirmed = ""; - $grid_6char_confirmed = ""; - - $query = $this->activated_grids_model->get_band_confirmed($band); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - $grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2)); - $grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); - } - - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)){ - array_push($array_grid_6char_confirmed, $grid_6char_confirmed); - } - } - } - } - - $query = $this->activated_grids_model->get_band($band); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - $grid_two = strtoupper(substr($row->GRID_SQUARES,0,2)); - $grid_four = strtoupper(substr($row->GRID_SQUARES,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($row->GRID_SQUARES,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); - } - } - - - } - } - - function js_str($s) - { - return '"' . addcslashes($s, "\0..\37\"\\") . '"'; - } - - function js_array($array) - { - $temp = array_map('js_str', $array); - return '[' . implode(',', $temp) . ']'; - } - - $data['grid_2char_confirmed'] = js_array($array_grid_2char_confirmed); - $data['grid_4char_confirmed'] = js_array($array_grid_4char_confirmed); - $data['grid_6char_confirmed'] = js_array($array_grid_6char_confirmed); - - $data['grid_2char'] = js_array($array_grid_2char); - $data['grid_4char'] = js_array($array_grid_4char); - $data['grid_6char'] = js_array($array_grid_6char); - - $data['bands_available'] = js_array($this->config->item('bands_available')); - - $this->load->view('interface_assets/header', $data); - $this->load->view('activated_grids/index.php'); - $this->load->view('interface_assets/footer'); - } - - function search_band($band, $gridsquare){ - $this->load->model('activated_grids_model'); - header('Content-Type: application/json'); - $result = $this->activated_grids_model->search_band($band, $gridsquare); - - echo $result; - } - - function search_sat($gridsquare){ - $this->load->model('activated_grids_model'); - header('Content-Type: application/json'); - $result = $this->activated_grids_model->search_sat($gridsquare); - - echo $result; - } - - public function qso_details_ajax(){ - $this->load->model('logbook_model'); - - $searchphrase = str_replace('"', "", $this->input->post("Searchphrase")); - $band = str_replace('"', "", $this->input->post("Band")); - $mode = str_replace('"', "", $this->input->post("Mode")); - - $data['results'] = $this->logbook_model->activated_grids_qso_details($searchphrase, $band, $mode); - - // Render Page - $data['page_title'] = "Log View"; - $data['filter'] = $searchphrase . " and band ".$band . " and mode ".$mode; - $this->load->view('awards/details', $data); - } - -} diff --git a/application/controllers/Gridmap.php b/application/controllers/Gridmap.php index 02b22838..702f0a8c 100644 --- a/application/controllers/Gridmap.php +++ b/application/controllers/Gridmap.php @@ -13,6 +13,7 @@ class Gridmap extends CI_Controller { $this->load->model('gridmap_model'); $this->load->model('stations'); + $data['visitor'] = false; $data['homegrid'] = explode(',', $this->stations->find_gridsquare()); $data['modes'] = $this->gridmap_model->get_worked_modes(); diff --git a/application/controllers/Gridsquares.php b/application/controllers/Gridsquares.php deleted file mode 100644 index 477e78a1..00000000 --- a/application/controllers/Gridsquares.php +++ /dev/null @@ -1,403 +0,0 @@ -lang->load(array( - 'gridsquares', - )); - } - - - public function index() { - // if there are no satellite QSOs redirect to band selection directly - $this->load->model('logbook_model'); - $this->load->model('bands'); - $total_sat = $this->logbook_model->total_sat(); - if ($total_sat->num_rows() == 0) { - redirect('gridsquares/band/2m'); - return; - } - - $data['page_title'] = "Gridsquare Map"; - $data['sat_active'] = array_search("SAT", $this->bands->get_user_bands(), true); - - $this->load->view('interface_assets/header', $data); - $this->load->view('gridsquares/main.php'); - $this->load->view('interface_assets/footer'); - } - - public function satellites() - { - $this->load->model('gridsquares_model'); - - $data['page_title'] = "Satellite Gridsquare Map"; - - - $array_grid_2char = array(); - $array_grid_4char = array(); - $array_grid_6char = array(); - - - $array_confirmed_grid_2char = array(); - $array_confirmed_grid_4char = array(); - $array_confirmed_grid_6char = array(); - - $grid_2char = ""; - $grid_4char = ""; - $grid_6char = ""; - - $grid_2char_confirmed = ""; - $grid_4char_confirmed = ""; - $grid_6char_confirmed = ""; - - - // Get Confirmed LoTW & Paper Squares (non VUCC) - $query = $this->gridsquares_model->get_confirmed_sat_squares(); - - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - $grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_2char_confirmed); - } - - - if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_4char_confirmed); - } - - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_6char_confirmed, $array_confirmed_grid_6char)){ - array_push($array_confirmed_grid_6char, $grid_6char_confirmed); - } - } - - - } - } - - // Get worked squares - $query = $this->gridsquares_model->get_worked_sat_squares(); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - $grid_two = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_four = strtoupper(substr($row->SAT_SQUARE,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($row->SAT_SQUARE,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); - } - } - - - } - } - - $query_vucc = $this->gridsquares_model->get_worked_sat_vucc_squares(); - - if ($query && $query_vucc->num_rows() > 0) - { - foreach ($query_vucc->result() as $row) - { - - $grids = explode(",", $row->COL_VUCC_GRIDS); - - foreach($grids as $key) { - $grid_two = strtoupper(substr($key,0,2)); - $grid_four = strtoupper(substr($key,0,4)); - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - } - } - } - - // Confirmed Squares - $query_vucc = $this->gridsquares_model->get_confirmed_sat_vucc_squares(); - - if ($query && $query_vucc->num_rows() > 0) - { - foreach ($query_vucc->result() as $row) - { - - $grids = explode(",", $row->COL_VUCC_GRIDS); - - foreach($grids as $key) { - $grid_2char_confirmed = strtoupper(substr($key,0,2)); - $grid_4char_confirmed = strtoupper(substr($key,0,4)); - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_2char_confirmed); - } - - - if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_4char_confirmed); - } - } - } - } - - - function js_str($s) - { - return '"' . addcslashes($s, "\0..\37\"\\") . '"'; - } - - function js_array($array) - { - $temp = array_map('js_str', $array); - return '[' . implode(',', $temp) . ']'; - } - - - $data['grid_2char_confirmed'] = js_array($array_confirmed_grid_2char); - $data['grid_4char_confirmed'] = js_array($array_confirmed_grid_4char); - $data['grid_6char_confirmed'] = js_array($array_confirmed_grid_6char); - - $data['grid_2char'] = js_array($array_grid_2char); - $data['grid_4char'] = js_array($array_grid_4char); - $data['grid_6char'] = js_array($array_grid_6char); - - - $this->load->view('interface_assets/header', $data); - $this->load->view('gridsquares/index.php'); - $this->load->view('interface_assets/footer'); - } - - - public function band($band) - { - $this->load->model('gridsquares_model'); - - $data['page_title'] = strtoupper($band)." Gridsquare Map"; - - $array_grid_2char = array(); - $array_grid_4char = array(); - $array_grid_6char = array(); - - $array_grid_2char_confirmed = array(); - $array_grid_4char_confirmed = array(); - $array_grid_6char_confirmed = array(); - - $grid_2char = ""; - $grid_4char = ""; - $grid_6char = ""; - - $grid_2char_confirmed = ""; - $grid_4char_confirmed = ""; - $grid_6char_confirmed = ""; - - $query = $this->gridsquares_model->get_band_confirmed($band); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - $grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2)); - $grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); - } - - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); - } - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_6char_confirmed, $array_grid_6char_confirmed)){ - array_push($array_grid_6char_confirmed, $grid_6char_confirmed); - } - } - } - } - - $query = $this->gridsquares_model->get_band($band); - - if ($query && $query->num_rows() > 0) - { - foreach ($query->result() as $row) - { - - $grid_two = strtoupper(substr($row->GRID_SQUARES,0,2)); - $grid_four = strtoupper(substr($row->GRID_SQUARES,0,4)); - if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($row->GRID_SQUARES,0,6)); - } - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - - - if ($this->config->item('map_6digit_grids')) { - if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); - } - } - - - } - } - $query_vucc = $this->gridsquares_model->get_band_worked_vucc_squares($band); - - if ($query && $query_vucc->num_rows() > 0) - { - foreach ($query_vucc->result() as $row) - { - - $grids = explode(",", $row->COL_VUCC_GRIDS); - - foreach($grids as $key) { - $grid_two = strtoupper(substr($key,0,2)); - $grid_four = strtoupper(substr($key,0,4)); - - // Check if 2 Char is in array - if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); - } - - - if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); - } - } - } - } - - // Confirmed Squares - $query_vucc = $this->gridsquares_model->get_band_confirmed_vucc_squares($band); - - if ($query && $query_vucc->num_rows() > 0) - { - foreach ($query_vucc->result() as $row) - { - - $grids = explode(",", $row->COL_VUCC_GRIDS); - - foreach($grids as $key) { - $grid_2char_confirmed = strtoupper(substr($key,0,2)); - $grid_4char_confirmed = strtoupper(substr($key,0,4)); - - // Check if 2 Char is in array - if(!in_array($grid_2char_confirmed, $array_grid_2char_confirmed)){ - array_push($array_grid_2char_confirmed, $grid_2char_confirmed); - } - - - if(!in_array($grid_4char_confirmed, $array_grid_4char_confirmed)){ - array_push($array_grid_4char_confirmed, $grid_4char_confirmed); - } - } - } - } - - function js_str($s) - { - return '"' . addcslashes($s, "\0..\37\"\\") . '"'; - } - - function js_array($array) - { - $temp = array_map('js_str', $array); - return '[' . implode(',', $temp) . ']'; - } - - $data['grid_2char_confirmed'] = js_array($array_grid_2char_confirmed); - $data['grid_4char_confirmed'] = js_array($array_grid_4char_confirmed); - $data['grid_6char_confirmed'] = js_array($array_grid_6char_confirmed); - - $data['grid_2char'] = js_array($array_grid_2char); - $data['grid_4char'] = js_array($array_grid_4char); - $data['grid_6char'] = js_array($array_grid_6char); - - $this->load->model('bands'); - $data['bands_available'] = js_array($this->bands->get_worked_bands()); - - $this->load->view('interface_assets/header', $data); - $this->load->view('gridsquares/index.php'); - $this->load->view('interface_assets/footer'); - } - - function search_band($band, $gridsquare){ - $this->load->model('gridsquares_model'); - header('Content-Type: application/json'); - $result = $this->gridsquares_model->search_band($band, $gridsquare); - - echo $result; - } - - function search_sat($gridsquare){ - $this->load->model('gridsquares_model'); - header('Content-Type: application/json'); - $result = $this->gridsquares_model->search_sat($gridsquare); - - echo $result; - } - -} diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index 1eec26ff..328b96d2 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -115,11 +115,11 @@ class Visitor extends CI_Controller { $this->load->model('dxcc'); $dxcc = $this->dxcc->list_current(); - + $current = $this->logbook_model->total_countries_current($logbooks_locations_array); - + $data['total_countries_needed'] = count($dxcc->result()) - $current; - + $this->load->view('visitor/layout/header', $data); $this->load->view('visitor/index'); $this->load->view('visitor/layout/footer'); @@ -128,10 +128,10 @@ class Visitor extends CI_Controller { log_message('error', '[Visitor] XSS Attack detected on public_slug '. $public_slug); show_404('Unknown Public Page.'); } - + } } - + public function radio_display_component() { $this->load->model('cat'); @@ -141,7 +141,7 @@ class Visitor extends CI_Controller { public function map() { $this->load->model('logbook_model'); - + $this->load->library('qra'); $slug = $this->security->xss_clean($this->uri->segment(3)); @@ -173,7 +173,7 @@ class Visitor extends CI_Controller { echo ","; } - if($row->COL_SAT_NAME != null) { + if($row->COL_SAT_NAME != null) { echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
SAT: ".$row->COL_SAT_NAME."
Mode: "; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; echo "\",\"label\":\"".$row->COL_CALL."\"}"; @@ -190,10 +190,10 @@ class Visitor extends CI_Controller { if (count($grids) == 2) { $grid1 = $this->qra->qra2latlong(trim($grids[0])); $grid2 = $this->qra->qra2latlong(trim($grids[1])); - + $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); - $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); - + $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); + $stn_loc = $this->qra->get_midpoint($coords); } if (count($grids) == 4) { @@ -201,20 +201,20 @@ class Visitor extends CI_Controller { $grid2 = $this->qra->qra2latlong(trim($grids[1])); $grid3 = $this->qra->qra2latlong(trim($grids[2])); $grid4 = $this->qra->qra2latlong(trim($grids[3])); - + $coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]); - $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); - $coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]); - $coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]); - + $coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]); + $coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]); + $coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]); + $stn_loc = $this->qra->get_midpoint($coords); } if($count != 1) { echo ","; } - - if($row->COL_SAT_NAME != null) { + + if($row->COL_SAT_NAME != null) { echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
SAT: ".$row->COL_SAT_NAME."
Mode: "; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; echo "\",\"label\":\"".$row->COL_CALL."\"}"; @@ -223,9 +223,9 @@ class Visitor extends CI_Controller { echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE; echo "\",\"label\":\"".$row->COL_CALL."\"}"; } - + $count++; - + } else { if($count != 1) { echo ","; @@ -261,7 +261,7 @@ class Visitor extends CI_Controller { { // Get associated station locations for mysql queries $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id); - + if (!$logbooks_locations_array) { show_404('Empty Logbook'); } @@ -271,7 +271,7 @@ class Visitor extends CI_Controller { } } - $this->load->model('gridsquares_model'); + $this->load->model('gridmap_model'); $data['page_title'] = "Satellite Gridsquare Map"; @@ -295,7 +295,7 @@ class Visitor extends CI_Controller { // Get Confirmed LoTW & Paper Squares (non VUCC) - $query = $this->gridsquares_model->get_confirmed_sat_squares($logbooks_locations_array); + $query = $this->gridmap_model->get_band_confirmed('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array); if ($query && $query->num_rows() > 0) @@ -303,26 +303,26 @@ class Visitor extends CI_Controller { foreach ($query->result() as $row) { - $grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4)); + $grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2)); + $grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4)); if ($this->config->item('map_6digit_grids')) { - $grid_6char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,6)); + $grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6)); } // Check if 2 Char is in array if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_2char_confirmed); + array_push($array_confirmed_grid_2char, $grid_2char_confirmed); } if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_4char_confirmed); + array_push($array_confirmed_grid_4char, $grid_4char_confirmed); } if ($this->config->item('map_6digit_grids')) { if(!in_array($grid_6char_confirmed, $array_confirmed_grid_6char)){ - array_push($array_confirmed_grid_6char, $grid_6char_confirmed); + array_push($array_confirmed_grid_6char, $grid_6char_confirmed); } } @@ -331,33 +331,33 @@ class Visitor extends CI_Controller { } // Get worked squares - $query = $this->gridsquares_model->get_worked_sat_squares($logbooks_locations_array); + $query = $this->gridmap_model->get_band('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array); if ($query && $query->num_rows() > 0) { foreach ($query->result() as $row) { - $grid_two = strtoupper(substr($row->SAT_SQUARE,0,2)); - $grid_four = strtoupper(substr($row->SAT_SQUARE,0,4)); + $grid_two = strtoupper(substr($row->GRID_SQUARES,0,2)); + $grid_four = strtoupper(substr($row->GRID_SQUARES,0,4)); if ($this->config->item('map_6digit_grids')) { - $grid_six = strtoupper(substr($row->SAT_SQUARE,0,6)); + $grid_six = strtoupper(substr($row->GRID_SQUARES,0,6)); } // Check if 2 Char is in array if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + array_push($array_grid_2char, $grid_two); } if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + array_push($array_grid_4char, $grid_four); } if ($this->config->item('map_6digit_grids')) { if(!in_array($grid_six, $array_grid_6char)){ - array_push($array_grid_6char, $grid_six); + array_push($array_grid_6char, $grid_six); } } @@ -365,7 +365,7 @@ class Visitor extends CI_Controller { } } - $query_vucc = $this->gridsquares_model->get_worked_sat_vucc_squares($logbooks_locations_array); + $query_vucc = $this->gridmap_model->get_band_worked_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array); if ($query && $query_vucc->num_rows() > 0) { @@ -374,25 +374,25 @@ class Visitor extends CI_Controller { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { + foreach($grids as $key) { $grid_two = strtoupper(substr($key,0,2)); $grid_four = strtoupper(substr($key,0,4)); // Check if 2 Char is in array if(!in_array($grid_two, $array_grid_2char)){ - array_push($array_grid_2char, $grid_two); + array_push($array_grid_2char, $grid_two); } if(!in_array($grid_four, $array_grid_4char)){ - array_push($array_grid_4char, $grid_four); + array_push($array_grid_4char, $grid_four); } } } } // Confirmed Squares - $query_vucc = $this->gridsquares_model->get_confirmed_sat_vucc_squares($logbooks_locations_array); + $query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array); if ($query && $query_vucc->num_rows() > 0) { @@ -401,18 +401,18 @@ class Visitor extends CI_Controller { $grids = explode(",", $row->COL_VUCC_GRIDS); - foreach($grids as $key) { + foreach($grids as $key) { $grid_2char_confirmed = strtoupper(substr($key,0,2)); $grid_4char_confirmed = strtoupper(substr($key,0,4)); // Check if 2 Char is in array if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){ - array_push($array_confirmed_grid_2char, $grid_2char_confirmed); + array_push($array_confirmed_grid_2char, $grid_2char_confirmed); } if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){ - array_push($array_confirmed_grid_4char, $grid_4char_confirmed); + array_push($array_confirmed_grid_4char, $grid_4char_confirmed); } } } @@ -439,9 +439,19 @@ class Visitor extends CI_Controller { $data['grid_4char'] = js_array($array_grid_4char); $data['grid_6char'] = js_array($array_grid_6char); + $data['homegrid'] = 'JO31OL'; + $data['layer'] = $this->optionslib->get_option('option_map_tile_server'); + $data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright'); + + $data['gridsquares_gridsquares'] = lang('gridsquares_gridsquares'); + $data['gridsquares_gridsquares_confirmed'] = lang('gridsquares_gridsquares_confirmed'); + $data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed'); + $data['gridsquares_gridsquares_total_worked'] = lang('gridsquares_gridsquares_total_worked'); + + $data['visitor'] = true; $this->load->view('visitor/layout/header', $data); - $this->load->view('gridsquares/index'); + $this->load->view('gridmap/index', $data); $this->load->view('visitor/layout/footer'); } diff --git a/application/models/Activated_grids_model.php b/application/models/Activated_grids_model.php deleted file mode 100644 index 72d89ce5..00000000 --- a/application/models/Activated_grids_model.php +++ /dev/null @@ -1,146 +0,0 @@ -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)."'"; - $sql = 'SELECT DISTINCT station_gridsquare AS SAT_SQUARE FROM ' - . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" AND '.$this->config->item('table_name').'.COL_SAT_NAME != ""' - . ' AND station_profile.station_id in ('.$location_list.')'; - - return $this->db->query($sql); - } - - function get_activated_confirmed_sat_squares() { - $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)."'"; - - $sql = 'SELECT DISTINCT station_gridsquare AS SAT_SQUARE FROM ' - . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" AND '.$this->config->item('table_name').'.COL_SAT_NAME != "" ' - . 'AND (COL_LOTW_QSL_SENT = "Y" OR COL_QSL_SENT = "Y")' - . ' AND station_profile.station_id in ('.$location_list.')'; - - return $this->db->query($sql); - } - - function get_band($band) { - $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)."'"; - - $sql = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM ' - . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" ' - . ' AND station_profile.station_id in ('.$location_list.')'; - - if ($band != 'All') { - $sql .= 'AND COL_BAND = "'.$band.'" ' - . 'AND COL_PROP_MODE != "SAT" ' - . 'AND COL_PROP_MODE != "INTERNET" ' - . 'AND COL_PROP_MODE != "ECH" ' - . 'AND COL_PROP_MODE != "RPT" ' - . 'AND COL_SAT_NAME = "" '; - } - - return $this->db->query($sql); - } - - function get_band_confirmed($band) { - $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)."'"; - - $sql = 'SELECT DISTINCT station_gridsquare AS GRID_SQUARES, COL_BAND FROM ' - . 'station_profile JOIN '.$this->config->item('table_name').' on '.$this->config->item('table_name').'.station_id = station_profile.station_id ' - . 'WHERE station_profile.station_gridsquare != "" ' - . ' AND station_profile.station_id in ('.$location_list.')'; - - if ($band != 'All') { - $sql .= 'AND COL_BAND = "'.$band.'" ' - . 'AND COL_PROP_MODE != "SAT" ' - . 'AND COL_PROP_MODE != "INTERNET" ' - . 'AND COL_PROP_MODE != "ECH" ' - . 'AND COL_PROP_MODE != "RPT" ' - . 'AND COL_SAT_NAME = "" '; - } - - $sql .= ' AND (COL_LOTW_QSL_SENT = "Y" OR COL_QSL_SENT = "Y")'; - - return $this->db->query($sql); - } - - function search_band($band, $gridsquare) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' - .$this->config->item('table_name') - .' WHERE station_id IN (' . $location_list . ') ' - . ' AND (COL_MY_GRIDSQUARE LIKE "%'.$gridsquare.'%")'; - - if ($band != 'All') { - $sql .= ' AND COL_BAND = "' . $band - .'" - AND COL_PROP_MODE != "SAT" - AND COL_PROP_MODE != "INTERNET" - AND COL_PROP_MODE != "ECH" - AND COL_PROP_MODE != "RPT" - AND COL_SAT_NAME = ""'; - } - - $result = $this->db->query($sql); - - //print_r($result); - return json_encode($result->result()); - } - - function search_sat($gridsquare) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' . - $this->config->item('table_name'). - ' WHERE station_id IN ('.$location_list. ')' . - ' AND (COL_MY_GRIDSQUARE LIKE "%'.$gridsquare.'%")'. - ' AND COL_PROP_MODE = "SAT"'; - - $result = $this->db->query($sql); - - //print_r($result); - return json_encode($result->result()); - } -} diff --git a/application/models/Gridmap_model.php b/application/models/Gridmap_model.php index fd44b0bd..d51b3b86 100644 --- a/application/models/Gridmap_model.php +++ b/application/models/Gridmap_model.php @@ -2,10 +2,12 @@ class Gridmap_model extends CI_Model { - function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat) { - $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_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + if ($logbooks_locations_array == NULL) { + $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; @@ -40,10 +42,12 @@ class Gridmap_model extends CI_Model { return $this->db->query($sql); } - function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat) { - $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_band($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + if ($logbooks_locations_array == NULL) { + $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; @@ -76,10 +80,12 @@ class Gridmap_model extends CI_Model { return $this->db->query($sql); } - function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) { - $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_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + if ($logbooks_locations_array == NULL) { + $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; @@ -112,10 +118,12 @@ class Gridmap_model extends CI_Model { return $this->db->query($sql); } - function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) { - $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_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) { + if ($logbooks_locations_array == NULL) { + $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; @@ -223,4 +231,4 @@ class Gridmap_model extends CI_Model { return $results; } -} \ No newline at end of file +} diff --git a/application/models/Gridsquares_model.php b/application/models/Gridsquares_model.php deleted file mode 100644 index 430be3ed..00000000 --- a/application/models/Gridsquares_model.php +++ /dev/null @@ -1,265 +0,0 @@ -load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - $this->db->select('distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_GRIDSQUARE !=', ''); - $this->db->where('COL_SAT_NAME !=', ''); - - return $this->db->get($this->config->item('table_name')); - } - - function get_confirmed_sat_squares($StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM ' - . $this->config->item('table_name') - . ' WHERE station_id in (' . $location_list . ') AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")'; - - return $this->db->query($sql); - } - - - function get_confirmed_sat_vucc_squares($StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM ' - . $this->config->item('table_name') - . ' WHERE station_id in (' . $location_list . ') AND COL_VUCC_GRIDS != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y") AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")'; - - return $this->db->query($sql); - } - - function get_worked_sat_vucc_squares($StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('COL_PRIMARY_KEY, COL_VUCC_GRIDS, COL_SAT_NAME', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_VUCC_GRIDS !=', ""); - $this->db->where('COL_SAT_NAME !=', ""); - return $this->db->get($this->config->item('table_name')); - } - - function get_band($band, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_GRIDSQUARE !=', ''); - - if ($band != 'All') { - $this->db->where('COL_BAND', $band); - $this->db->where('COL_PROP_MODE !=', "SAT"); - $this->db->where('COL_PROP_MODE !=', "INTERNET"); - $this->db->where('COL_PROP_MODE !=', "ECH"); - $this->db->where('COL_PROP_MODE !=', "RPT"); - $this->db->where('COL_SAT_NAME =', ""); - } - - return $this->db->get($this->config->item('table_name')); - } - - function get_band_confirmed($band, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM ' - .$this->config->item('table_name') - .' WHERE station_id in (' - .$location_list.') AND COL_GRIDSQUARE != ""'; - if ($band != 'All') { - $sql .= ' AND COL_BAND = "' . $band - .'" - AND COL_PROP_MODE != "SAT" - AND COL_PROP_MODE != "INTERNET" - AND COL_PROP_MODE != "ECH" - AND COL_PROP_MODE != "RPT" - AND COL_SAT_NAME = ""'; - } - - $sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")'; - - return $this->db->query($sql); - } - - function get_band_worked_vucc_squares($band, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $this->db->select('distinct COL_VUCC_GRIDS, COL_BAND', FALSE); - $this->db->where_in('station_id', $logbooks_locations_array); - $this->db->where('COL_VUCC_GRIDS !=', ''); - - if ($band != 'All') { - $this->db->where('COL_BAND', $band); - $this->db->where('COL_PROP_MODE !=', "SAT"); - $this->db->where('COL_PROP_MODE !=', "INTERNET"); - $this->db->where('COL_PROP_MODE !=', "ECH"); - $this->db->where('COL_PROP_MODE !=', "RPT"); - $this->db->where('COL_SAT_NAME =', ""); - } - - return $this->db->get($this->config->item('table_name')); - } - - function get_band_confirmed_vucc_squares($band, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - - if (!$logbooks_locations_array) { - return null; - } - - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT distinct COL_VUCC_GRIDS, COL_BAND FROM ' - .$this->config->item('table_name') - .' WHERE station_id in (' - .$location_list.') AND COL_VUCC_GRIDS != ""'; - if ($band != 'All') { - $sql .= ' AND COL_BAND = "' . $band - .'" - AND COL_PROP_MODE != "SAT" - AND COL_PROP_MODE != "INTERNET" - AND COL_PROP_MODE != "ECH" - AND COL_PROP_MODE != "RPT" - AND COL_SAT_NAME = ""'; - } - - $sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")'; - - return $this->db->query($sql); - } - - function search_band($band, $gridsquare, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' - .$this->config->item('table_name') - .' WHERE station_id IN (' . $location_list . ') ' - . ' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")'; - - if ($band != 'All') { - $sql .= ' AND COL_BAND = "' . $band - .'" - AND COL_PROP_MODE != "SAT" - AND COL_PROP_MODE != "INTERNET" - AND COL_PROP_MODE != "ECH" - AND COL_PROP_MODE != "RPT" - AND COL_SAT_NAME = ""'; - } - - $result = $this->db->query($sql); - - //print_r($result); - return json_encode($result->result()); - } - - function search_sat($gridsquare, $StationLocationsArray = null) { - if($StationLocationsArray == null) { - $CI =& get_instance(); - $CI->load->model('logbooks_model'); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); - } else { - $logbooks_locations_array = $StationLocationsArray; - } - $location_list = "'".implode("','",$logbooks_locations_array)."'"; - - $sql = 'SELECT COL_CALL, COL_TIME_ON, COL_BAND, COL_MODE, COL_SAT_NAME, COL_GRIDSQUARE, COL_VUCC_GRIDS FROM ' . - $this->config->item('table_name'). - ' WHERE station_id IN ('.$location_list. ')' . - ' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")'. - ' AND COL_PROP_MODE = "SAT"'; - - $result = $this->db->query($sql); - - //print_r($result); - return json_encode($result->result()); - } -} diff --git a/application/views/activated_grids/index.php b/application/views/activated_grids/index.php deleted file mode 100644 index a9dc52e8..00000000 --- a/application/views/activated_grids/index.php +++ /dev/null @@ -1,69 +0,0 @@ -
- -
- -

- - uri->segment(1) == "activated_grids" && $this->uri->segment(2) == "band") { ?> -
- - -
- - - - session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- -
- -
- -
- uri->segment(2) == "satellites") { ?> - - - - uri->segment(2) == "band") { ?> - - -
- - diff --git a/application/views/activated_grids/main.php b/application/views/activated_grids/main.php deleted file mode 100644 index 1858097a..00000000 --- a/application/views/activated_grids/main.php +++ /dev/null @@ -1,20 +0,0 @@ -
- -
- - session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- - -

- - -
diff --git a/application/views/gridmap/index.php b/application/views/gridmap/index.php index b69f3fea..5b294346 100644 --- a/application/views/gridmap/index.php +++ b/application/views/gridmap/index.php @@ -46,6 +46,7 @@

+
-
- - - - session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- - - -
- -
- uri->segment(2) == "satellites") { ?> - - - - uri->segment(2) == "band") { ?> - - -
- - diff --git a/application/views/gridsquares/main.php b/application/views/gridsquares/main.php deleted file mode 100644 index f24d4c20..00000000 --- a/application/views/gridsquares/main.php +++ /dev/null @@ -1,20 +0,0 @@ -
- -
- - session->flashdata('message')) { ?> - -
-

session->flashdata('message'); ?>

-
- - -

- - -
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 7c00b086..a32a71a4 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -149,7 +149,6 @@ function load_was_map() { + CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?> diff --git a/assets/js/leaflet/L.MaidenheadColoured.js b/assets/js/leaflet/L.MaidenheadColoured.js index 5f52c507..aec50d52 100644 --- a/assets/js/leaflet/L.MaidenheadColoured.js +++ b/assets/js/leaflet/L.MaidenheadColoured.js @@ -39,7 +39,6 @@ L.Maidenhead = L.LayerGroup.extend({ var lat_cor = new Array(0, 8, 8, 8, 2.5, 2.2, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for gridsquare text offset var bounds = map.getBounds(); var zoom = map.getZoom(); - console.log(zoom); var unit = d3[zoom]; var lcor = lat_cor[zoom]; var w = bounds.getWest(); diff --git a/assets/js/leaflet/L.MaidenheadColouredGridMap.js b/assets/js/leaflet/L.MaidenheadColouredGridMap.js index 81cfd895..7d3ec930 100644 --- a/assets/js/leaflet/L.MaidenheadColouredGridMap.js +++ b/assets/js/leaflet/L.MaidenheadColouredGridMap.js @@ -39,7 +39,6 @@ L.Maidenhead = L.LayerGroup.extend({ var lat_cor = new Array(0, 8, 8, 8, 2.5, 2.2, 6, 8, 8, 8, 1.4, 2.5, 3, 3.5, 4, 4, 3.5, 3.5, 3, 1.8, 1.6); // Used for gridsquare text offset var bounds = map.getBounds(); var zoom = map.getZoom(); - console.log(zoom); var unit = d3[zoom]; var lcor = lat_cor[zoom]; var w = bounds.getWest(); diff --git a/assets/js/sections/gridmap.js b/assets/js/sections/gridmap.js index 519671bf..566667f5 100644 --- a/assets/js/sections/gridmap.js +++ b/assets/js/sections/gridmap.js @@ -8,16 +8,18 @@ $('#band').change(function(){ }); var map; -var grid_two = ''; -var grid_four = ''; -var grid_six = ''; -var grid_two_confirmed = ''; -var grid_four_confirmed = ''; -var grid_six_confirmed = ''; +if (typeof(visitor) !== 'undefined' && visitor != true) { + var grid_two = ''; + var grid_four = ''; + var grid_six = ''; + var grid_two_confirmed = ''; + var grid_four_confirmed = ''; + var grid_six_confirmed = ''; +} -function gridPlot(form) { +function gridPlot(form, visitor) { $(".ld-ext-right-plot").addClass('running'); - $(".ld-ext-right-plot").prop('disabled', true); + $(".ld-ext-right-plot").prop('disabled', true); $('#plot').prop("disabled", true); // If map is already initialized var container = L.DomUtil.get('gridsquare_map'); @@ -36,6 +38,7 @@ function gridPlot(form) { ajax_url = site_url + '/gridmap/getGridsjs'; } + if (visitor != true) { $.ajax({ url: ajax_url, type: 'post', @@ -52,12 +55,24 @@ function gridPlot(form) { $(".ld-ext-right-plot").removeClass('running'); $(".ld-ext-right-plot").prop('disabled', false); $('#plot').prop("disabled", false); - grid_two = data.grid_2char; + grid_two = data.grid_2char; grid_four = data.grid_4char; grid_six = data.grid_6char; grid_two_confirmed = data.grid_2char_confirmed; grid_four_confirmed = data.grid_4char_confirmed; grid_six_confirmed = data.grid_6char_confirmed; + plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed); + + }, + error: function (data) { + }, + }); + } else { + plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed); + }; +} + +function plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed) { var layer = L.tileLayer(jslayer, { maxZoom: 12, attribution: jsattribution, @@ -75,13 +90,15 @@ function gridPlot(form) { }, }); - var printer = L.easyPrint({ - tileLayer: layer, - sizeModes: ['Current'], - filename: 'myMap', - exportOnly: true, - hideControlContainer: true - }).addTo(map); + if (visitor != true) { + var printer = L.easyPrint({ + tileLayer: layer, + sizeModes: ['Current'], + filename: 'myMap', + exportOnly: true, + hideControlContainer: true + }).addTo(map); + } /*Legend specific*/ var legend = L.control({ position: "topright" }); @@ -98,13 +115,10 @@ function gridPlot(form) { legend.addTo(map); var maidenhead = L.maidenhead().addTo(map); - map.on('mousemove', onMapMove); - map.on('click', onMapClick); - - }, - error: function (data) { - }, - }); + if (visitor != true) { + map.on('mousemove', onMapMove); + map.on('click', onMapClick); + } } function spawnGridsquareModal(loc_4char) { @@ -174,5 +188,5 @@ function clearMarkers() { } $(document).ready(function(){ - gridPlot(this.form); + gridPlot(this.form, visitor); })