[Custom Map] Tweaks for station logbooks

This commit is contained in:
Andreas
2021-09-18 17:59:19 +02:00
parent 88222ca686
commit 9311e7c85a
3 changed files with 25 additions and 26 deletions

View File

@@ -13,7 +13,7 @@ class Map extends CI_Controller {
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
$data['qra_lng'] = $qra_position[1];
} else {
$data['qra'] = "none";
}
@@ -35,10 +35,10 @@ class Map extends CI_Controller {
{
$this->load->model('dxcc');
$this->load->model('modes');
//$this->load->model('modes');
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select
//$data['modes'] = $this->modes->active(); // Used in the view for mode select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
@@ -55,23 +55,23 @@ class Map extends CI_Controller {
$data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view
// Calculate Lat/Lng from Locator to use on Maps
if($this->session->userdata('user_locator')) {
/*if($this->session->userdata('user_locator')) {
$this->load->library('qra');
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
$data['qra_lng'] = $qra_position[1];
} else {
$data['qra'] = "none";
}
}*/
$this->load->model('Stations');
/*$this->load->model('Stations');
$station_id = $this->Stations->find_active();
$station_data = $this->Stations->profile_clean($station_id);
// load the view
$data['station_profile'] = $station_data;
$data['station_profile'] = $station_data;*/
$data['page_title'] = "Map QSOs";
@@ -105,7 +105,7 @@ class Map extends CI_Controller {
$end_date = $this->uri->segment(4);
$band = $this->uri->segment(5);
$this->load->model('logbook_model');
$this->load->library('qra');
$qsos = $this->logbook_model->map_custom_qsos(rawurldecode($start_date), rawurldecode($end_date), $band);
@@ -120,7 +120,7 @@ class Map 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."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
} else {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
@@ -134,7 +134,7 @@ class Map extends CI_Controller {
FROM dxcc_entities
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
LIMIT 1
');
foreach ($query->result() as $dxcc) {
@@ -154,12 +154,12 @@ class Map extends CI_Controller {
function map_data() {
$this->load->model('logbook_model');
$this->load->library('qra');
//echo date('Y-m-d')
$raw = strtotime('Monday last week');
$mon = date('Y-m-d', $raw);
$sun = date('Y-m-d', strtotime('Monday next week'));
@@ -175,7 +175,7 @@ class Map 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."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
} else {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
@@ -189,7 +189,7 @@ class Map extends CI_Controller {
FROM dxcc_entities
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
LIMIT 1
');
foreach ($query->result() as $dxcc) {
@@ -206,4 +206,4 @@ class Map extends CI_Controller {
echo "}";
}
}
}

View File

@@ -1038,13 +1038,12 @@ class Logbook_model extends CI_Model {
/* used to return custom qsos requires start, end date plus a band */
function map_custom_qsos($start, $end, $band) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where("station_id", $station_id);
$this->db->where_in("station_id", $logbooks_locations_array);
if($band != "All" && $band != "SAT") {
$this->db->where("COL_BAND", $band);

View File

@@ -1,6 +1,6 @@
<div class="container custom-map-QSOs">
<h2><?php echo $station_profile->station_profile_name; ?> Station Profile QSOs (Custom Date)</h2>
<h2>Station Profile QSOs (Custom Date)</h2>
<?php if($this->session->flashdata('notice')) { ?>
<div class="alert alert-info" role="alert">
@@ -22,7 +22,7 @@
<div class="row">
<label class="col-md-2 control-label" for="to">End Date/Time</label>
<div class="input-group date col-md-3" id="datetimepicker2" data-target-input="nearest">
<input name="to" type="text" placeholder="DD/MM/YYYY" class="form-control datetimepicker-input" data-target="#datetimepicker2"/>
<div class="input-group-append" data-target="#datetimepicker2" data-toggle="datetimepicker">
@@ -33,7 +33,7 @@
<div class="form-group row">
<label class="col-md-2 control-label" for="band">Band</label>
<div class="col-md-2">
<select id="band2" name="band" class="form-control custom-select-sm">
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> >Every band</option>
@@ -53,6 +53,6 @@
</div>
<!-- Map -->
<div id="map" style="width: 100%; height: 700px;"></div>
<div id="map" style="width: 100%; height: 700px;"></div>
<div class="alert alert-success" role="alert">Showing QSOs for Custom Date for Active Station Profile - <?php echo $station_profile->station_profile_name; ?> </div>
<div class="alert alert-success" role="alert">Showing QSOs for Custom Date</div>