diff --git a/application/controllers/Reg1test.php b/application/controllers/Reg1test.php index 314f04417..5b08e9ed3 100644 --- a/application/controllers/Reg1test.php +++ b/application/controllers/Reg1test.php @@ -1,6 +1,6 @@ load->model('user_model'); - if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + if (!$this->user_model->authorize(2)) { + $this->session->set_flashdata('error', __("You're not allowed to do that!")); + redirect('dashboard'); + } } public function index() { @@ -57,7 +60,7 @@ class Reg1test extends CI_Controller { //deny acccess if station is not accessible if (!$this->stations->check_station_is_accessible($station_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); return; } @@ -74,7 +77,7 @@ class Reg1test extends CI_Controller { //load model $this->load->model('Contesting_model'); - + //get cleaned station id $station_id = $this->input->post('station_id', true); @@ -93,18 +96,18 @@ class Reg1test extends CI_Controller { //get cleaned station id $station_id = $this->input->post('station_id', true); - + //deny access if station is not accessible if (!$this->stations->check_station_is_accessible($station_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); return; - } + } //get cleaned year, contest id, from and to values $year = $this->input->post('year', true); $contestid = $this->input->post('contestid', true); - + //get contestdates from database $result = $this->Contesting_model->get_contest_dates($station_id, $year, $contestid); @@ -117,17 +120,17 @@ class Reg1test extends CI_Controller { //load models $this->load->model('Contesting_model'); - $this->load->model('stations'); + $this->load->model('stations'); //get cleaned station id $station_id = $this->input->post('station_id', true); - + //deny access if station is not accessible if (!$this->stations->check_station_is_accessible($station_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); return; - } + } //get cleaned contest id, from and to values $contestid = $this->input->post('contestid', true); @@ -140,7 +143,6 @@ class Reg1test extends CI_Controller { //return result as json header('Content-Type: application/json'); echo json_encode($result); - } public function export() { @@ -157,12 +159,13 @@ class Reg1test extends CI_Controller { //deny access if station is not accessible $station_id = $this->input->post('station_id', true); + if (!$this->stations->check_station_is_accessible($station_id)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); + $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); return; } - + //get user input to define the export parameters $contest_id = $this->input->post('contestid', true); $from = $this->input->post('contestdatesfrom', true); @@ -182,7 +185,7 @@ class Reg1test extends CI_Controller { //set contest header data for export $data['band'] = $band; - $data['qso_count'] = count($data['qsos']->result()); + $data['qso_count'] = count($data['qsos']->result()); $data['sentexchange'] = $this->input->post('sentexchange', true); $data['contest_id'] = $contest_id; $data['from'] = $from; diff --git a/application/libraries/Qra.php b/application/libraries/Qra.php index 4925d3d08..4ad4bf647 100644 --- a/application/libraries/Qra.php +++ b/application/libraries/Qra.php @@ -1,4 +1,4 @@ -'):''; + $echo .= (!$isVisitor) ? (' ') : ''; } else if (!empty($vucc)) { $echo = $vucc; - $echo .= (!$isVisitor)?(' '):''; + $echo .= (!$isVisitor) ? (' ') : ''; } return $echo; } @@ -139,7 +134,7 @@ class Qra { function getMaxDistanceQSO($mylocator, $qsos, $unit = "M") { //return nothing for empty QSO set - if(count($qsos->result()) < 1){ + if (count($qsos->result()) < 1) { return null; } @@ -154,7 +149,7 @@ class Qra { $distance = $this->distance($mylocator, $row->COL_GRIDSQUARE, $unit); //store new highscore if present - if($distance > $maxdistance) { + if ($distance > $maxdistance) { $maxdistance = $distance; $maxdistanceqso = $row; } @@ -170,140 +165,140 @@ class Qra { } - function calc_distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') { - $theta = $lon1 - $lon2; - $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); - $dist = acos($dist); - $dist = rad2deg($dist); - $dist = $dist * 60 * 1.1515; +function calc_distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') { + $theta = $lon1 - $lon2; + $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); + $dist = acos($dist); + $dist = rad2deg($dist); + $dist = $dist * 60 * 1.1515; - if ($unit == "K") { - $dist *= 1.609344; - } else if ($unit == "N") { - $dist *= 0.8684; - } - if ((is_nan($dist)) || !(is_numeric($dist))) { // Special-Case, catch same grid and/or Errors - $dist=0; - } - return round($dist, 1); + if ($unit == "K") { + $dist *= 1.609344; + } else if ($unit == "N") { + $dist *= 0.8684; } + if ((is_nan($dist)) || !(is_numeric($dist))) { // Special-Case, catch same grid and/or Errors + $dist = 0; + } + return round($dist, 1); +} - function bearing($lat1, $lon1, $lat2, $lon2, $unit = 'M') { - $dist = calc_distance($lat1, $lon1, $lat2, $lon2, $unit); - $dist = round($dist, 0); +function bearing($lat1, $lon1, $lat2, $lon2, $unit = 'M') { + $dist = calc_distance($lat1, $lon1, $lat2, $lon2, $unit); + $dist = round($dist, 0); - $bearing = get_bearing($lat1, $lon1, $lat2, $lon2); + $bearing = get_bearing($lat1, $lon1, $lat2, $lon2); - $dirs = array("N","E","S","W"); + $dirs = array("N", "E", "S", "W"); - $rounded = round($bearing / 22.5) % 16; - if (($rounded % 4) == 0) { - $dir = $dirs[$rounded / 4]; - } else { - $dir = $dirs[2 * floor(((floor($rounded / 4) + 1) % 4) / 2)]; - $dir .= $dirs[1 + 2 * floor($rounded / 8)]; - #if ($rounded % 2 == 1) - # $dir = $dirs[round_to_int($rounded/4) % 4] . "-" . $dir; + $rounded = round($bearing / 22.5) % 16; + if (($rounded % 4) == 0) { + $dir = $dirs[$rounded / 4]; + } else { + $dir = $dirs[2 * floor(((floor($rounded / 4) + 1) % 4) / 2)]; + $dir .= $dirs[1 + 2 * floor($rounded / 8)]; + #if ($rounded % 2 == 1) + # $dir = $dirs[round_to_int($rounded/4) % 4] . "-" . $dir; + } + $var_dist = ""; + #return $dir; + if (isset($dist)) { + $var_dist = $dist; + switch ($unit) { + case 'M': + $var_dist .= " miles"; + break; + case 'N': + $var_dist .= " nautic miles"; + break; + case 'K': + $var_dist .= " kilometers"; + break; } - $var_dist = ""; - #return $dir; - if (isset($dist)) { - $var_dist = $dist; - switch ($unit) { - case 'M': - $var_dist .= " miles"; - break; - case 'N': - $var_dist .= " nautic miles"; - break; - case 'K': - $var_dist .= " kilometers"; - break; + } + return round($bearing, 0) . "º " . $dir . " " . $var_dist; +} + +function get_bearing($lat1, $lon1, $lat2, $lon2) { + return (int)(rad2deg(atan2(sin(deg2rad($lon2) - deg2rad($lon1)) * cos(deg2rad($lat2)), cos(deg2rad($lat1)) * sin(deg2rad($lat2)) - sin(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($lon2) - deg2rad($lon1)))) + 360) % 360; +} + +function qra2latlong($strQRA) { + $strQRA = preg_replace('/\s+/', '', $strQRA); + if (substr_count($strQRA, ',') > 0) { + if (substr_count($strQRA, ',') == 3) { + // Handle grid corners + $grids = explode(',', $strQRA); + $gridlengths = array(strlen($grids[0]), strlen($grids[1]), strlen($grids[2]), strlen($grids[3])); + $same = array_count_values($gridlengths); + if (count($same) != 1) { + return false; } - } - return round($bearing, 0)."º ".$dir." ".$var_dist; - } - - function get_bearing($lat1, $lon1, $lat2, $lon2) { - return (int)(rad2deg(atan2(sin(deg2rad($lon2) - deg2rad($lon1)) * cos(deg2rad($lat2)), cos(deg2rad($lat1)) * sin(deg2rad($lat2)) - sin(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($lon2) - deg2rad($lon1)))) + 360) % 360; - } - - function qra2latlong($strQRA) { - $strQRA=preg_replace('/\s+/', '', $strQRA); - if (substr_count($strQRA, ',') > 0) { - if (substr_count($strQRA, ',') == 3) { - // Handle grid corners - $grids = explode(',', $strQRA); - $gridlengths = array(strlen($grids[0]), strlen($grids[1]), strlen($grids[2]), strlen($grids[3])); - $same = array_count_values($gridlengths); - if (count($same) != 1) { - return false; - } - $coords = array(0, 0); - for($i=0; $i<4; $i++) { - $cornercoords[$i] = qra2latlong($grids[$i]); - $coords[0] += $cornercoords[$i][0]; - $coords[1] += $cornercoords[$i][1]; - } - return array (round($coords[0]/4), round($coords[1]/4)); - } else if (substr_count($strQRA, ',') == 1) { - // Handle grid lines - $grids = explode(',', $strQRA); - if (strlen($grids[0]) != strlen($grids[1])) { - return false; - } - $coords = array(0, 0); - for($i=0; $i<2; $i++) { - $linecoords[$i] = qra2latlong($grids[$i]); - } - if ($linecoords[0][0] != $linecoords[1][0]) { - $coords[0] = round((($linecoords[0][0] + $linecoords[1][0]) / 2),1); - } else { - $coords[0] = round($linecoords[0][0],1); - } - if ($linecoords[0][1] != $linecoords[1][1]) { - $coords[1] = round(($linecoords[0][1] + $linecoords[1][1]) / 2); - } else { - $coords[1] = round($linecoords[0][1]); - } - return $coords; + $coords = array(0, 0); + for ($i = 0; $i < 4; $i++) { + $cornercoords[$i] = qra2latlong($grids[$i]); + $coords[0] += $cornercoords[$i][0]; + $coords[1] += $cornercoords[$i][1]; + } + return array(round($coords[0] / 4), round($coords[1] / 4)); + } else if (substr_count($strQRA, ',') == 1) { + // Handle grid lines + $grids = explode(',', $strQRA); + if (strlen($grids[0]) != strlen($grids[1])) { + return false; + } + $coords = array(0, 0); + for ($i = 0; $i < 2; $i++) { + $linecoords[$i] = qra2latlong($grids[$i]); + } + if ($linecoords[0][0] != $linecoords[1][0]) { + $coords[0] = round((($linecoords[0][0] + $linecoords[1][0]) / 2), 1); } else { - return false; + $coords[0] = round($linecoords[0][0], 1); } - } - - if ((strlen($strQRA) % 2 == 0) && (strlen($strQRA) <= 10)) { // Check if QRA is EVEN (the % 2 does that) and smaller/equal 8 - $strQRA = strtoupper($strQRA); - if (strlen($strQRA) == 4) $strQRA .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed - if (strlen($strQRA) == 6) $strQRA .= "55"; // Only 6 Chars? Fill with center "55" - if (strlen($strQRA) == 8) $strQRA .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed - - if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $strQRA)) { - return false; + if ($linecoords[0][1] != $linecoords[1][1]) { + $coords[1] = round(($linecoords[0][1] + $linecoords[1][1]) / 2); + } else { + $coords[1] = round($linecoords[0][1]); } - - list($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) = str_split($strQRA, 1); // Maidenhead is always alternating. e.g. "AA00AA00AA00" - doesn't matter how deep. 2 chars, 2 numbers, etc. - $a = ord($a) - ord('A'); - $b = ord($b) - ord('A'); - $c = ord($c) - ord('0'); - $d = ord($d) - ord('0'); - $e = ord($e) - ord('A'); - $f = ord($f) - ord('A'); - $g = ord($g) - ord('0'); - $h = ord($h) - ord('0'); - $i = ord($i) - ord('A'); - $j = ord($j) - ord('A'); - - $nLong = ($a*20) + ($c*2) + ($e/12) + ($g/120) + ($i/2880) - 180; - $nLat = ($b*10) + $d + ($f/24) + ($h/240) + ($j/5760) - 90; - - $arLatLong = array($nLat, $nLong); - return $arLatLong; + return $coords; } else { - return array(0, 0); + return false; } } + if ((strlen($strQRA) % 2 == 0) && (strlen($strQRA) <= 10)) { // Check if QRA is EVEN (the % 2 does that) and smaller/equal 8 + $strQRA = strtoupper($strQRA); + if (strlen($strQRA) == 4) $strQRA .= "LL"; // Only 4 Chars? Fill with center "LL" as only A-R allowed + if (strlen($strQRA) == 6) $strQRA .= "55"; // Only 6 Chars? Fill with center "55" + if (strlen($strQRA) == 8) $strQRA .= "LL"; // Only 8 Chars? Fill with center "LL" as only A-R allowed + + if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}[0-9]{2}[A-X]{2}$/', $strQRA)) { + return false; + } + + list($a, $b, $c, $d, $e, $f, $g, $h, $i, $j) = str_split($strQRA, 1); // Maidenhead is always alternating. e.g. "AA00AA00AA00" - doesn't matter how deep. 2 chars, 2 numbers, etc. + $a = ord($a) - ord('A'); + $b = ord($b) - ord('A'); + $c = ord($c) - ord('0'); + $d = ord($d) - ord('0'); + $e = ord($e) - ord('A'); + $f = ord($f) - ord('A'); + $g = ord($g) - ord('0'); + $h = ord($h) - ord('0'); + $i = ord($i) - ord('A'); + $j = ord($j) - ord('A'); + + $nLong = ($a * 20) + ($c * 2) + ($e / 12) + ($g / 120) + ($i / 2880) - 180; + $nLat = ($b * 10) + $d + ($f / 24) + ($h / 240) + ($j / 5760) - 90; + + $arLatLong = array($nLat, $nLong); + return $arLatLong; + } else { + return array(0, 0); + } +} + /* End of file Qra.php */ diff --git a/application/models/Contesting_model.php b/application/models/Contesting_model.php index 4dee6cfb5..9025309c1 100644 --- a/application/models/Contesting_model.php +++ b/application/models/Contesting_model.php @@ -22,7 +22,7 @@ class Contesting_model extends CI_Model { $this->config->item('table_name') . " WHERE station_id = ? AND COL_TIME_ON >= ? AND COL_CONTEST_ID = ? ORDER BY COL_PRIMARY_KEY ASC"; - $data = $this->db->query($sql,array($station_id, $date, $contestid)); + $data = $this->db->query($sql, array($station_id, $date, $contestid)); return $data->result(); } @@ -30,7 +30,7 @@ class Contesting_model extends CI_Model { $this->load->model('Stations'); $station_id = $this->Stations->find_active(); - $binding=[]; + $binding = []; $sql = "SELECT * from contest_session where station_id = ?"; $binding[] = $station_id; @@ -44,7 +44,7 @@ class Contesting_model extends CI_Model { $this->load->model('Stations'); $station_id = $this->Stations->find_active(); - $binding=[]; + $binding = []; $sql = "delete from contest_session where station_id = ?"; $binding[] = $station_id; @@ -74,7 +74,7 @@ class Contesting_model extends CI_Model { 'station_id' => $station_id, ); - $binding=[]; + $binding = []; $sql = "SELECT * from contest_session where station_id = ?"; $binding[] = $station_id; @@ -108,7 +108,7 @@ class Contesting_model extends CI_Model { $data = $this->db->query($sql); - return($data->result_array()); + return ($data->result_array()); } function getAllContests() { @@ -117,7 +117,7 @@ class Contesting_model extends CI_Model { $data = $this->db->query($sql); - return($data->result_array()); + return ($data->result_array()); } function delete($id) { @@ -171,7 +171,7 @@ class Contesting_model extends CI_Model { // Clean ID $clean_id = $this->security->xss_clean($id); - $binding=[]; + $binding = []; $sql = "SELECT id, name, adifname, active FROM contest where id = ?"; $binding[] = $clean_id; @@ -237,7 +237,7 @@ class Contesting_model extends CI_Model { $this->db->where("COL_MODE", xss_clean($mode)); $this->db->or_where("COL_SUBMODE", xss_clean($mode)); $this->db->group_end(); - $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "DESC"); + $this->db->order_by($this->config->item('table_name') . ".COL_TIME_ON", "DESC"); $query = $this->db->get($this->config->item('table_name')); return $query; @@ -246,32 +246,32 @@ class Contesting_model extends CI_Model { } function export_custom($from, $to, $contest_id, $station_id, $band = null) { - $this->db->select(''.$this->config->item('table_name').'.*, station_profile.*'); + $this->db->select('' . $this->config->item('table_name') . '.*, station_profile.*'); $this->db->from($this->config->item('table_name')); - $this->db->where($this->config->item('table_name').'.station_id', $station_id); + $this->db->where($this->config->item('table_name') . '.station_id', $station_id); // If date is set, we format the date and add it to the where-statement if ($from != 0) { $from = DateTime::createFromFormat('Y-m-d', $this->security->xss_clean($from)); $from = $from->format('Y-m-d'); - $this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) >= '".$from."'"); + $this->db->where("date(" . $this->config->item('table_name') . ".COL_TIME_ON) >= '" . $from . "'"); } if ($to != 0) { $to = DateTime::createFromFormat('Y-m-d', $this->security->xss_clean($to)); $to = $to->format('Y-m-d'); - $this->db->where("date(".$this->config->item('table_name').".COL_TIME_ON) <= '".$to."'"); + $this->db->where("date(" . $this->config->item('table_name') . ".COL_TIME_ON) <= '" . $to . "'"); } // If band is set, we only load contacts for that band if ($band != null) { - $this->db->where($this->config->item('table_name').'.COL_BAND', $band); + $this->db->where($this->config->item('table_name') . '.COL_BAND', $band); } - $this->db->where($this->config->item('table_name').'.COL_CONTEST_ID', $this->security->xss_clean($contest_id)); + $this->db->where($this->config->item('table_name') . '.COL_CONTEST_ID', $this->security->xss_clean($contest_id)); - $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC"); + $this->db->order_by($this->config->item('table_name') . ".COL_TIME_ON", "ASC"); - $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->join('station_profile', 'station_profile.station_id = ' . $this->config->item('table_name') . '.station_id'); return $this->db->get(); } @@ -280,7 +280,7 @@ class Contesting_model extends CI_Model { $this->load->model('Stations'); $station_id = $this->Stations->find_active(); - $binding=[]; + $binding = []; $sql = "select col_contest_id, min(date(col_time_on)) mindate, max(date(col_time_on)) maxdate, year(col_time_on) year, month(col_time_on) month from " . $this->config->item('table_name') . " where coalesce(COL_CONTEST_ID, '') <> '' @@ -299,7 +299,7 @@ class Contesting_model extends CI_Model { $station_id = $this->security->xss_clean($station_id); - $binding=[]; + $binding = []; $sql = "select distinct year(col_time_on) year from " . $this->config->item('table_name') . " where coalesce(COL_CONTEST_ID, '') <> '' @@ -319,7 +319,7 @@ class Contesting_model extends CI_Model { $station_id = $this->security->xss_clean($station_id); $year = $this->security->xss_clean($year); - $binding=[]; + $binding = []; $sql = "select distinct col_contest_id, coalesce(contest.name, col_contest_id) contestname from " . $this->config->item('table_name') . " thcv left outer join contest on thcv.col_contest_id = contest.adifname @@ -343,14 +343,14 @@ class Contesting_model extends CI_Model { $year = $this->security->xss_clean($year); $contestid = $this->security->xss_clean($contestid); - $binding=[]; + $binding = []; $sql = "select distinct (date(col_time_on)) date from " . $this->config->item('table_name') . " where coalesce(COL_CONTEST_ID, '') <> '' and station_id = ?" . " and year(col_time_on) = ? and col_contest_id = ?"; - $binding[] = $station_id; + $binding[] = $station_id; $binding[] = $year; $binding[] = $contestid; @@ -360,13 +360,13 @@ class Contesting_model extends CI_Model { } function get_contest_bands($station_id, $contestid, $from, $to) { - + //get distinct bands for the selected timeframe - $binding=[]; + $binding = []; $sql = "select distinct COL_BAND band from " . $this->config->item('table_name') . " - where date(".$this->config->item('table_name').".COL_TIME_ON) >= ? - and date(".$this->config->item('table_name').".COL_TIME_ON) <= ? + where date(" . $this->config->item('table_name') . ".COL_TIME_ON) >= ? + and date(" . $this->config->item('table_name') . ".COL_TIME_ON) <= ? and station_id = ? and COL_CONTEST_ID = ?"; //add data to bindings diff --git a/application/views/reg1test/export.php b/application/views/reg1test/export.php index 92cdb13a1..f80be3232 100644 --- a/application/views/reg1test/export.php +++ b/application/views/reg1test/export.php @@ -1,16 +1,43 @@ load->library('Reg1testformat'); //Set headers header('Content-Type: text/plain; charset=utf-8'); -header('Content-Disposition: attachment; filename="'.$callsign.'-'.$contest_id.'-'.date('Ymd-Hi').'-'.$CI->reg1testformat->reg1testbandstring($band).'.edi"'); +header('Content-Disposition: attachment; filename="' . $callsign . '-' . $contest_id . '-' . date('Ymd-Hi') . '-' . $CI->reg1testformat->reg1testbandstring($band) . '.edi"'); //get header -echo $CI->reg1testformat->header($contest_id, $from, $to, $callsign, $gridlocator, $contestaddress1, $contestaddress2, $categoryoperator, $band, $club, $name, - $responsible_operator, $address1, $address2, $addresspostalcode, $addresscity, $addresscountry, $operatorphone, $operators, - $soapbox, $qso_count, $sentexchange, $txequipment, $power, $rxequipment, $antenna, $antennaheight, $maxdistanceqso); +echo $CI->reg1testformat->header( + $contest_id, + $from, + $to, + $callsign, + $gridlocator, + $contestaddress1, + $contestaddress2, + $categoryoperator, + $band, + $club, + $name, + $responsible_operator, + $address1, + $address2, + $addresspostalcode, + $addresscity, + $addresscountry, + $operatorphone, + $operators, + $soapbox, + $qso_count, + $sentexchange, + $txequipment, + $power, + $rxequipment, + $antenna, + $antennaheight, + $maxdistanceqso +); //write QSO details while keeping track of the QSO number foreach ($qsos->result() as $row) { diff --git a/application/views/reg1test/index.php b/application/views/reg1test/index.php index e210c431a..77321ce92 100644 --- a/application/views/reg1test/index.php +++ b/application/views/reg1test/index.php @@ -2,151 +2,150 @@ var lang_export_reg1testedi_proceed = ''; var lang_export_reg1testedi_select_year = ""; var lang_export_reg1testedi_select_contest = ''; - var lang_export_reg1testedi_select_date_range = ''; + var lang_export_reg1testedi_select_date_range = ''; var lang_export_reg1testedi_select_band = ''; var lang_export_reg1testedi_no_contests_for_stationlocation = ''; var lang_export_reg1testedi_bandhint = '';
-
+
-

+

-
-
+
+
-
-
+
+
- '; + '; - if ($station_profile) { ?> + if ($station_profile) { ?> -
-
-
- - -
+ +
+
+ + +
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - -
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + - -
-
+
+
\ No newline at end of file diff --git a/assets/js/sections/reg1test.js b/assets/js/sections/reg1test.js index b75d3b7ca..d4523fda2 100644 --- a/assets/js/sections/reg1test.js +++ b/assets/js/sections/reg1test.js @@ -5,21 +5,21 @@ function loadYears() { $(".contestbands").empty(); $(".additionalinfo").attr("hidden", true); $.ajax({ - url: base_url+'index.php/reg1test/getYears', + url: base_url + 'index.php/reg1test/getYears', type: 'post', - data: {'station_id': $("#station_id").val()}, + data: { 'station_id': $("#station_id").val() }, success: function (data) { if (data.length > 0) { $(".contestyear").append('
' + lang_export_reg1testedi_select_year + '
' + - '' + - ' '); + '' + + ' '); - $.each(data, function(key, value) { + $.each(data, function (key, value) { $('#year') .append($("") - .attr("value",value.year) - .text(value.year)); + .attr("value", value.year) + .text(value.year)); }); } else { $(".contestyear").append(lang_export_reg1testedi_no_contests_for_stationlocation); @@ -33,23 +33,24 @@ function loadContests() { $(".contestdates").empty(); $(".contestbands").empty(); $.ajax({ - url: base_url+'index.php/reg1test/getContests', + url: base_url + 'index.php/reg1test/getContests', type: 'post', - data: {'year': $("#year").val(), - 'station_id': $("#station_id").val() + data: { + 'year': $("#year").val(), + 'station_id': $("#station_id").val() }, success: function (data) { - $(".contestname").append('
' + lang_export_reg1testedi_select_contest + '
' + + $(".contestname").append('
' + lang_export_reg1testedi_select_contest + '
' + '' + ' '); - $.each(data, function(key, value) { - $('#contestid') - .append($("") - .attr("value",value.col_contest_id) + $.each(data, function (key, value) { + $('#contestid') + .append($("") + .attr("value", value.col_contest_id) .text(value.contestname)); - }); + }); } }); } @@ -58,35 +59,37 @@ function loadContestDates() { $(".contestdates").empty(); $(".contestbands").empty(); $.ajax({ - url: base_url+'index.php/reg1test/getContestDates', + url: base_url + 'index.php/reg1test/getContestDates', type: 'post', - data: {'year': $("#year").val(), - 'contestid': $("#contestid").val(), - 'station_id': $("#station_id").val()}, + data: { + 'year': $("#year").val(), + 'contestid': $("#contestid").val(), + 'station_id': $("#station_id").val() + }, success: function (data) { - $(".contestdates").append('
' + lang_export_reg1testedi_select_date_range + '
' + + $(".contestdates").append('
' + lang_export_reg1testedi_select_date_range + '
' + '
' + - '' + - '' + + '' + + '' + '
' + ' '); - $.each(data, function(key, value) { - $('#contestdatesfrom') - .append($("") + $.each(data, function (key, value) { + $('#contestdatesfrom') + .append($("") .attr("value", value.date) .text(value.date)); - }); + }); - $.each(data, function(key, value) { - $('#contestdatesto') - .append($("") + $.each(data, function (key, value) { + $('#contestdatesto') + .append($("") .attr("value", value.date) .text(value.date)); - }); + }); } }); } @@ -95,28 +98,28 @@ function loadContestBands() { $(".contestbands").empty(); $.ajax({ - url: base_url+'index.php/reg1test/getContestBands', + url: base_url + 'index.php/reg1test/getContestBands', type: 'post', data: { - 'contestid': $("#contestid").val(), - 'station_id': $("#station_id").val(), - 'contestdatesfrom': $("#contestdatesfrom").val(), - 'contestdatesto': $("#contestdatesto").val() - }, + 'contestid': $("#contestid").val(), + 'station_id': $("#station_id").val(), + 'contestdatesfrom': $("#contestdatesfrom").val(), + 'contestdatesto': $("#contestdatesto").val() + }, success: function (data) { - $(".contestbands").append('
' + lang_export_reg1testedi_select_band + '
' + + $(".contestbands").append('
' + lang_export_reg1testedi_select_band + '
' + '' + ' '); - $.each(data, function(key, value) { - $('#contestband') - .append($("") - .attr("value",value.band) + $.each(data, function (key, value) { + $('#contestband') + .append($("") + .attr("value", value.band) .text(value.band)); - }); + }); - $(".contestbands").append('' + lang_export_reg1testedi_bandhint + ''); + $(".contestbands").append('' + lang_export_reg1testedi_bandhint + ''); } }); }