pretty code

This commit is contained in:
HB9HIL
2024-08-26 20:50:30 +02:00
parent d4d4c88f3d
commit 517dbf6183
6 changed files with 417 additions and 390 deletions

View File

@@ -1,6 +1,6 @@
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if (! defined('BASEPATH')) exit('No direct script access allowed');
/*
@@ -14,7 +14,10 @@ class Reg1test extends CI_Controller {
// do authorization check
$this->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;

View File

@@ -1,4 +1,4 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Qra {
@@ -16,8 +16,7 @@ class Qra {
// Name: qra2latlong
// Task: convert qra to lat/long
function qra2latlong($strQRA)
{
function qra2latlong($strQRA) {
return qra2latlong($strQRA);
}
@@ -26,7 +25,7 @@ class Qra {
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
if ($my !== false && $stn !== false ) {
if ($my !== false && $stn !== false) {
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
return $bearing;
} else {
@@ -41,29 +40,26 @@ class Qra {
*
*/
function distance($tx, $rx, $unit = 'M') {
// Calc LatLongs
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
// Check if qra2latlong returned valid values
if ($my && $stn) {
// Feed in Lat Longs plus the unit type
try
{
$total_distance = calc_distance($my[0], $my[1], $stn[0], $stn[1], $unit);
}
catch (Exception $e)
{
$total_distance = 0;
}
// Return the distance
return $total_distance;
} else {
// Handle the case where qra2latlong did not return valid values
return 0;
}
}
// Calc LatLongs
$my = qra2latlong($tx);
$stn = qra2latlong($rx);
// Check if qra2latlong returned valid values
if ($my && $stn) {
// Feed in Lat Longs plus the unit type
try {
$total_distance = calc_distance($my[0], $my[1], $stn[0], $stn[1], $unit);
} catch (Exception $e) {
$total_distance = 0;
}
// Return the distance
return $total_distance;
} else {
// Handle the case where qra2latlong did not return valid values
return 0;
}
}
/*
* Function returns just the bearing
@@ -87,41 +83,40 @@ class Qra {
function get_midpoint($coords) {
$count_coords = count($coords);
$xcos=0.0;
$ycos=0.0;
$zsin=0.0;
foreach ($coords as $lnglat)
{
$lat = $lnglat['lat'] * pi() / 180;
$lon = $lnglat['lng'] * pi() / 180;
$acos = cos($lat) * cos($lon);
$bcos = cos($lat) * sin($lon);
$csin = sin($lat);
$xcos += $acos;
$ycos += $bcos;
$zsin += $csin;
}
$xcos = 0.0;
$ycos = 0.0;
$zsin = 0.0;
foreach ($coords as $lnglat) {
$lat = $lnglat['lat'] * pi() / 180;
$lon = $lnglat['lng'] * pi() / 180;
$acos = cos($lat) * cos($lon);
$bcos = cos($lat) * sin($lon);
$csin = sin($lat);
$xcos += $acos;
$ycos += $bcos;
$zsin += $csin;
}
$xcos /= $count_coords;
$ycos /= $count_coords;
$zsin /= $count_coords;
$lon = atan2($ycos, $xcos);
$sqrt = sqrt($xcos * $xcos + $ycos * $ycos);
$lat = atan2($zsin, $sqrt);
return array($lat * 180 / pi(), $lon * 180 / pi());
}
function echoQrbCalcLink($mygrid, $grid, $vucc, $isVisitor=false) {
function echoQrbCalcLink($mygrid, $grid, $vucc, $isVisitor = false) {
$echo = "";
if (!empty($grid)) {
$echo = $grid;
$echo .= (!$isVisitor)?(' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>'):'';
$echo .= (!$isVisitor) ? (' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $grid . '\')"><i class="fas fa-globe"></i></a>') : '';
} else if (!empty($vucc)) {
$echo = $vucc;
$echo .= (!$isVisitor)?(' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $vucc . '\')"><i class="fas fa-globe"></i></a>'):'';
$echo .= (!$isVisitor) ? (' <a href="javascript:spawnQrbCalculator(\'' . $mygrid . '\',\'' . $vucc . '\')"><i class="fas fa-globe"></i></a>') : '';
}
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) . "&#186; " . $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)."&#186; ".$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 */

View File

@@ -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

View File

@@ -1,16 +1,43 @@
<?php
//Load Libraries
$CI =& get_instance();
$CI = &get_instance();
$CI->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) {

View File

@@ -2,151 +2,150 @@
var lang_export_reg1testedi_proceed = '<?= __("Proceed") ?>';
var lang_export_reg1testedi_select_year = "<?= __("Select Year") ?>";
var lang_export_reg1testedi_select_contest = '<?= __("Select Contest") ?>';
var lang_export_reg1testedi_select_date_range = '<?= __("Select Date Range") ?>';
var lang_export_reg1testedi_select_date_range = '<?= __("Select Date Range") ?>';
var lang_export_reg1testedi_select_band = '<?= __("Select Band") ?>';
var lang_export_reg1testedi_no_contests_for_stationlocation = '<?= __("No contests were found for this station location!") ?>';
var lang_export_reg1testedi_bandhint = '<?= __("Bands below 50Mhz are not valid for the EDI REG1TEST format and will produce invalid files.") ?>';
</script>
<div class="container">
<br>
<br>
<h2><?php echo $page_title; ?></h2>
<h2><?php echo $page_title; ?></h2>
<div class="card">
<div class="card-header">
<div class="card">
<div class="card-header">
<?= __("Export a contest to a REG1TEST EDI log"); ?>
</div>
<div class="card-body">
</div>
<div class="card-body">
<?php
echo '<div class="contests">';
<?php
echo '<div class="contests">';
if ($station_profile) { ?>
if ($station_profile) { ?>
<form class="form" action="<?php echo site_url('reg1test/export'); ?>" method="post" enctype="multipart/form-data">
<div class="mb-3 d-flex align-items-center row">
<div class="col-md-4 control-label" for="station_id"><?= __("Select Station Location"); ?> </div>
<select id="station_id" name="station_id" class="form-select my-1 me-sm-2 col-md-6 w-25 w-lg-75">
<?php foreach ($station_profile->result() as $station) { ?>
<option value="<?php echo $station->station_id; ?>" <?php if ($station->station_id == $this->stations->find_active()) { echo " selected =\"selected\""; } ?>><?= __("Callsign") ?> <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
<?php } ?>
</select>
<button id="button1id" type="button" onclick="loadYears();" name="button1id" class="btn btn-sm btn-primary w-auto"> <?= __("Proceed") ?></button>
</div>
<form class="form" action="<?php echo site_url('reg1test/export'); ?>" method="post" enctype="multipart/form-data">
<div class="mb-3 d-flex align-items-center row">
<div class="col-md-4 control-label" for="station_id"><?= __("Select Station Location"); ?> </div>
<select id="station_id" name="station_id" class="form-select my-1 me-sm-2 col-md-6 w-25 w-lg-75">
<?php foreach ($station_profile->result() as $station) { ?>
<option value="<?php echo $station->station_id; ?>" <?php if ($station->station_id == $this->stations->find_active()) { echo " selected =\"selected\""; } ?>><?= __("Callsign") ?> <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
<?php } ?>
</select>
<button id="button1id" type="button" onclick="loadYears();" name="button1id" class="btn btn-sm btn-primary w-auto"> <?= __("Proceed") ?></button>
</div>
<div class="mb-3 d-flex align-items-center row contestyear">
</div>
<div class="mb-3 d-flex align-items-center row contestname">
</div>
<div class="mb-3 d-flex align-items-center row contestdates">
</div>
<div class="mb-3 d-flex align-items-center row contestbands">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="sentexchange"><?= __("Sent Exchange"); ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="6" id="sentexchange" type="sentexchange" name="sentexchange" aria-label="sentexchange">
<small id="sentexchange_hint" class="form-text text-muted col-md-4"><?= __("The exchange which was sent during the contest. Can be any type of information, e.g. Province, DOK, County, State, Power, Name. Max. length: 6 characters."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="club"><?= __("Club"); ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="club" type="club" name="club" aria-label="club">
<small id="club_hint" class="form-text text-muted col-md-4"><?= __("Describes the callsign of the radio club where operator(s) are member. E.g. can be used if points are accumulated to the club."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="categoryoperator"><?= __("Category Operator") ?> </div>
<select class="form-select my-1 me-sm-2 col-md-6 w-25 w-lg-75" id="categoryoperator" name="categoryoperator">
<option value="SINGLE-OP">SINGLE-OP</option>
<option value="MULTI-OP">MULTI-OP</option>
<option value="CHECKLOG">CHECKLOG</option>
</select>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="responsible_operator"><?= __("Callsign of responsible operator") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="responsible_operator" type="text" name="responsible_operator" aria-label="responsible_operator">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="operators"><?= __("Operators") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="operators" type="operators" name="operators" aria-label="operators">
<small id="operators_hint" class="form-text text-muted col-md-4"><?= __("List of all operators. Seperated with a semicolon ';'. The responsible operator is not needed here."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="contestaddress1"><?= __("Contest Address 1") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="contestaddress1" type="text" name="contestaddress1" aria-label="contestaddress1">
<small id="contestaddress1_hint" class="form-text text-muted col-md-4"><?= __("Address of the QTH used during the contest."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="contestaddress2"><?= __("Contest Address 2") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="contestaddress2" type="text" name="contestaddress2" aria-label="contestaddress2">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="address1"><?= __("Operator Address 1") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="address1" type="text" name="address1" aria-label="address1">
<small id="address1_hint" class="form-text text-muted col-md-4"><?= __("Address of the responsible operator."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="address2"><?= __("Operator Address 2") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="address2" type="text" name="address2" aria-label="address2">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresspostalcode"><?= __("Operator Address Postalcode") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresspostalcode" type="text" name="addresspostalcode" aria-label="addresspostalcode">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresscity"><?= __("Operator Address City") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresscity" type="text" name="addresscity" aria-label="addresscity">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresscountry"><?= __("Operator Address Country") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresscountry" type="text" name="addresscountry" aria-label="addresscountry">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="operatorphone"><?= __("Operator Phone Number") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="operatorphone" type="text" name="operatorphone" aria-label="operatorphone">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="txequipment"><?= __("Transmit Equipment Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="txequipment" type="text" name="txequipment" aria-label="txequipment">
<small id="txequipment_hint" class="form-text text-muted col-md-4"><?= __("Short description of the used equipment."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="power"><?= __("Transmit Power (W)") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="power" type="text" name="power" aria-label="power">
<small id="power_hint" class="form-text text-muted col-md-4"><?= __("TX Power during the contest in Watt."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="rxequipment"><?= __("Receive Equipment Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="rxequipment" type="text" name="rxequipment" aria-label="rxequipment">
<small id="rxequipment_hint" class="form-text text-muted col-md-4"><?= __("If you used another gear for RX, then describe it here."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="antenna"><?= __("Antenna Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="antenna" type="text" name="antenna" aria-label="antenna">
<small id="antenna_hint" class="form-text text-muted col-md-4"><?= __("What kind of antenna was used."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="antennaheight"><?= __("Antenna Height Above Ground (m)") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="antennaheight" type="text" name="antennaheight" aria-label="antennaheight">
<small id="antennaheight_hint" class="form-text text-muted col-md-4"><?= __("Height of the antenna above the ground."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="soapbox"><?= __("Soapbox") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" id="soapbox" type="text" name="soapbox" aria-label="soapbox">
<small id="soapbox_hint" class="form-text text-muted col-md-4"><?= __("Any other remarks."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="button1id"></div>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary w-auto"> <?= __("Export") ?></button>
</div>
</form>
<div class="mb-3 d-flex align-items-center row contestyear">
</div>
<div class="mb-3 d-flex align-items-center row contestname">
</div>
<div class="mb-3 d-flex align-items-center row contestdates">
</div>
<div class="mb-3 d-flex align-items-center row contestbands">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="sentexchange"><?= __("Sent Exchange"); ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="6" id="sentexchange" type="sentexchange" name="sentexchange" aria-label="sentexchange">
<small id="sentexchange_hint" class="form-text text-muted col-md-4"><?= __("The exchange which was sent during the contest. Can be any type of information, e.g. Province, DOK, County, State, Power, Name. Max. length: 6 characters."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="club"><?= __("Club"); ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="club" type="club" name="club" aria-label="club">
<small id="club_hint" class="form-text text-muted col-md-4"><?= __("Describes the callsign of the radio club where operator(s) are member. E.g. can be used if points are accumulated to the club."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="categoryoperator"><?= __("Category Operator") ?> </div>
<select class="form-select my-1 me-sm-2 col-md-6 w-25 w-lg-75" id="categoryoperator" name="categoryoperator">
<option value="SINGLE-OP">SINGLE-OP</option>
<option value="MULTI-OP">MULTI-OP</option>
<option value="CHECKLOG">CHECKLOG</option>
</select>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="responsible_operator"><?= __("Callsign of responsible operator") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="responsible_operator" type="text" name="responsible_operator" aria-label="responsible_operator">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="operators"><?= __("Operators") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="operators" type="operators" name="operators" aria-label="operators">
<small id="operators_hint" class="form-text text-muted col-md-4"><?= __("List of all operators. Seperated with a semicolon ';'. The responsible operator is not needed here."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="contestaddress1"><?= __("Contest Address 1") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="contestaddress1" type="text" name="contestaddress1" aria-label="contestaddress1">
<small id="contestaddress1_hint" class="form-text text-muted col-md-4"><?= __("Address of the QTH used during the contest."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="contestaddress2"><?= __("Contest Address 2") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="contestaddress2" type="text" name="contestaddress2" aria-label="contestaddress2">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="address1"><?= __("Operator Address 1") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="address1" type="text" name="address1" aria-label="address1">
<small id="address1_hint" class="form-text text-muted col-md-4"><?= __("Address of the responsible operator."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="address2"><?= __("Operator Address 2") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="address2" type="text" name="address2" aria-label="address2">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresspostalcode"><?= __("Operator Address Postalcode") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresspostalcode" type="text" name="addresspostalcode" aria-label="addresspostalcode">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresscity"><?= __("Operator Address City") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresscity" type="text" name="addresscity" aria-label="addresscity">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="addresscountry"><?= __("Operator Address Country") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="addresscountry" type="text" name="addresscountry" aria-label="addresscountry">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="operatorphone"><?= __("Operator Phone Number") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="operatorphone" type="text" name="operatorphone" aria-label="operatorphone">
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="txequipment"><?= __("Transmit Equipment Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="txequipment" type="text" name="txequipment" aria-label="txequipment">
<small id="txequipment_hint" class="form-text text-muted col-md-4"><?= __("Short description of the used equipment."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="power"><?= __("Transmit Power (W)") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="power" type="text" name="power" aria-label="power">
<small id="power_hint" class="form-text text-muted col-md-4"><?= __("TX Power during the contest in Watt."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="rxequipment"><?= __("Receive Equipment Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="rxequipment" type="text" name="rxequipment" aria-label="rxequipment">
<small id="rxequipment_hint" class="form-text text-muted col-md-4"><?= __("If you used another gear for RX, then describe it here."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="antenna"><?= __("Antenna Description") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="antenna" type="text" name="antenna" aria-label="antenna">
<small id="antenna_hint" class="form-text text-muted col-md-4"><?= __("What kind of antenna was used."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="antennaheight"><?= __("Antenna Height Above Ground (m)") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" maxlength="75" id="antennaheight" type="text" name="antennaheight" aria-label="antennaheight">
<small id="antennaheight_hint" class="form-text text-muted col-md-4"><?= __("Height of the antenna above the ground."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="soapbox"><?= __("Soapbox") ?> </div>
<input class="form-control my-1 me-sm-2 col-md-6 w-25 w-lg-75" id="soapbox" type="text" name="soapbox" aria-label="soapbox">
<small id="soapbox_hint" class="form-text text-muted col-md-4"><?= __("Any other remarks."); ?></small>
</div>
<div hidden="true" class="mb-3 d-flex align-items-center row additionalinfo">
<div class="col-md-4 control-label" for="button1id"></div>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary w-auto"> <?= __("Export") ?></button>
</div>
</form>
<?php }
else {
<?php } else {
echo __("No contests were found in your log.");
}
?>
</div>
</div>
</div>
</div>
</div>

View File

@@ -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('<div class="col-md-4 control-label" for="year">' + lang_export_reg1testedi_select_year + '</div>' +
'<select id="year" class="form-select my-1 me-sm-2 col-md-2 w-25 w-lg-75" name="year">' +
'</select>' +
' <button onclick="loadContests();" class="btn btn-sm btn-primary w-auto" type="button" id="btncontests">' + lang_export_reg1testedi_proceed + '</button>');
'<select id="year" class="form-select my-1 me-sm-2 col-md-2 w-25 w-lg-75" name="year">' +
'</select>' +
' <button onclick="loadContests();" class="btn btn-sm btn-primary w-auto" type="button" id="btncontests">' + lang_export_reg1testedi_proceed + '</button>');
$.each(data, function(key, value) {
$.each(data, function (key, value) {
$('#year')
.append($("<option></option>")
.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('<div class="col-md-4 control-label" for="contestid">' + lang_export_reg1testedi_select_contest + '</div>' +
$(".contestname").append('<div class="col-md-4 control-label" for="contestid">' + lang_export_reg1testedi_select_contest + '</div>' +
'<select class="form-select my-1 me-sm-2 col-md-4 w-25 w-lg-75" id="contestid" name="contestid">' +
'</select>' +
' <button onclick="loadContestDates();" class="btn btn-sm btn-primary w-auto" type="button" id="btndates">' + lang_export_reg1testedi_proceed + '</button>');
$.each(data, function(key, value) {
$('#contestid')
.append($("<option></option>")
.attr("value",value.col_contest_id)
$.each(data, function (key, value) {
$('#contestid')
.append($("<option></option>")
.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('<div class="col-md-4 control-label" for="contestdates">' + lang_export_reg1testedi_select_date_range + '</div>' +
$(".contestdates").append('<div class="col-md-4 control-label" for="contestdates">' + lang_export_reg1testedi_select_date_range + '</div>' +
'<div class="w-25 w-lg-75 d-flex ps-0 pe-0">' +
'<select class="form-select my-1 me-sm-2 flex-grow-1" id="contestdatesfrom" name="contestdatesfrom">' +
'</select>' +
'<select class="form-select my-1 ms-sm-2 flex-grow-1" id="contestdatesto" name="contestdatesto">' +
'</select>' +
'<select class="form-select my-1 me-sm-2 flex-grow-1" id="contestdatesfrom" name="contestdatesfrom">' +
'</select>' +
'<select class="form-select my-1 ms-sm-2 flex-grow-1" id="contestdatesto" name="contestdatesto">' +
'</select>' +
'</div>' +
' <button class="btn btn-sm btn-primary w-auto ms-sm-2" onclick="loadContestBands();" type="button" id="btnbands">' + lang_export_reg1testedi_proceed + '</button>');
$.each(data, function(key, value) {
$('#contestdatesfrom')
.append($("<option></option>")
$.each(data, function (key, value) {
$('#contestdatesfrom')
.append($("<option></option>")
.attr("value", value.date)
.text(value.date));
});
});
$.each(data, function(key, value) {
$('#contestdatesto')
.append($("<option></option>")
$.each(data, function (key, value) {
$('#contestdatesto')
.append($("<option></option>")
.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('<div class="col-md-4 control-label" for="contestband">' + lang_export_reg1testedi_select_band + '</div>' +
$(".contestbands").append('<div class="col-md-4 control-label" for="contestband">' + lang_export_reg1testedi_select_band + '</div>' +
'<select class="form-select my-1 me-sm-2 col-md-4 w-25 w-lg-75" id="contestband" name="contestband">' +
'</select>' +
' <button onclick="addAdditionalInfo();" class="btn btn-sm btn-primary w-auto" type="button" id="btnadditionalinfo">' + lang_export_reg1testedi_proceed + '</button>');
$.each(data, function(key, value) {
$('#contestband')
.append($("<option></option>")
.attr("value",value.band)
$.each(data, function (key, value) {
$('#contestband')
.append($("<option></option>")
.attr("value", value.band)
.text(value.band));
});
});
$(".contestbands").append('<small id="band_hint" class="form-text text-muted col-md-2">' + lang_export_reg1testedi_bandhint + '</small>');
$(".contestbands").append('<small id="band_hint" class="form-text text-muted col-md-2">' + lang_export_reg1testedi_bandhint + '</small>');
}
});
}