kopia lustrzana https://github.com/magicbug/Cloudlog
Merge branch 'station_logbooks' into custom_themes
commit
77da77ffd1
|
@ -0,0 +1,7 @@
|
|||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a security vulnerability within Cloudlog, please send an e-mail to Peter Goodhall, 2M0SQL via [peter@magicbug.co.uk](mailto:peter@magicbug.co.uk).
|
||||
|
||||
All security vulnerabilities will be promptly addressed.
|
|
@ -21,7 +21,8 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 71;
|
||||
|
||||
$config['migration_version'] = 75;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -27,7 +27,6 @@ class Awards extends CI_Controller {
|
|||
|
||||
public function dok ()
|
||||
{
|
||||
//echo "Needs Developed";
|
||||
$this->load->model('dok');
|
||||
$data['doks'] = $this->dok->show_stats();
|
||||
$data['worked_bands'] = $this->dok->get_worked_bands();
|
||||
|
@ -226,15 +225,17 @@ class Awards extends CI_Controller {
|
|||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function cq(){
|
||||
public function cq() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
$this->load->model('cq');
|
||||
$this->load->model('modes');
|
||||
|
||||
$data['worked_bands'] = $this->cq->get_worked_bands($station_id);
|
||||
$data['worked_bands'] = $this->cq->get_worked_bands($location_list);
|
||||
$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.
|
||||
|
@ -270,8 +271,8 @@ class Awards extends CI_Controller {
|
|||
$postdata['mode'] = 'All';
|
||||
}
|
||||
|
||||
$data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $station_id);
|
||||
$data['cq_summary'] = $this->cq->get_cq_summary($data['worked_bands'], $station_id);
|
||||
$data['cq_array'] = $this->cq->get_cq_array($bands, $postdata, $location_list);
|
||||
$data['cq_summary'] = $this->cq->get_cq_summary($data['worked_bands'], $location_list);
|
||||
|
||||
// Render page
|
||||
$data['page_title'] = "Awards - CQ Magazine";
|
||||
|
@ -475,7 +476,7 @@ class Awards extends CI_Controller {
|
|||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->load->model('adif_data');
|
||||
//$type = str_replace('"', "", $this->input->get("type"));
|
||||
|
||||
$type = $this->uri->segment(3);
|
||||
$data['qsos'] = $this->adif_data->sig_all($type);
|
||||
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Dxatlas extends CI_Controller {
|
||||
|
||||
public function index() {
|
||||
$this->load->model('user_model');
|
||||
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
$this->load->model('modes');
|
||||
$this->load->model('dxcc');
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('stations');
|
||||
|
||||
$data['station_profile'] = $this->stations->all(); // Used in the view for station location select
|
||||
$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['dxcc'] = $this->logbook_model->fetchDxcc(); // Used in the view for dxcc select
|
||||
|
||||
$data['page_title'] = "DX Atlas Gridsquare Export";
|
||||
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('dxatlas/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
|
||||
}
|
||||
|
||||
public function export() {
|
||||
$this->load->model('dxatlas_model');
|
||||
|
||||
// Parameters
|
||||
$station_id = $this->security->xss_clean($this->input->post('station_profile'));
|
||||
$band = $this->security->xss_clean($this->input->post('band'));
|
||||
$mode = $this->security->xss_clean($this->input->post('mode'));
|
||||
$dxcc = $this->security->xss_clean($this->input->post('dxcc_id'));
|
||||
$cqz = $this->security->xss_clean($this->input->post('cqz'));
|
||||
$propagation = $this->security->xss_clean($this->input->post('prop_mode'));
|
||||
$fromdate = $this->security->xss_clean($this->input->post('fromdate'));
|
||||
$todate = $this->security->xss_clean($this->input->post('todate'));
|
||||
|
||||
// Get QSOs with Valid QRAs
|
||||
$grids = $this->dxatlas_model->get_gridsquares($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
|
||||
|
||||
$this->generateFiles($grids['worked'], $grids['confirmed'], $band);
|
||||
}
|
||||
|
||||
function generateFiles($wkdArray, $cfmArray, $band) {
|
||||
|
||||
$gridCfmArray = [];
|
||||
$gridWkdArray = [];
|
||||
$fieldCfmArray = [];
|
||||
$fieldWkdArray = [];
|
||||
|
||||
foreach ($cfmArray as $grid) {
|
||||
$field = substr($grid, 0, 2);
|
||||
if (!in_array($field, $fieldCfmArray)) {
|
||||
$fieldCfmArray[] = $field;
|
||||
}
|
||||
$gridCfmArray[] = $grid;
|
||||
}
|
||||
|
||||
|
||||
foreach ($wkdArray as $grid) {
|
||||
$field = substr($grid, 0, 2);
|
||||
if (!in_array($field, $fieldCfmArray)) {
|
||||
if (!in_array($field, $fieldWkdArray)) {
|
||||
$fieldWkdArray[] = $field;
|
||||
}
|
||||
}
|
||||
if (!in_array($grid, $gridCfmArray)) {
|
||||
$gridWkdArray[] = $grid;
|
||||
}
|
||||
}
|
||||
|
||||
$gridWkdString = '';
|
||||
$gridCfmString = '';
|
||||
|
||||
asort($gridWkdArray);
|
||||
asort($gridCfmArray);
|
||||
asort($fieldWkdArray);
|
||||
asort($fieldCfmArray);
|
||||
|
||||
foreach ($fieldWkdArray as $fields) {
|
||||
$gridWkdString .= $fields . "\r\n";
|
||||
}
|
||||
|
||||
foreach ($gridWkdArray as $grids) {
|
||||
$gridWkdString .= $grids . "\r\n";
|
||||
}
|
||||
|
||||
foreach ($fieldCfmArray as $fields) {
|
||||
$gridCfmString .= $fields . "\r\n";
|
||||
}
|
||||
|
||||
foreach ($gridCfmArray as $grids) {
|
||||
$gridCfmString .= $grids . "\r\n";
|
||||
}
|
||||
|
||||
$this->makeZip($gridWkdString, $gridCfmString, $band);
|
||||
}
|
||||
|
||||
function makeZip($gridWkdString, $gridCfmString, $band) {
|
||||
$zipFileName = 'dxatlas_gridsquares_'. $band . '.zip';
|
||||
// Prepare File
|
||||
$file = tempnam("tmp", "zip");
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($file, ZipArchive::OVERWRITE);
|
||||
|
||||
// Stuff with content
|
||||
$zip->addFromString($band . '_grids.wkd', $gridWkdString);
|
||||
$zip->addFromString($band . '_grids.cfm', $gridCfmString);
|
||||
|
||||
// Close and send to users
|
||||
$zip->close();
|
||||
$length = filesize($file);
|
||||
header('Content-Type: application/zip');
|
||||
header('Content-Length: ' . $length);
|
||||
header('Content-Disposition: attachment; filename="' . $zipFileName . '"');
|
||||
readfile($file);
|
||||
unlink($file);
|
||||
}
|
||||
}
|
|
@ -728,5 +728,4 @@ class Logbook extends CI_Controller {
|
|||
return $this->db->get();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
Handles Displaying of information for Station Logbooks
|
||||
*/
|
||||
|
||||
class Logbooks extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
}
|
||||
|
||||
function index() {
|
||||
$this->load->model('logbooks_model');
|
||||
|
||||
$data['my_logbooks'] = $this->logbooks_model->show_all();
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Station Logbooks";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('logbooks/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('stationLogbook_Name', 'Station Logbook Name', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$data['page_title'] = "Create Station Logbook";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('logbooks/create');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('logbooks_model');
|
||||
$this->logbooks_model->add();
|
||||
|
||||
redirect('logbooks');
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->load->model('logbooks_model');
|
||||
$this->load->model('stations');
|
||||
|
||||
$station_logbook_id = $this->security->xss_clean($id);
|
||||
|
||||
$station_logbook_details_query = $this->logbooks_model->logbook($station_logbook_id);
|
||||
$data['station_locations_array'] = $this->logbooks_model->list_logbook_relationships($station_logbook_id);
|
||||
|
||||
$data['station_logbook_details'] = $station_logbook_details_query->row();
|
||||
$data['station_locations_list'] = $this->stations->all();
|
||||
|
||||
$data['page_title'] = "Edit Station Logbook";
|
||||
|
||||
$this->form_validation->set_rules('station_logbook_name', 'Station Logbook Name', 'required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('logbooks/edit');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->logbooks_model->edit();
|
||||
|
||||
$data['notice'] = "Station Logbooks ".$this->security->xss_clean($this->input->post('station_logbook_name', true))." Updated";
|
||||
|
||||
foreach ($this->input->post('SelectedStationLocations') as $selectedOption){
|
||||
// Check if theres already a link between logbook and location
|
||||
if($this->logbooks_model->relationship_exists($this->input->post('station_logbook_id'), $selectedOption) != TRUE) {
|
||||
// If no link exisits create
|
||||
$this->logbooks_model->create_logbook_location_link($this->input->post('station_logbook_id'), $selectedOption);
|
||||
} else {
|
||||
echo "Already Linked";
|
||||
}
|
||||
|
||||
// Delete link if removed
|
||||
}
|
||||
|
||||
redirect('logbooks');
|
||||
}
|
||||
}
|
||||
|
||||
public function set_active($id) {
|
||||
$this->load->model('logbooks_model');
|
||||
$this->logbooks_model->set_logbook_active($id);
|
||||
$this->user_model->update_session($this->session->userdata('user_id'));
|
||||
|
||||
redirect('logbooks');
|
||||
}
|
||||
|
||||
public function delete($id) {
|
||||
$this->load->model('logbooks_model');
|
||||
$this->logbooks_model->delete($id);
|
||||
|
||||
redirect('logbooks');
|
||||
}
|
||||
|
||||
}
|
|
@ -28,12 +28,14 @@ class Lookup extends CI_Controller {
|
|||
|
||||
public function search() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
$this->load->model('lookup_model');
|
||||
|
||||
$data['bands'] = $this->lookup_model->get_Worked_Bands($station_id);
|
||||
$data['bands'] = $this->lookup_model->get_Worked_Bands($location_list);
|
||||
|
||||
$data['type'] = xss_clean($this->input->post('type'));
|
||||
$data['dxcc'] = xss_clean($this->input->post('dxcc'));
|
||||
|
@ -43,7 +45,7 @@ class Lookup extends CI_Controller {
|
|||
$data['iota'] = xss_clean($this->input->post('iota'));
|
||||
$data['cqz'] = xss_clean($this->input->post('cqz'));
|
||||
$data['wwff'] = xss_clean($this->input->post('wwff'));
|
||||
$data['station_id'] = $station_id;
|
||||
$data['location_list'] = $location_list;
|
||||
|
||||
$data['result'] = $this->lookup_model->getSearchResult($data);
|
||||
|
||||
|
|
|
@ -97,6 +97,17 @@ class Station extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
// This function allows a user to claim ownership of a station location
|
||||
function claim_user($id) {
|
||||
// $id is the profile id
|
||||
$this->load->model('stations');
|
||||
$this->stations->claim_user($id);
|
||||
|
||||
echo $this->session->userdata('user_id');
|
||||
|
||||
redirect('station');
|
||||
}
|
||||
|
||||
function reassign_profile($id) {
|
||||
// $id is the profile that needs reassigned to QSOs
|
||||
$this->load->model('stations');
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
@ -13,14 +13,14 @@ class Qra {
|
|||
* K = Kilometers
|
||||
* N = Nautical Miles
|
||||
*/
|
||||
|
||||
|
||||
// Name: qra2latlong
|
||||
// Task: convert qra to lat/long
|
||||
function qra2latlong($strQRA)
|
||||
{
|
||||
return qra2latlong($strQRA);
|
||||
}
|
||||
|
||||
|
||||
// calculate the bearing between two squares
|
||||
function bearing($tx, $rx, $unit = 'M') {
|
||||
if(strlen($tx) <= 6 && strlen($rx) <= 6) {
|
||||
|
@ -28,7 +28,7 @@ class Qra {
|
|||
$stn = qra2latlong($rx);
|
||||
|
||||
$bearing = bearing($my[0], $my[1], $stn[0], $stn[1], $unit);
|
||||
|
||||
|
||||
return $bearing;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class Qra {
|
|||
|
||||
// Feed in Lat Longs plus the unit type
|
||||
$total_distance = distance($my[0], $my[1], $stn[0], $stn[1], $unit);
|
||||
|
||||
|
||||
// Return the distance
|
||||
return $total_distance;
|
||||
}
|
||||
|
@ -72,21 +72,10 @@ cos(deg2rad($theta));
|
|||
}
|
||||
|
||||
function bearing($lat1, $lon1, $lat2, $lon2, $unit = 'M') {
|
||||
if (round($lon1, 1) == round($lon2, 1)) {
|
||||
if ($lat1 < $lat2) {
|
||||
$bearing = 0;
|
||||
} else {
|
||||
$bearing = 180;
|
||||
}
|
||||
} else {
|
||||
$dist = distance($lat1, $lon1, $lat2, $lon2, $unit);
|
||||
$arad = acos((sin(deg2rad($lat2)) - sin(deg2rad($lat1)) * cos(deg2rad($dist / 60))) / (sin(deg2rad($dist
|
||||
/ 60)) * cos(deg2rad($lat1))));
|
||||
$bearing = $arad * 180 / pi();
|
||||
if (sin(deg2rad($lon2 - $lon1)) < 0) {
|
||||
$bearing = 360 - $bearing;
|
||||
}
|
||||
}
|
||||
$dist = distance($lat1, $lon1, $lat2, $lon2, $unit);
|
||||
$dist = round($dist, 0);
|
||||
|
||||
$bearing = get_bearing($lat1, $lon1, $lat2, $lon2);
|
||||
|
||||
$dirs = array("N","E","S","W");
|
||||
|
||||
|
@ -99,7 +88,7 @@ function bearing($lat1, $lon1, $lat2, $lon2, $unit = 'M') {
|
|||
#if ($rounded % 2 == 1)
|
||||
# $dir = $dirs[round_to_int($rounded/4) % 4] . "-" . $dir;
|
||||
}
|
||||
$var_dist = "";
|
||||
$var_dist = "";
|
||||
#return $dir;
|
||||
if (isset($dist)) {
|
||||
$var_dist = $dist;
|
||||
|
@ -118,13 +107,17 @@ $var_dist = "";
|
|||
return round($bearing, 0)."º ".$dir." ".$var_dist;
|
||||
}
|
||||
|
||||
function get_bearing($lat1, $lon1, $lat2, $lon2) {
|
||||
return (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)
|
||||
|
||||
{
|
||||
if (strlen($strQRA) %2 == 0) {
|
||||
$strQRA = strtoupper($strQRA);
|
||||
if (strlen($strQRA) == 4) $strQRA .= "MM";
|
||||
if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}$/',$strQRA)) return false;
|
||||
if (!preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}$/',$strQRA)) return false;
|
||||
list($a,$b,$c,$d,$e,$f) = str_split($strQRA,1);
|
||||
$a = ord($a) - ord('A');
|
||||
$b = ord($b) - ord('A');
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This migration creates a table called options which will hold global options needed within cloudlog
|
||||
* removing the need for lots of configuration files.
|
||||
*/
|
||||
|
||||
class Migration_create_station_logbook_table extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
if (!$this->db->table_exists('station_logbooks')) {
|
||||
$this->dbforge->add_field(array(
|
||||
'logbook_id' => array(
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => 20,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE,
|
||||
'unique' => TRUE
|
||||
),
|
||||
|
||||
'user_id' => array(
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => 20,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => FALSE
|
||||
),
|
||||
|
||||
'logbook_name' => array(
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '191',
|
||||
'null' => TRUE
|
||||
),
|
||||
|
||||
'modified' => array(
|
||||
'type' => 'timestamp',
|
||||
'null' => TRUE,
|
||||
)
|
||||
));
|
||||
|
||||
$this->dbforge->add_key('logbook_id', TRUE);
|
||||
$this->dbforge->add_key('user_id', TRUE);
|
||||
|
||||
$this->dbforge->create_table('station_logbooks');
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_table('station_logbooks');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This migration creates a table called options which will hold global options needed within cloudlog
|
||||
* removing the need for lots of configuration files.
|
||||
*/
|
||||
|
||||
class Migration_create_station_logbook_relationship_table extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
if (!$this->db->table_exists('station_logbooks_relationship')) {
|
||||
$this->dbforge->add_field(array(
|
||||
'logbook_relation_id' => array(
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => 20,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => TRUE,
|
||||
'unique' => TRUE
|
||||
),
|
||||
|
||||
'station_logbook_id' => array(
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => 20,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => FALSE
|
||||
),
|
||||
|
||||
'station_location_id' => array(
|
||||
'type' => 'BIGINT',
|
||||
'constraint' => 20,
|
||||
'unsigned' => TRUE,
|
||||
'auto_increment' => FALSE
|
||||
),
|
||||
|
||||
'modified' => array(
|
||||
'type' => 'timestamp',
|
||||
'null' => TRUE,
|
||||
)
|
||||
));
|
||||
|
||||
$this->dbforge->add_key('logbook_relation_id', TRUE);
|
||||
$this->dbforge->add_key('station_logbook_id', TRUE);
|
||||
$this->dbforge->add_key('station_location_id', TRUE);
|
||||
|
||||
$this->dbforge->create_table('station_logbooks_relationship');
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_table('station_logbooks_relationship');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Migration_add_userid_to_station_profiles extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'user_id BIGINT(20) DEFAULT NULL',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('station_profile', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('station_profile', 'user_id');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This migration creates a table called options which will hold global options needed within cloudlog
|
||||
* removing the need for lots of configuration files.
|
||||
*/
|
||||
|
||||
class Migration_add_active_station_logbook_to_user_table extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
$fields = array(
|
||||
'active_station_logbook int(11)',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('users', $fields);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dbforge->drop_column('users', 'active_station_logbook');
|
||||
}
|
||||
}
|
|
@ -10,32 +10,34 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
function get_accumulated_data($band, $award, $mode, $period) {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
switch ($award) {
|
||||
case 'dxcc': $result = $this->get_accumulated_dxcc($band, $mode, $period, $station_id); break;
|
||||
case 'was': $result = $this->get_accumulated_was($band, $mode, $period, $station_id); break;
|
||||
case 'iota': $result = $this->get_accumulated_iota($band, $mode, $period, $station_id); break;
|
||||
case 'waz': $result = $this->get_accumulated_waz($band, $mode, $period, $station_id); break;
|
||||
case 'dxcc': $result = $this->get_accumulated_dxcc($band, $mode, $period, $location_list); break;
|
||||
case 'was': $result = $this->get_accumulated_was($band, $mode, $period, $location_list); break;
|
||||
case 'iota': $result = $this->get_accumulated_iota($band, $mode, $period, $location_list); break;
|
||||
case 'waz': $result = $this->get_accumulated_waz($band, $mode, $period, $location_list); break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_accumulated_dxcc($band, $mode, $period, $station_id) {
|
||||
function get_accumulated_dxcc($band, $mode, $period, $location_list) {
|
||||
if ($period == "year") {
|
||||
$sql = "SELECT year(col_time_on) as year,
|
||||
(select count(distinct b.col_dxcc) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where year(col_time_on) <= year and b.station_id = ". $station_id;
|
||||
" as b where year(col_time_on) <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql = "SELECT date_format(col_time_on, '%Y%m') as year,
|
||||
(select count(distinct b.col_dxcc) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id = ". $station_id;
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
|
@ -48,11 +50,11 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .=") total from " . $this->config->item('table_name') . " as a
|
||||
where a.station_id = ". $station_id;
|
||||
$sql .=" and b.col_dxcc > 0) total from " . $this->config->item('table_name') . " as a
|
||||
where a.station_id in (". $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -64,15 +66,17 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .= " and col_dxcc > 0";
|
||||
|
||||
if ($period == "year") {
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
order by year(a.col_time_on)";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
order by date_format(a.col_time_on, '%Y%m')";
|
||||
}
|
||||
|
||||
|
@ -81,18 +85,18 @@ class Accumulate_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function get_accumulated_was($band, $mode, $period, $station_id) {
|
||||
function get_accumulated_was($band, $mode, $period, $location_list) {
|
||||
if ($period == "year") {
|
||||
$sql = "SELECT year(col_time_on) as year,
|
||||
(select count(distinct b.col_state) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where year(col_time_on) <= year and b.station_id = ". $station_id;
|
||||
" as b where year(col_time_on) <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql = "SELECT date_format(col_time_on, '%Y%m') as year,
|
||||
(select count(distinct b.col_state) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id = ". $station_id;
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
|
@ -105,14 +109,14 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .= " and COL_DXCC in ('291', '6', '110')";
|
||||
$sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')";
|
||||
|
||||
$sql .=") total from " . $this->config->item('table_name') . " as a
|
||||
where a.station_id = ". $station_id;
|
||||
where a.station_id in (". $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -124,18 +128,18 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .= " and COL_DXCC in ('291', '6', '110')";
|
||||
$sql .= " and COL_STATE in ('AK','AL','AR','AZ','CA','CO','CT','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY')";
|
||||
|
||||
if ($period == "year") {
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
order by year(a.col_time_on)";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
order by date_format(a.col_time_on, '%Y%m')";
|
||||
}
|
||||
|
||||
|
@ -144,18 +148,18 @@ class Accumulate_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function get_accumulated_iota($band, $mode, $period, $station_id) {
|
||||
function get_accumulated_iota($band, $mode, $period, $location_list) {
|
||||
if ($period == "year") {
|
||||
$sql = "SELECT year(col_time_on) as year,
|
||||
(select count(distinct b.col_iota) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where year(col_time_on) <= year and b.station_id = ". $station_id;
|
||||
" as b where year(col_time_on) <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql = "SELECT date_format(col_time_on, '%Y%m') as year,
|
||||
(select count(distinct b.col_iota) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id = ". $station_id;
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
|
@ -168,11 +172,11 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .=") total from " . $this->config->item('table_name') . " as a
|
||||
where a.station_id = ". $station_id;
|
||||
where a.station_id in (". $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -184,15 +188,15 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
if ($period == "year") {
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
order by year(a.col_time_on)";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
order by date_format(a.col_time_on, '%Y%m')";
|
||||
}
|
||||
|
||||
|
@ -201,18 +205,18 @@ class Accumulate_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function get_accumulated_waz($band, $mode, $period, $station_id) {
|
||||
function get_accumulated_waz($band, $mode, $period, $location_list) {
|
||||
if ($period == "year") {
|
||||
$sql = "SELECT year(col_time_on) as year,
|
||||
(select count(distinct b.col_cqz) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where year(col_time_on) <= year and b.station_id = ". $station_id;
|
||||
" as b where year(col_time_on) <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql = "SELECT date_format(col_time_on, '%Y%m') as year,
|
||||
(select count(distinct b.col_cqz) from " .
|
||||
$this->config->item('table_name') .
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id = ". $station_id;
|
||||
" as b where date_format(col_time_on, '%Y%m') <= year and b.station_id in (". $location_list . ")";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
|
@ -225,11 +229,11 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
$sql .=") total from " . $this->config->item('table_name') . " as a
|
||||
where a.station_id = ". $station_id;
|
||||
where a.station_id in (". $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -241,15 +245,15 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and col_mode ='" . $mode . "'";
|
||||
$sql .= " and (col_mode ='" . $mode . "' or col_submode ='" . $mode . "')";
|
||||
}
|
||||
|
||||
if ($period == "year") {
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
$sql .= " group by year(a.col_time_on)
|
||||
order by year(a.col_time_on)";
|
||||
}
|
||||
else if ($period == "month") {
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
$sql .= " group by date_format(a.col_time_on, '%Y%m')
|
||||
order by date_format(a.col_time_on, '%Y%m')";
|
||||
}
|
||||
|
||||
|
@ -259,12 +263,14 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
function get_worked_bands() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -272,7 +278,7 @@ class Accumulate_model extends CI_Model
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
@ -311,4 +317,4 @@ class Accumulate_model extends CI_Model
|
|||
"1.25cm" => 0,
|
||||
"SAT" => 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,12 +128,13 @@ class adif_data extends CI_Model {
|
|||
}
|
||||
|
||||
function sig_all($type) {
|
||||
$this->load->model('stations');
|
||||
$active_station_id = $this->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->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', $active_station_id);
|
||||
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
|
||||
$this->db->where($this->config->item('table_name').'.COL_SIG', $type);
|
||||
|
||||
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
|
||||
|
|
|
@ -28,14 +28,18 @@ class Counties extends CI_Model
|
|||
* No band split, as it only count the number of counties in the award.
|
||||
*/
|
||||
function get_counties_summary() {
|
||||
$station_id = $this->get_station_id();
|
||||
$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 count(distinct COL_CNTY) countycountworked, coalesce(x.countycountconfirmed, 0) countycountconfirmed, thcv.COL_STATE
|
||||
from " . $this->config->item('table_name') . " thcv
|
||||
left outer join (
|
||||
select count(distinct COL_CNTY) countycountconfirmed, COL_STATE
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" where station_id in (" . $location_list . ")" .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'
|
||||
|
@ -43,7 +47,7 @@ class Counties extends CI_Model
|
|||
group by COL_STATE
|
||||
order by COL_STATE
|
||||
) x on thcv.COL_STATE = x.COL_STATE
|
||||
where station_id =" . $station_id .
|
||||
where station_id in (" . $location_list . ")" .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'
|
||||
|
@ -54,12 +58,6 @@ class Counties extends CI_Model
|
|||
return $query->result_array();
|
||||
}
|
||||
|
||||
function get_station_id() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
return $CI->Stations->find_active();
|
||||
}
|
||||
|
||||
/*
|
||||
* Makes a list of all counties in given state
|
||||
*/
|
||||
|
@ -78,11 +76,15 @@ class Counties extends CI_Model
|
|||
}
|
||||
|
||||
function get_counties($state, $confirmationtype) {
|
||||
$station_id = $this->get_station_id();
|
||||
$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 distinct COL_CNTY, COL_STATE
|
||||
from " . $this->config->item('table_name') . " thcv
|
||||
where station_id =" . $station_id .
|
||||
where station_id in (" . $location_list . ")" .
|
||||
" and COL_DXCC in ('291', '6', '110')
|
||||
and coalesce(COL_CNTY, '') <> ''
|
||||
and COL_BAND != 'SAT'";
|
||||
|
|
|
@ -45,11 +45,11 @@ class CQ extends CI_Model{
|
|||
"SAT" => 0,
|
||||
);
|
||||
|
||||
function get_worked_bands($station_id)
|
||||
function get_worked_bands($location_list)
|
||||
{
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -57,7 +57,7 @@ class CQ extends CI_Model{
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
@ -74,7 +74,7 @@ class CQ extends CI_Model{
|
|||
return $results;
|
||||
}
|
||||
|
||||
function get_cq_array($bands, $postdata, $station_id) {
|
||||
function get_cq_array($bands, $postdata, $location_list) {
|
||||
$cqZ = array(); // Used for keeping track of which states that are not worked
|
||||
|
||||
for ($i = 1; $i <= 40; $i++) {
|
||||
|
@ -87,14 +87,14 @@ class CQ extends CI_Model{
|
|||
}
|
||||
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$cqBand = $this->getCQWorked($station_id, $band, $postdata);
|
||||
$cqBand = $this->getCQWorked($location_list, $band, $postdata);
|
||||
foreach ($cqBand as $line) {
|
||||
$bandCq[$line->col_cqz][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>W</a></div>';
|
||||
$cqZ[$line->col_cqz]['count']++;
|
||||
}
|
||||
}
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$cqBand = $this->getCQConfirmed($station_id, $band, $postdata);
|
||||
$cqBand = $this->getCQConfirmed($location_list, $band, $postdata);
|
||||
foreach ($cqBand as $line) {
|
||||
$bandCq[$line->col_cqz][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . str_replace("&", "%26", $line->col_cqz) . '","' . $band . '","'. $postdata['mode'] . '","CQZone")\'>C</a></div>';
|
||||
$cqZ[$line->col_cqz]['count']++;
|
||||
|
@ -104,7 +104,7 @@ class CQ extends CI_Model{
|
|||
|
||||
// We want to remove the worked zones in the list, since we do not want to display them
|
||||
if ($postdata['worked'] == NULL) {
|
||||
$cqBand = $this->getCQWorked($station_id, $postdata['band'], $postdata);
|
||||
$cqBand = $this->getCQWorked($location_list, $postdata['band'], $postdata);
|
||||
foreach ($cqBand as $line) {
|
||||
unset($bandCq[$line->col_cqz]);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class CQ extends CI_Model{
|
|||
|
||||
// We want to remove the confirmed zones in the list, since we do not want to display them
|
||||
if ($postdata['confirmed'] == NULL) {
|
||||
$cqBand = $this->getCQConfirmed($station_id, $postdata['band'], $postdata);
|
||||
$cqBand = $this->getCQConfirmed($location_list, $postdata['band'], $postdata);
|
||||
foreach ($cqBand as $line) {
|
||||
unset($bandCq[$line->col_cqz]);
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ class CQ extends CI_Model{
|
|||
* Function returns all worked, but not confirmed states
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getCQWorked($station_id, $band, $postdata) {
|
||||
function getCQWorked($location_list, $band, $postdata) {
|
||||
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id = " . $station_id . " and col_cqz <> ''";
|
||||
where station_id in (" . $location_list . ") and col_cqz <> ''";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -148,8 +148,8 @@ class CQ extends CI_Model{
|
|||
$sql .= $this->addBandToQuery($band);
|
||||
|
||||
$sql .= " and not exists (select 1 from " . $this->config->item('table_name') .
|
||||
" where station_id = " . $station_id .
|
||||
" and col_cqz = thcv.col_cqz and col_cqz <> '' ";
|
||||
" where station_id in (" . $location_list .
|
||||
") and col_cqz = thcv.col_cqz and col_cqz <> '' ";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -170,9 +170,9 @@ class CQ extends CI_Model{
|
|||
* Function returns all confirmed states on given band and on LoTW or QSL
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getCQConfirmed($station_id, $band, $postdata) {
|
||||
function getCQConfirmed($location_list, $band, $postdata) {
|
||||
$sql = "SELECT distinct col_cqz FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id = " . $station_id . " and col_cqz <> ''";
|
||||
where station_id in (" . $location_list . ") and col_cqz <> ''";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -219,16 +219,16 @@ class CQ extends CI_Model{
|
|||
/*
|
||||
* Function gets worked and confirmed summary on each band on the active stationprofile
|
||||
*/
|
||||
function get_cq_summary($bands, $station_id) {
|
||||
function get_cq_summary($bands, $location_list) {
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $station_id);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
|
||||
$worked = $this->getSummaryByBand($band, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $location_list);
|
||||
$cqSummary['worked'][$band] = $worked[0]->count;
|
||||
$cqSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand('All', $station_id);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $station_id);
|
||||
$workedTotal = $this->getSummaryByBand('All', $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list);
|
||||
|
||||
$cqSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$cqSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
@ -236,10 +236,10 @@ class CQ extends CI_Model{
|
|||
return $cqSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $station_id) {
|
||||
function getSummaryByBand($band, $location_list) {
|
||||
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id . ' and col_cqz > 0';
|
||||
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
@ -255,10 +255,10 @@ class CQ extends CI_Model{
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getSummaryByBandConfirmed($band, $station_id){
|
||||
function getSummaryByBandConfirmed($band, $location_list){
|
||||
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id . ' and col_cqz > 0';
|
||||
$sql .= " where station_id in (" . $location_list . ') and col_cqz > 0';
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
|
|
@ -11,13 +11,15 @@ class Dayswithqso_model extends CI_Model
|
|||
|
||||
function getDaysWithQso()
|
||||
{
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "select year(COL_TIME_ON) Year, COUNT(DISTINCT TO_DAYS(COL_TIME_ON)) as Days from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
where station_id = " . $station_id . " and COL_TIME_ON is not null group by year";
|
||||
where station_id in (" . $location_list . ") and COL_TIME_ON is not null group by year";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
|
@ -150,17 +152,19 @@ class Dayswithqso_model extends CI_Model
|
|||
* Returns all distinct dates from db on active profile
|
||||
*/
|
||||
function getDates() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "select distinct cast(col_time_on as date) as date from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
where station_id = " . $station_id . " order by date asc";
|
||||
where station_id in (" . $location_list . ") order by date asc";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,14 @@ class Distances_model extends CI_Model
|
|||
"1.25cm"=>0);
|
||||
|
||||
function get_worked_sats() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked sats from database
|
||||
$sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id = ".$station_id . " and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name";
|
||||
$sql = "SELECT distinct col_sat_name FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name";
|
||||
|
||||
$data = $this->db->query($sql);
|
||||
|
||||
|
@ -49,12 +51,14 @@ class Distances_model extends CI_Model
|
|||
}
|
||||
|
||||
function get_worked_bands() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$sql = "SELECT distinct LOWER(COL_BAND) as COL_BAND FROM ".$this->config->item('table_name')." WHERE station_id = ".$station_id;
|
||||
$sql = "SELECT distinct LOWER(COL_BAND) as COL_BAND FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")";
|
||||
|
||||
$data = $this->db->query($sql);
|
||||
$worked_slots = array();
|
||||
|
@ -74,30 +78,93 @@ class Distances_model extends CI_Model
|
|||
|
||||
function get_distances($postdata, $measurement_base)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$station_gridsquare = $CI->Stations->find_gridsquare();
|
||||
$gridsquare = explode(',', $station_gridsquare); // We need to convert to an array, since a user can enter several gridsquares
|
||||
$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->select('col_call callsign, col_gridsquare grid');
|
||||
$this->db->where('LENGTH(col_gridsquare) >', 0);
|
||||
$result = array();
|
||||
|
||||
foreach ($logbooks_locations_array as $station_id) {
|
||||
|
||||
$station_gridsquare = $this->find_gridsquare($station_id);
|
||||
|
||||
if ($station_gridsquare != "") {
|
||||
$gridsquare = explode(',', $station_gridsquare); // We need to convert to an array, since a user can enter several gridsquares
|
||||
|
||||
$this->db->select('col_call callsign, col_gridsquare grid');
|
||||
$this->db->where('LENGTH(col_gridsquare) >', 0);
|
||||
|
||||
if ($postdata['band'] == 'sat') {
|
||||
$this->db->where('col_prop_mode', $postdata['band']);
|
||||
if ($postdata['sat'] != 'All') {
|
||||
$this->db->where('col_sat_name', $postdata['sat']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->db->where('col_band', $postdata['band']);
|
||||
}
|
||||
$this->db->where('station_id', $station_id);
|
||||
$dataarrayata = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$temp = $this->plot($dataarrayata->result_array(), $gridsquare, $measurement_base);
|
||||
|
||||
$result = $this->mergeresult($result, $temp);
|
||||
}
|
||||
}
|
||||
|
||||
if ($result) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
}
|
||||
else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('Error' => 'No QSOs found to plot.'));
|
||||
}
|
||||
|
||||
if ($postdata['band'] == 'sat') {
|
||||
$this->db->where('col_prop_mode', $postdata['band']);
|
||||
if ($postdata['sat'] != 'All') {
|
||||
$this->db->where('col_sat_name', $postdata['sat']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->db->where('col_band', $postdata['band']);
|
||||
}
|
||||
$this->db->where('station_id', $station_id);
|
||||
$dataarrayata = $this->db->get($this->config->item('table_name'));
|
||||
$this->plot($dataarrayata->result_array(), $gridsquare, $measurement_base);
|
||||
}
|
||||
|
||||
/*
|
||||
* We merge the result from several station_id's. They can have different gridsquares, so we need to use the correct gridsquare to calculate the correct distance.
|
||||
*/
|
||||
function mergeresult($result, $add) {
|
||||
if (sizeof($result) > 0) {
|
||||
if ($result['qrb']['Distance'] < $add['qrb']['Distance']) {
|
||||
$result['qrb']['Distance'] = $add['qrb']['Distance'];
|
||||
$result['qrb']['Grid'] = $add['qrb']['Grid'];
|
||||
$result['qrb']['Callsign'] = $add['qrb']['Callsign'];
|
||||
}
|
||||
$result['qrb']['Qsos'] += $add['qrb']['Qsos'];
|
||||
|
||||
for ($i = 0; $i <= 399; $i++) {
|
||||
$result['qsodata'][$i]['count'] += $add['qsodata'][$i]['count'];
|
||||
|
||||
if ($result['qsodata'][$i]['callcount'] < 5 && $add['qsodata'][$i]['callcount'] > 0) {
|
||||
$calls = explode(',', $add['qsodata'][$i]['calls']);
|
||||
foreach ($calls as $c) {
|
||||
if ($result['qsodata'][$i]['callcount'] < 5) {
|
||||
if ($result['qsodata'][$i]['callcount'] > 0) {
|
||||
$result['qsodata'][$i]['calls'] .= ', ';
|
||||
}
|
||||
$result['qsodata'][$i]['calls'] .= $c;
|
||||
$result['qsodata'][$i]['callcount']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $add;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetches the gridsquare from the station_id
|
||||
*/
|
||||
function find_gridsquare($station_id) {
|
||||
$this->db->where('station_id', $station_id);
|
||||
return $this->db->get('station_profile')->row()->station_gridsquare;
|
||||
}
|
||||
|
||||
// This functions takes query result from the database and extracts grids from the qso,
|
||||
// then calculates distance between homelocator and locator given in qso.
|
||||
// It builds an array, which has 50km intervals, then inputs each length into the correct spot
|
||||
|
@ -138,17 +205,17 @@ class Distances_model extends CI_Model
|
|||
$dataarray[$i]['callcount'] = 0;
|
||||
$j += 50;
|
||||
}
|
||||
|
||||
|
||||
$qrb = array ( // Used for storing the QSO with the longest QRB
|
||||
'Callsign' => '',
|
||||
'Grid' => '',
|
||||
'Distance' => '',
|
||||
'Qsoes' => '',
|
||||
'Qsos' => '',
|
||||
'Grids' => ''
|
||||
);
|
||||
|
||||
|
||||
foreach ($qsoArray as $qso) {
|
||||
$qrb['Qsoes']++; // Counts up number of qsoes
|
||||
$qrb['Qsos']++; // Counts up number of qsos
|
||||
$bearingdistance = $this->bearing_dist($stationgrid, $qso['grid'], $measurement_base); // Calculates distance based on grids
|
||||
$arrayplacement = $bearingdistance / 50; // Resolution is 50, calculates where to put result in array
|
||||
if ($bearingdistance > $qrb['Distance']) { // Saves the longest QSO
|
||||
|
@ -156,7 +223,7 @@ class Distances_model extends CI_Model
|
|||
$qrb['Callsign'] = $qso['callsign'];
|
||||
$qrb['Grid'] = $qso['grid'];
|
||||
}
|
||||
$dataarray[$arrayplacement]['count']++; // Used for counting total qsoes plotted
|
||||
$dataarray[$arrayplacement]['count']++; // Used for counting total qsos plotted
|
||||
if ($dataarray[$arrayplacement]['callcount'] < 5) { // Used for tooltip in graph, set limit to 5 calls shown
|
||||
if ($dataarray[$arrayplacement]['callcount'] > 0) {
|
||||
$dataarray[$arrayplacement]['calls'] .= ', ';
|
||||
|
@ -165,19 +232,13 @@ class Distances_model extends CI_Model
|
|||
$dataarray[$arrayplacement]['callcount']++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$qrb['Qsoes'] == 0) { // We have a result :)
|
||||
header('Content-Type: application/json');
|
||||
$data['ok'] = 'OK';
|
||||
$data['qrb'] = $qrb;
|
||||
$data['qsodata'] = $dataarray;
|
||||
$data['unit'] = $unit;
|
||||
echo json_encode($data);
|
||||
}
|
||||
else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(array('Error' => 'No QSOs found to plot.'));
|
||||
}
|
||||
|
||||
$data['ok'] = 'OK';
|
||||
$data['qrb'] = $qrb;
|
||||
$data['qsodata'] = $dataarray;
|
||||
$data['unit'] = $unit;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +286,7 @@ class Distances_model extends CI_Model
|
|||
function bearing_dist($loc1, $loc2, $measurement_base) {
|
||||
$loc1 = strtoupper($loc1);
|
||||
$loc2 = strtoupper($loc2);
|
||||
|
||||
|
||||
if (strlen($loc1) == 4) $loc1 .= 'MM';
|
||||
if (strlen($loc2) == 4) $loc2 .= 'MM';
|
||||
|
||||
|
@ -239,8 +300,6 @@ class Distances_model extends CI_Model
|
|||
$co = cos($l1[1] - $l2[1]) * cos($l1[0]) * cos($l2[0]) + sin($l1[0]) * sin($l2[0]);
|
||||
$ca = atan2(sqrt(1 - $co*$co), $co);
|
||||
|
||||
|
||||
|
||||
switch ($measurement_base) {
|
||||
case 'M':
|
||||
return round(6371*$ca/1.609344);
|
||||
|
@ -252,4 +311,4 @@ class Distances_model extends CI_Model
|
|||
return round(6371*$ca);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,14 @@ class DOK extends CI_Model {
|
|||
|
||||
function get_worked_bands() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 "
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 "
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach($data->result() as $row){
|
||||
|
@ -49,19 +51,21 @@ class DOK extends CI_Model {
|
|||
foreach(array_keys($this->bandslots) as $slot) {
|
||||
if(in_array($slot, $worked_slots)) {
|
||||
array_push($results, $slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
function show_stats(){
|
||||
function show_stats() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
$data = $this->db->query(
|
||||
"select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt
|
||||
from ".$this->config->item('table_name')." WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230
|
||||
from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230
|
||||
group by COL_DARC_DOK, COL_MODE, COL_BAND"
|
||||
);
|
||||
|
||||
|
@ -76,14 +80,14 @@ class DOK extends CI_Model {
|
|||
|
||||
// update stats
|
||||
if (!isset($results[$row->COL_DARC_DOK]))
|
||||
$results[$row->COL_DARC_DOK] = [];
|
||||
$results[$row->COL_DARC_DOK] = [];
|
||||
|
||||
if (!isset($results[$row->COL_DARC_DOK][$row->COL_BAND]))
|
||||
$results[$row->COL_DARC_DOK][$row->COL_BAND] = 0;
|
||||
$results[$row->COL_DARC_DOK][$row->COL_BAND] = 0;
|
||||
|
||||
$results[$row->COL_DARC_DOK][$row->COL_BAND] += $row->cnt;
|
||||
}
|
||||
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
<?php
|
||||
|
||||
class Dxatlas_model extends CI_Model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetches worked and confirmed gridsquare from the logbook
|
||||
*/
|
||||
function get_gridsquares($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
|
||||
$gridArray = $this->fetchGrids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate);
|
||||
|
||||
if (isset($gridArray)) {
|
||||
return $gridArray;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Builds the array for worked and confirmed gridsquares
|
||||
*/
|
||||
function fetchGrids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
|
||||
|
||||
// Getting all the worked grids
|
||||
$col_gridsquare_worked = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'single');
|
||||
|
||||
$workedGridArray = array();
|
||||
foreach ($col_gridsquare_worked as $workedgrid) {
|
||||
array_push($workedGridArray, $workedgrid['gridsquare']);
|
||||
}
|
||||
|
||||
$col_vucc_grids_worked = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'none', 'multi');
|
||||
|
||||
foreach ($col_vucc_grids_worked as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $workedGridArray)){
|
||||
array_push($workedGridArray, $grid_four);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getting all the confirmed grids
|
||||
$col_gridsquare_confirmed = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'single');
|
||||
|
||||
$confirmedGridArray = array();
|
||||
foreach ($col_gridsquare_confirmed as $confirmedgrid) {
|
||||
array_push($confirmedGridArray, $confirmedgrid['gridsquare']);
|
||||
if(in_array($confirmedgrid['gridsquare'], $workedGridArray)){
|
||||
$index = array_search($confirmedgrid['gridsquare'],$workedGridArray);
|
||||
unset($workedGridArray[$index]);
|
||||
}
|
||||
}
|
||||
|
||||
$col_vucc_grids_confirmed = $this->get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, 'both', 'multi');
|
||||
|
||||
foreach ($col_vucc_grids_confirmed as $gridSplit) {
|
||||
$grids = explode(",", $gridSplit['col_vucc_grids']);
|
||||
foreach($grids as $key) {
|
||||
$grid_four = strtoupper(substr(trim($key),0,4));
|
||||
|
||||
if(!in_array($grid_four, $confirmedGridArray)){
|
||||
array_push($confirmedGridArray, $grid_four);
|
||||
}
|
||||
if(in_array($grid_four, $workedGridArray)){
|
||||
$index = array_search($grid_four,$workedGridArray);
|
||||
unset($workedGridArray[$index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$vuccArray['worked'] = $workedGridArray;
|
||||
$vuccArray['confirmed'] = $confirmedGridArray;
|
||||
|
||||
return $vuccArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the grids from the datbase
|
||||
*
|
||||
* Filters:
|
||||
*
|
||||
* $band = filter on band
|
||||
* $mode = filter on mode
|
||||
* $dxcc = filter on dxx
|
||||
* $cqz = filter on cq zone
|
||||
* $propagation = Filter on propagation
|
||||
* $fromdate = Date range from
|
||||
* $todate = Date range to
|
||||
* $column = Chooses if we fetch from col_gridsquare (only single grids) or col_vucc_grids (multisquares)
|
||||
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
|
||||
*
|
||||
*/
|
||||
function get_grids($station_id, $band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate, $confirmationMethod, $column) {
|
||||
$sql = "";
|
||||
|
||||
if ($column == 'single') {
|
||||
$sql .= "select distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
|
||||
from " . $this->config->item('table_name') .
|
||||
" where col_gridsquare <> ''";
|
||||
}
|
||||
else if ($column == 'multi') {
|
||||
$sql .= "select col_vucc_grids
|
||||
from " . $this->config->item('table_name') .
|
||||
" where col_vucc_grids <> '' ";
|
||||
}
|
||||
|
||||
if ($station_id != "All") {
|
||||
$sql .= ' and station_id = ' . $station_id;
|
||||
}
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
$sql .= " and (col_qsl_rcvd='Y' or col_lotw_qsl_rcvd='Y')";
|
||||
}
|
||||
else if ($confirmationMethod == 'qsl') {
|
||||
$sql .= " and col_qsl_rcvd='Y'";
|
||||
}
|
||||
else if ($confirmationMethod == 'lotw') {
|
||||
$sql .= " and col_lotw_qsl_rcvd='Y'";
|
||||
}
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
} else {
|
||||
$sql .= " and col_prop_mode !='SAT'";
|
||||
$sql .= " and col_band ='" . $band . "'";
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode != 'All') {
|
||||
$sql .= " and (COL_MODE = '" . $mode . "' or COL_SUBMODE = '" . $mode . "')";
|
||||
}
|
||||
|
||||
if ($dxcc != 'All') {
|
||||
$sql .= " and COL_DXCC ='" . $dxcc . "'";
|
||||
}
|
||||
|
||||
if ($cqz != 'All') {
|
||||
$sql .= " and COL_CQZ ='" . $cqz . "'";
|
||||
}
|
||||
|
||||
if ($propagation != 'All') {
|
||||
$sql .= " and COL_PROP_MODE ='" . $propagation . "'";
|
||||
}
|
||||
|
||||
// If date is set, we format the date and add it to the where-statement
|
||||
if ($fromdate != "") {
|
||||
$from = DateTime::createFromFormat('d/m/Y', $fromdate);
|
||||
$from = $from->format('Y-m-d');
|
||||
$sql .= " and date(COL_TIME_ON) >='" . $from . "'";
|
||||
}
|
||||
if ($todate != "") {
|
||||
$to = DateTime::createFromFormat('d/m/Y', $todate);
|
||||
$to = $to->format('Y-m-d');
|
||||
$sql .= " and date(COL_TIME_ON) <='" . $to . "'";
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->result_array();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -34,12 +34,14 @@ class DXCC extends CI_Model {
|
|||
|
||||
function get_worked_bands() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach($data->result() as $row){
|
||||
|
@ -47,7 +49,7 @@ class DXCC extends CI_Model {
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach($SAT_data->result() as $row){
|
||||
|
@ -66,69 +68,6 @@ class DXCC extends CI_Model {
|
|||
return $results;
|
||||
}
|
||||
|
||||
function show_stats(){
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$data = $this->db->query(
|
||||
"select COL_COUNTRY, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_COUNTRY) as cnt
|
||||
from ".$this->config->item('table_name')."
|
||||
where station_id = ".$station_id." AND COL_PROP_MODE != \"SAT\"
|
||||
group by COL_COUNTRY, COL_MODE, COL_BAND"
|
||||
);
|
||||
|
||||
$results = array();
|
||||
$last_country = "";
|
||||
foreach($data->result() as $row){
|
||||
if ($last_country != $row->COL_COUNTRY){
|
||||
// new row
|
||||
$results[$row->COL_COUNTRY] = $this->bandslots;
|
||||
$last_country = $row->COL_COUNTRY;
|
||||
}
|
||||
|
||||
// update stats
|
||||
if (!isset($results[$row->COL_COUNTRY]))
|
||||
$results[$row->COL_COUNTRY] = [];
|
||||
|
||||
if (!isset($results[$row->COL_COUNTRY][$row->COL_BAND]))
|
||||
$results[$row->COL_COUNTRY][$row->COL_BAND] = 0;
|
||||
|
||||
$results[$row->COL_COUNTRY][$row->COL_BAND] += $row->cnt;
|
||||
}
|
||||
|
||||
// Satellite DXCC
|
||||
|
||||
$satellite_data = $this->db->query(
|
||||
"select COL_COUNTRY, COL_PROP_MODE as COL_PROP_MODE, count(COL_COUNTRY) as cnt
|
||||
from ".$this->config->item('table_name')."
|
||||
where station_id = ".$station_id." AND COL_PROP_MODE = \"SAT\"
|
||||
group by COL_COUNTRY"
|
||||
);
|
||||
|
||||
foreach($satellite_data->result() as $row){
|
||||
if ($last_country != $row->COL_COUNTRY){
|
||||
// new row
|
||||
$results[$row->COL_COUNTRY] = $this->bandslots;
|
||||
$last_country = $row->COL_COUNTRY;
|
||||
}
|
||||
|
||||
// update stats
|
||||
if (!isset($results[$row->COL_COUNTRY]))
|
||||
$results[$row->COL_COUNTRY] = [];
|
||||
|
||||
if (!isset($results[$row->COL_COUNTRY][$row->COL_PROP_MODE]))
|
||||
$results[$row->COL_COUNTRY][$row->COL_PROP_MODE] = 0;
|
||||
|
||||
$results[$row->COL_COUNTRY][$row->COL_PROP_MODE] += $row->cnt;
|
||||
}
|
||||
|
||||
// print_r($results);
|
||||
// return;
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function: mostactive
|
||||
* Information: Returns the most active band
|
||||
|
@ -169,7 +108,7 @@ class DXCC extends CI_Model {
|
|||
}
|
||||
|
||||
/*
|
||||
* Fethes a list of all dxcc's, both current and deleted
|
||||
* Fetches a list of all dxcc's, both current and deleted
|
||||
*/
|
||||
function list() {
|
||||
$this->db->order_by('name', 'ASC');
|
||||
|
@ -187,8 +126,10 @@ class DXCC extends CI_Model {
|
|||
|
||||
function get_dxcc_array($dxccArray, $bands, $postdata) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
foreach ($bands as $band) { // Looping through bands and entities to generate the array needed for display
|
||||
foreach ($dxccArray as $dxcc) {
|
||||
|
@ -201,7 +142,7 @@ class DXCC extends CI_Model {
|
|||
|
||||
// If worked is checked, we add worked entities to the array
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$workedDXCC = $this->getDxccBandWorked($station_id, $band, $postdata);
|
||||
$workedDXCC = $this->getDxccBandWorked($location_list, $band, $postdata);
|
||||
foreach ($workedDXCC as $wdxcc) {
|
||||
//function displayContacts(searchphrase, band, mode, type) {
|
||||
$dxccMatrix[$wdxcc->dxcc][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC")\'>W</a></div>';
|
||||
|
@ -210,7 +151,7 @@ class DXCC extends CI_Model {
|
|||
|
||||
// If confirmed is checked, we add confirmed entities to the array
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$confirmedDXCC = $this->getDxccBandConfirmed($station_id, $band, $postdata);
|
||||
$confirmedDXCC = $this->getDxccBandConfirmed($location_list, $band, $postdata);
|
||||
foreach ($confirmedDXCC as $cdxcc) {
|
||||
$dxccMatrix[$cdxcc->dxcc][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.str_replace("&", "%26", $cdxcc->name).'","'. $band . '","'. $postdata['mode'] . '","DXCC")\'>C</a></div>';
|
||||
}
|
||||
|
@ -219,7 +160,7 @@ class DXCC extends CI_Model {
|
|||
|
||||
// We want to remove the worked dxcc's in the list, since we do not want to display them
|
||||
if ($postdata['worked'] == NULL) {
|
||||
$workedDxcc = $this->getDxccWorked($station_id, $postdata);
|
||||
$workedDxcc = $this->getDxccWorked($location_list, $postdata);
|
||||
foreach ($workedDxcc as $wdxcc) {
|
||||
if (array_key_exists($wdxcc->dxcc, $dxccMatrix)) {
|
||||
unset($dxccMatrix[$wdxcc->dxcc]);
|
||||
|
@ -229,7 +170,7 @@ class DXCC extends CI_Model {
|
|||
|
||||
// We want to remove the confirmed dxcc's in the list, since we do not want to display them
|
||||
if ($postdata['confirmed'] == NULL) {
|
||||
$confirmedDxcc = $this->getDxccConfirmed($station_id, $postdata);
|
||||
$confirmedDxcc = $this->getDxccConfirmed($location_list, $postdata);
|
||||
foreach ($confirmedDxcc as $cdxcc) {
|
||||
if (array_key_exists($cdxcc->dxcc, $dxccMatrix)) {
|
||||
unset($dxccMatrix[$cdxcc->dxcc]);
|
||||
|
@ -245,12 +186,12 @@ class DXCC extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
function getDxccBandConfirmed($station_id, $band, $postdata) {
|
||||
function getDxccBandConfirmed($location_list, $band, $postdata) {
|
||||
$sql = "select adif as dxcc, name from dxcc_entities
|
||||
join (
|
||||
select col_dxcc from ".$this->config->item('table_name')." thcv
|
||||
where station_id = " . $station_id .
|
||||
" and col_dxcc > 0";
|
||||
where station_id in (" . $location_list .
|
||||
") and col_dxcc > 0";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
|
@ -280,12 +221,12 @@ class DXCC extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccBandWorked($station_id, $band, $postdata) {
|
||||
function getDxccBandWorked($location_list, $band, $postdata) {
|
||||
$sql = "select adif as dxcc, name from dxcc_entities
|
||||
join (
|
||||
select col_dxcc from ".$this->config->item('table_name')." thcv
|
||||
where station_id = " . $station_id .
|
||||
" and col_dxcc > 0";
|
||||
where station_id in (" . $location_list .
|
||||
") and col_dxcc > 0";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and col_prop_mode ='" . $band . "'";
|
||||
|
@ -315,14 +256,16 @@ class DXCC extends CI_Model {
|
|||
|
||||
function fetchDxcc($postdata) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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 adif, prefix, name, date(end) Enddate, date(start) Startdate
|
||||
from dxcc_entities";
|
||||
|
||||
if ($postdata['notworked'] == NULL) {
|
||||
$sql .= " join (select col_dxcc from " . $this->config->item('table_name') . " where station_id = " . $station_id . " and col_dxcc > 0";
|
||||
$sql .= " join (select col_dxcc from " . $this->config->item('table_name') . " where station_id in (" . $location_list . ") and col_dxcc > 0";
|
||||
|
||||
if ($postdata['band'] != 'All') {
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
|
@ -355,13 +298,13 @@ class DXCC extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccWorked($station_id, $postdata) {
|
||||
function getDxccWorked($location_list, $postdata) {
|
||||
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
||||
join (
|
||||
select col_dxcc
|
||||
from ".$this->config->item('table_name')." thcv
|
||||
where station_id = " . $station_id .
|
||||
" and col_dxcc > 0";
|
||||
where station_id in (" . $location_list .
|
||||
") and col_dxcc > 0";
|
||||
|
||||
if ($postdata['band'] != 'All') {
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
|
@ -377,7 +320,7 @@ class DXCC extends CI_Model {
|
|||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
}
|
||||
|
||||
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id = $station_id and col_dxcc = thcv.col_dxcc and col_dxcc > 0";
|
||||
$sql .= " and not exists (select 1 from ".$this->config->item('table_name')." where station_id in (". $location_list .") and col_dxcc = thcv.col_dxcc and col_dxcc > 0";
|
||||
|
||||
if ($postdata['band'] != 'All') {
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
|
@ -412,13 +355,13 @@ class DXCC extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getDxccConfirmed($station_id, $postdata) {
|
||||
function getDxccConfirmed($location_list, $postdata) {
|
||||
$sql = "SELECT adif as dxcc FROM dxcc_entities
|
||||
join (
|
||||
select col_dxcc
|
||||
from ".$this->config->item('table_name')." thcv
|
||||
where station_id = ". $station_id .
|
||||
" and col_dxcc > 0";
|
||||
where station_id in (". $location_list .
|
||||
") and col_dxcc > 0";
|
||||
|
||||
if ($postdata['band'] != 'All') {
|
||||
if ($postdata['band'] == 'SAT') {
|
||||
|
@ -507,18 +450,20 @@ class DXCC extends CI_Model {
|
|||
function get_dxcc_summary($bands)
|
||||
{
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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)."'";
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $station_id);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
|
||||
$worked = $this->getSummaryByBand($band, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $location_list);
|
||||
$dxccSummary['worked'][$band] = $worked[0]->count;
|
||||
$dxccSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand('All', $station_id);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $station_id);
|
||||
$workedTotal = $this->getSummaryByBand('All', $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list);
|
||||
|
||||
$dxccSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$dxccSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
@ -526,11 +471,11 @@ class DXCC extends CI_Model {
|
|||
return $dxccSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $station_id)
|
||||
function getSummaryByBand($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id . " and col_dxcc > 0";
|
||||
$sql .= " where station_id in (" . $location_list . ") and col_dxcc > 0";
|
||||
|
||||
|
||||
if ($band == 'SAT') {
|
||||
|
@ -546,11 +491,11 @@ class DXCC extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getSummaryByBandConfirmed($band, $station_id)
|
||||
function getSummaryByBandConfirmed($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_dxcc) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id;
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
|
|
@ -7,41 +7,58 @@ class Gridsquares_model extends CI_Model {
|
|||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function get_worked_sat_squares() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->where("station_id", $station_id);
|
||||
$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->query('SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != ""');
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
|
||||
function get_confirmed_sat_squares() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
return $this->db->query('SELECT distinct substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")');
|
||||
$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 !=', '');
|
||||
$this->db->where('COL_LOTW_QSL_RCVD', 'Y');
|
||||
$this->db->or_where('COL_QSL_RCVD', 'Y');
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function get_confirmed_sat_vucc_squares() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
return $this->db->query('SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM '.$this->config->item('table_name').' WHERE station_id = "'.$station_id.'" 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")');
|
||||
$this->db->select('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 !=', '');
|
||||
$this->db->where('COL_LOTW_QSL_RCVD', 'Y');
|
||||
$this->db->or_where('COL_QSL_RCVD', 'Y');
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function get_worked_sat_vucc_squares() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->select('COL_PRIMARY_KEY, COL_VUCC_GRIDS, COL_SAT_NAME');
|
||||
$this->db->where("station_id", $station_id);
|
||||
$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'));
|
||||
|
@ -49,59 +66,61 @@ class Gridsquares_model extends CI_Model {
|
|||
|
||||
function get_band($band) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
|
||||
$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 !=', '');
|
||||
|
||||
$sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
|
||||
.$this->config->item('table_name')
|
||||
.' WHERE station_id = "'
|
||||
.$station_id.'" 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 = ""';
|
||||
$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->query($sql);
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function get_band_confirmed($band) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
|
||||
$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 !=', '');
|
||||
|
||||
$sql = 'SELECT distinct substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
|
||||
.$this->config->item('table_name')
|
||||
.' WHERE station_id = "'
|
||||
.$station_id.'" 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 = ""';
|
||||
$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 =', "");
|
||||
}
|
||||
|
||||
$sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
|
||||
$this->db->where('COL_LOTW_QSL_RCVD', 'Y');
|
||||
$this->db->or_where('COL_QSL_RCVD', 'Y');
|
||||
|
||||
|
||||
return $this->db->query($sql);
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function search_band($band, $gridsquare) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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 = "' . $station_id . '" '
|
||||
.' WHERE station_id IN (' . $location_list . ') '
|
||||
. ' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")';
|
||||
|
||||
if ($band != 'All') {
|
||||
|
@ -122,12 +141,14 @@ class Gridsquares_model extends CI_Model {
|
|||
|
||||
function search_sat($gridsquare) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$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 = "'.$station_id. '"' .
|
||||
' WHERE station_id IN ('.$location_list. ')' .
|
||||
' AND (COL_GRIDSQUARE LIKE "%'.$gridsquare.'%" or COL_VUCC_GRIDS LIKE "%'.$gridsquare.'%")'.
|
||||
' AND COL_PROP_MODE = "SAT"';
|
||||
|
||||
|
|
|
@ -32,13 +32,15 @@ class IOTA extends CI_Model {
|
|||
}
|
||||
|
||||
function get_worked_bands() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach($data->result() as $row){
|
||||
|
@ -46,7 +48,7 @@ class IOTA extends CI_Model {
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach($SAT_data->result() as $row){
|
||||
|
@ -64,9 +66,11 @@ class IOTA extends CI_Model {
|
|||
}
|
||||
|
||||
function get_iota_array($iotaArray, $bands, $postdata) {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
foreach ($bands as $band) { // Looping through bands and iota to generate the array needed for display
|
||||
foreach ($iotaArray as $iota) {
|
||||
|
@ -79,7 +83,7 @@ class IOTA extends CI_Model {
|
|||
|
||||
// If worked is checked, we add worked iotas to the array
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$workedIota = $this->getIotaBandWorked($station_id, $band, $postdata);
|
||||
$workedIota = $this->getIotaBandWorked($location_list, $band, $postdata);
|
||||
foreach ($workedIota as $wiota) {
|
||||
$iotaMatrix[$wiota->tag][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("'.$wiota->tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>W</a></div>';
|
||||
}
|
||||
|
@ -87,7 +91,7 @@ class IOTA extends CI_Model {
|
|||
|
||||
// If confirmed is checked, we add confirmed iotas to the array
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$confirmedIota = $this->getIotaBandConfirmed($station_id, $band, $postdata);
|
||||
$confirmedIota = $this->getIotaBandConfirmed($location_list, $band, $postdata);
|
||||
foreach ($confirmedIota as $ciota) {
|
||||
$iotaMatrix[$ciota->tag][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("'.$ciota->tag.'","'. $band . '","'. $postdata['mode'] . '","IOTA")\'>C</a></div>';
|
||||
}
|
||||
|
@ -96,7 +100,7 @@ class IOTA extends CI_Model {
|
|||
|
||||
// We want to remove the worked iotas in the list, since we do not want to display them
|
||||
if ($postdata['worked'] == NULL) {
|
||||
$workedIota = $this->getIotaWorked($station_id, $postdata);
|
||||
$workedIota = $this->getIotaWorked($location_list, $postdata);
|
||||
foreach ($workedIota as $wiota) {
|
||||
if (array_key_exists($wiota->tag, $iotaMatrix)) {
|
||||
unset($iotaMatrix[$wiota->tag]);
|
||||
|
@ -106,7 +110,7 @@ class IOTA extends CI_Model {
|
|||
|
||||
// We want to remove the confirmed iotas in the list, since we do not want to display them
|
||||
if ($postdata['confirmed'] == NULL) {
|
||||
$confirmedIOTA = $this->getIotaConfirmed($station_id, $postdata);
|
||||
$confirmedIOTA = $this->getIotaConfirmed($location_list, $postdata);
|
||||
foreach ($confirmedIOTA as $ciota) {
|
||||
if (array_key_exists($ciota->tag, $iotaMatrix)) {
|
||||
unset($iotaMatrix[$ciota->tag]);
|
||||
|
@ -122,11 +126,11 @@ class IOTA extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
function getIotaBandConfirmed($station_id, $band, $postdata) {
|
||||
function getIotaBandConfirmed($location_list, $band, $postdata) {
|
||||
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
|
||||
join iota on thcv.col_iota = iota.tag
|
||||
where station_id = " . $station_id .
|
||||
" and thcv.col_iota is not null
|
||||
where station_id in (" . $location_list .
|
||||
") and thcv.col_iota is not null
|
||||
and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
|
@ -152,11 +156,11 @@ class IOTA extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getIotaBandWorked($station_id, $band, $postdata) {
|
||||
function getIotaBandWorked($location_list, $band, $postdata) {
|
||||
$sql = 'SELECT distinct col_iota as tag FROM ' . $this->config->item('table_name'). ' thcv
|
||||
join iota on thcv.col_iota = iota.tag
|
||||
where station_id = ' . $station_id .
|
||||
' and thcv.col_iota is not null';
|
||||
where station_id in (' . $location_list .
|
||||
') and thcv.col_iota is not null';
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -182,10 +186,6 @@ class IOTA extends CI_Model {
|
|||
}
|
||||
|
||||
function fetchIota($postdata) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
|
||||
$sql = "select tag, name, prefix, dxccid, status from iota where 1=1";
|
||||
|
||||
if ($postdata['includedeleted'] == NULL) {
|
||||
|
@ -195,7 +195,7 @@ class IOTA extends CI_Model {
|
|||
$sql .= $this->addContinentsToQuery($postdata);
|
||||
|
||||
if ($postdata['notworked'] == NULL) {
|
||||
$sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id = ". $station_id . " and col_iota = iota.tag";
|
||||
$sql .= " and exists (select 1 from " . $this->config->item('table_name') . " where station_id in (". $location_list . ") and col_iota = iota.tag";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -219,12 +219,12 @@ class IOTA extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getIotaWorked($station_id, $postdata) {
|
||||
function getIotaWorked($location_list, $postdata) {
|
||||
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
|
||||
join iota on thcv.col_iota = iota.tag
|
||||
where station_id = " . $station_id .
|
||||
" and thcv.col_iota is not null
|
||||
and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $station_id .
|
||||
where station_id in (" . $location_list .
|
||||
") and thcv.col_iota is not null
|
||||
and not exists (select 1 from ". $this->config->item('table_name') . " where station_id = ". $location_list .
|
||||
" and col_iota = thcv.col_iota";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
|
@ -268,11 +268,11 @@ class IOTA extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getIotaConfirmed($station_id, $postdata) {
|
||||
function getIotaConfirmed($location_list, $postdata) {
|
||||
$sql = "SELECT distinct col_iota as tag FROM " . $this->config->item('table_name') . " thcv
|
||||
join iota on thcv.col_iota = iota.tag
|
||||
where station_id = " . $station_id .
|
||||
" and thcv.col_iota is not null
|
||||
where station_id in (" . $location_list .
|
||||
") and thcv.col_iota is not null
|
||||
and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
|
@ -338,19 +338,21 @@ class IOTA extends CI_Model {
|
|||
*/
|
||||
function get_iota_summary($bands)
|
||||
{
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $station_id);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
|
||||
$worked = $this->getSummaryByBand($band, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $location_list);
|
||||
$iotaSummary['worked'][$band] = $worked[0]->count;
|
||||
$iotaSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand('All', $station_id);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $station_id);
|
||||
$workedTotal = $this->getSummaryByBand('All', $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list);
|
||||
|
||||
$iotaSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$iotaSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
@ -358,11 +360,11 @@ class IOTA extends CI_Model {
|
|||
return $iotaSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $station_id)
|
||||
function getSummaryByBand($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id;
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
@ -378,11 +380,11 @@ class IOTA extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getSummaryByBandConfirmed($band, $station_id)
|
||||
function getSummaryByBandConfirmed($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id;
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
|
|
@ -237,8 +237,8 @@ class Logbook_model extends CI_Model {
|
|||
*/
|
||||
public function qso_details($searchphrase, $band, $mode, $type){
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
switch ($type) {
|
||||
case 'DXCC':
|
||||
|
@ -269,7 +269,7 @@ class Logbook_model extends CI_Model {
|
|||
break;
|
||||
}
|
||||
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
|
||||
if ($band != 'All') {
|
||||
if($band != "SAT") {
|
||||
|
@ -288,11 +288,14 @@ class Logbook_model extends CI_Model {
|
|||
}
|
||||
|
||||
public function vucc_qso_details($gridsquare, $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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "select * from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" where station_id in (" . $location_list . ")" .
|
||||
" and (col_gridsquare like '" . $gridsquare. "%'
|
||||
or col_vucc_grids like '%" . $gridsquare. "%')";
|
||||
|
||||
|
@ -309,9 +312,9 @@ class Logbook_model extends CI_Model {
|
|||
}
|
||||
|
||||
public function timeline_qso_details($querystring, $band, $mode, $type){
|
||||
$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'));
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -326,7 +329,7 @@ class Logbook_model extends CI_Model {
|
|||
$this->db->where('col_mode', $mode);
|
||||
}
|
||||
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
|
||||
switch($type) {
|
||||
case 'dxcc': $this->db->where('COL_DXCC', $querystring); break;
|
||||
|
@ -960,54 +963,63 @@ class Logbook_model extends CI_Model {
|
|||
function totals_year() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
|
||||
$this->db->select('DATE_FORMAT(COL_TIME_ON, \'%Y\') as \'year\',COUNT(COL_PRIMARY_KEY) as \'total\'', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('DATE_FORMAT(COL_TIME_ON, \'%Y\')');
|
||||
$this->db->order_by('year', 'ASC');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$query = $this->db->query('
|
||||
SELECT DATE_FORMAT(COL_TIME_ON, \'%Y\') as \'year\',
|
||||
COUNT(COL_PRIMARY_KEY) as \'total\'
|
||||
FROM '.$this->config->item('table_name').'
|
||||
WHERE station_id = '.$station_id.'
|
||||
GROUP BY DATE_FORMAT(COL_TIME_ON, \'%Y\')
|
||||
');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Return total number of qsos */
|
||||
function total_qsos() {
|
||||
function total_qsos() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.'');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
return $row->count;
|
||||
}
|
||||
return $row->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return number of QSOs had today */
|
||||
function todays_qsos() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_TIME_ON >=', $morning);
|
||||
$this->db->where('COL_TIME_ON <=', $night);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
return $row->count;
|
||||
}
|
||||
return $row->count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Return QSOs over a period of days */
|
||||
|
@ -1069,8 +1081,8 @@ class Logbook_model extends CI_Model {
|
|||
function month_qsos() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$morning = date('Y-m-01 00:00:00');
|
||||
|
||||
|
@ -1079,7 +1091,11 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
$night = $date->format('Y-m-d')." 23:59:59";
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_TIME_ON >=', $morning);
|
||||
$this->db->where('COL_TIME_ON <=', $night);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1108,12 +1124,17 @@ class Logbook_model extends CI_Model {
|
|||
function year_qsos() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$morning = date('Y-01-01 00:00:00');
|
||||
$night = date('Y-12-31 23:59:59');
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_TIME_ON >=', $morning);
|
||||
$this->db->where('COL_TIME_ON <=', $night);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1128,10 +1149,16 @@ class Logbook_model extends CI_Model {
|
|||
function total_ssb() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_MODE = \'SSB\' OR COL_MODE = \'LSB\' OR COL_MODE = \'USB\'');
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_MODE', 'SSB');
|
||||
$this->db->or_where('COL_MODE', 'LSB');
|
||||
$this->db->or_where('COL_MODE', 'USB');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1145,11 +1172,15 @@ class Logbook_model extends CI_Model {
|
|||
/* Return total number of satellite QSOs */
|
||||
function total_sat() {
|
||||
|
||||
$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'));
|
||||
|
||||
$query = $this->db->query('SELECT COL_SAT_NAME, COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_SAT_NAME != \'null\' GROUP BY COL_SAT_NAME');
|
||||
$this->db->select('COL_SAT_NAME, COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_SAT_NAME !=', 'null');
|
||||
$this->db->group_by('COL_SAT_NAME');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
@ -1158,10 +1189,13 @@ class Logbook_model extends CI_Model {
|
|||
function total_cw() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_MODE = \'CW\' ');
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_MODE', 'CW');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1176,10 +1210,13 @@ class Logbook_model extends CI_Model {
|
|||
function total_fm() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_MODE = \'FM\'');
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_MODE', 'FM');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1194,10 +1231,19 @@ class Logbook_model extends CI_Model {
|
|||
function total_digi() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_MODE != \'SSB\' AND COL_MODE != \'LSB\' AND COL_MODE != \'USB\' AND COL_MODE != \'CW\' AND COL_MODE != \'FM\' AND COL_MODE != \'AM\'');
|
||||
$this->db->select('COUNT( * ) as count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_MODE !=', 'SSB');
|
||||
$this->db->where('COL_MODE !=', 'LSB');
|
||||
$this->db->where('COL_MODE !=', 'USB');
|
||||
$this->db->where('COL_MODE !=', 'CW');
|
||||
$this->db->where('COL_MODE !=', 'FM');
|
||||
$this->db->where('COL_MODE !=', 'AM');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
|
@ -1216,14 +1262,18 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
/* Return total number of QSOs per band */
|
||||
function total_bands() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$this->db->select('DISTINCT (COL_BAND) AS band, count( * ) AS count', FALSE);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->group_by('band');
|
||||
$this->db->order_by('count', 'DESC');
|
||||
|
||||
$query = $this->db->query('SELECT DISTINCT (COL_BAND) AS band, count( * ) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' GROUP BY band ORDER BY count DESC');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Return total number of QSL Cards sent */
|
||||
|
@ -2432,11 +2482,11 @@ class Logbook_model extends CI_Model {
|
|||
}
|
||||
|
||||
function county_qso_details($state, $county) {
|
||||
$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('station_id', $station_id);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_STATE', $state);
|
||||
$this->db->where('COL_CNTY', $county);
|
||||
$this->db->where('COL_PROP_MODE !=', 'SAT');
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Logbooks_model extends CI_Model {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function show_all() {
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
return $this->db->get('station_logbooks');
|
||||
}
|
||||
|
||||
function add() {
|
||||
// Create data array with field values
|
||||
$data = array(
|
||||
'user_id' => $this->session->userdata('user_id'),
|
||||
'logbook_name' => xss_clean($this->input->post('stationLogbook_Name', true)),
|
||||
);
|
||||
|
||||
// Insert Records
|
||||
$this->db->insert('station_logbooks', $data);
|
||||
}
|
||||
|
||||
function delete($id) {
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
// Delete QSOs
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where('logbook_id', $id);
|
||||
$this->db->delete('station_logbooks');
|
||||
}
|
||||
|
||||
function edit() {
|
||||
$data = array(
|
||||
'logbook_name' => xss_clean($this->input->post('station_logbook_name', true)),
|
||||
);
|
||||
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where('logbook_id', xss_clean($this->input->post('logbook_id', true)));
|
||||
$this->db->update('station_logbooks', $data);
|
||||
}
|
||||
|
||||
function set_logbook_active($id) {
|
||||
$data = array(
|
||||
'active_station_logbook' => xss_clean($id),
|
||||
);
|
||||
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->update('users', $data);
|
||||
}
|
||||
|
||||
function logbook($id) {
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where('logbook_id', $clean_id);
|
||||
return $this->db->get('station_logbooks');
|
||||
}
|
||||
|
||||
|
||||
// Creates relationship between a logbook and a station location
|
||||
function create_logbook_location_link($logbook_id, $location_id) {
|
||||
// Create data array with field values
|
||||
$data = array(
|
||||
'station_logbook_id' => $logbook_id,
|
||||
'station_location_id' => $location_id,
|
||||
);
|
||||
|
||||
// Insert Record
|
||||
$this->db->insert('station_logbooks_relationship', $data);
|
||||
}
|
||||
|
||||
function relationship_exists($logbook_id, $location_id) {
|
||||
$this->db->where('station_logbook_id', $logbook_id);
|
||||
$this->db->where('station_location_id', $location_id);
|
||||
$query = $this->db->get('station_logbooks_relationship');
|
||||
|
||||
if ($query->num_rows() > 0){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function list_logbook_relationships($logbook_id) {
|
||||
|
||||
$relationships_array = array();
|
||||
|
||||
$this->db->where('station_logbook_id', $logbook_id);
|
||||
$query = $this->db->get('station_logbooks_relationship');
|
||||
|
||||
if ($query->num_rows() > 0){
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
array_push($relationships_array, $row->station_location_id);
|
||||
}
|
||||
|
||||
return $relationships_array;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -8,7 +8,7 @@ class Lookup_model extends CI_Model{
|
|||
}
|
||||
|
||||
function getSearchResult($queryinfo){
|
||||
$modes = $this->get_worked_modes($queryinfo['station_id']);
|
||||
$modes = $this->get_worked_modes($queryinfo['location_list']);
|
||||
|
||||
return $this->getResultFromDatabase($queryinfo, $modes);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class Lookup_model extends CI_Model{
|
|||
case 'dxcc': $sqlquerytypestring .= " and col_dxcc = " . $queryinfo['dxcc']; break;
|
||||
case 'iota': $sqlquerytypestring .= " and col_iota = '" . $queryinfo['iota'] . "'"; break;
|
||||
case 'grid': $sqlquerytypestring .= " and (col_gridsquare like '%" . $fixedgrid . "%' or col_vucc_grids like '%" . $fixedgrid . "%')" ; break;
|
||||
case 'cqz': $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; break;
|
||||
case 'cqz': $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; break;
|
||||
case 'was': $sqlquerytypestring .= " and col_state = '" . $queryinfo['was'] . "' and COL_DXCC in ('291', '6', '110')";; break;
|
||||
case 'sota': $sqlquerytypestring .= " and col_sota_ref = '" . $queryinfo['sota'] . "'"; break;
|
||||
case 'wwff': $sqlquerytypestring .= " and col_sig = 'WWFF' and col_sig_info = '" . $queryinfo['wwff'] . "'"; break;
|
||||
|
@ -70,7 +70,7 @@ class Lookup_model extends CI_Model{
|
|||
// Fetching info for all modes and bands except satellite
|
||||
$sql = "SELECT distinct col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $queryinfo['station_id'];
|
||||
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
|
||||
|
||||
$sql .= " and coalesce(col_submode, '') = ''";
|
||||
|
||||
|
@ -83,7 +83,7 @@ class Lookup_model extends CI_Model{
|
|||
// Fetching info for all sub_modes and bands except satellite
|
||||
$sql .= " union SELECT distinct col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $queryinfo['station_id'];
|
||||
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
|
||||
|
||||
$sql .= " and coalesce(col_submode, '') <> ''";
|
||||
|
||||
|
@ -96,7 +96,7 @@ class Lookup_model extends CI_Model{
|
|||
// Fetching info for all modes on satellite
|
||||
$sql .= " union SELECT distinct 'SAT' col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $queryinfo['station_id'];
|
||||
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
|
||||
|
||||
$sql .= " and coalesce(col_submode, '') = ''";
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Lookup_model extends CI_Model{
|
|||
// Fetching info for all sub_modes on satellite
|
||||
$sql .= " union SELECT distinct 'SAT' col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $queryinfo['station_id'];
|
||||
$sql .= " where station_id in (" . $queryinfo['location_list'] . ")";
|
||||
|
||||
$sql .= " and coalesce(col_submode, '') <> ''";
|
||||
|
||||
|
@ -150,11 +150,11 @@ class Lookup_model extends CI_Model{
|
|||
/*
|
||||
* Get's the worked bands from the log
|
||||
*/
|
||||
function get_worked_bands($station_id)
|
||||
function get_worked_bands($location_list)
|
||||
{
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -162,7 +162,7 @@ class Lookup_model extends CI_Model{
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
@ -182,11 +182,11 @@ class Lookup_model extends CI_Model{
|
|||
/*
|
||||
* Get's the worked modes from the log
|
||||
*/
|
||||
function get_worked_modes($station_id)
|
||||
function get_worked_modes($location_list)
|
||||
{
|
||||
// get all worked modes from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " order by COL_MODE ASC"
|
||||
"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") order by COL_MODE ASC"
|
||||
);
|
||||
$results = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -194,7 +194,7 @@ class Lookup_model extends CI_Model{
|
|||
}
|
||||
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC"
|
||||
"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC"
|
||||
);
|
||||
foreach ($data->result() as $row) {
|
||||
if (!in_array($row, $results)) {
|
||||
|
|
|
@ -6,27 +6,29 @@ class Sig extends CI_Model {
|
|||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function get_all($type) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->where("station_id", $station_id);
|
||||
$this->db->where_in("station_id", $logbooks_locations_array);
|
||||
$this->db->order_by("COL_SIG_INFO", "ASC");
|
||||
$this->db->where('COL_SIG =', $type);
|
||||
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function get_all_sig_types() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') .
|
||||
" where col_sig <> ''" .
|
||||
" and station_id = " . $station_id .
|
||||
" and station_id in (" . $location_list . ")" .
|
||||
" group by col_sig";
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
@ -37,4 +39,4 @@ class Sig extends CI_Model {
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -6,18 +6,18 @@ class Sota extends CI_Model {
|
|||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function get_all() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->where("station_id", $station_id);
|
||||
$this->db->order_by("COL_SOTA_REF", "ASC");
|
||||
$this->db->where_in("station_id", $logbooks_locations_array);
|
||||
$this->db->order_by("COL_SOTA_REF", "ASC");
|
||||
$this->db->where('COL_SOTA_REF !=', '');
|
||||
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -14,10 +14,13 @@ class Stations extends CI_Model {
|
|||
$this->db->from('station_profile');
|
||||
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
|
||||
$this->db->group_by('station_profile.station_id');
|
||||
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
|
||||
$this->db->or_where('station_profile.user_id =', NULL);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function all() {
|
||||
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
|
||||
return $this->db->get('station_profile');
|
||||
}
|
||||
|
||||
|
@ -114,6 +117,15 @@ class Stations extends CI_Model {
|
|||
$this->db->delete($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function claim_user($id) {
|
||||
$data = array(
|
||||
'user_id' => $this->session->userdata('user_id'),
|
||||
);
|
||||
|
||||
$this->db->where('station_id', $id);
|
||||
$this->db->update('station_profile', $data);
|
||||
}
|
||||
|
||||
function set_active($current, $new) {
|
||||
|
||||
// Clean inputs
|
||||
|
|
|
@ -10,25 +10,27 @@ class Timeline_model extends CI_Model
|
|||
}
|
||||
|
||||
function get_timeline($band, $mode, $award) {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
switch ($award) {
|
||||
case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $station_id); break;
|
||||
case 'was': $result = $this->get_timeline_was($band, $mode, $station_id); break;
|
||||
case 'iota': $result = $this->get_timeline_iota($band, $mode, $station_id); break;
|
||||
case 'waz': $result = $this->get_timeline_waz($band, $mode, $station_id); break;
|
||||
case 'dxcc': $result = $this->get_timeline_dxcc($band, $mode, $location_list); break;
|
||||
case 'was': $result = $this->get_timeline_was($band, $mode, $location_list); break;
|
||||
case 'iota': $result = $this->get_timeline_iota($band, $mode, $location_list); break;
|
||||
case 'waz': $result = $this->get_timeline_waz($band, $mode, $location_list); break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function get_timeline_dxcc($band, $mode, $station_id) {
|
||||
public function get_timeline_dxcc($band, $mode, $location_list) {
|
||||
$sql = "select min(date(COL_TIME_ON)) date, prefix, col_country, end, adif from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -52,10 +54,10 @@ class Timeline_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_timeline_was($band, $mode, $station_id) {
|
||||
public function get_timeline_was($band, $mode, $location_list) {
|
||||
$sql = "select min(date(COL_TIME_ON)) date, col_state from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -82,11 +84,11 @@ class Timeline_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_timeline_iota($band, $mode, $station_id) {
|
||||
public function get_timeline_iota($band, $mode, $location_list) {
|
||||
$sql = "select min(date(COL_TIME_ON)) date, col_iota, name, prefix from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
join iota on thcv.col_iota = iota.tag
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -110,10 +112,10 @@ class Timeline_model extends CI_Model
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
public function get_timeline_waz($band, $mode, $station_id) {
|
||||
public function get_timeline_waz($band, $mode, $location_list) {
|
||||
$sql = "select min(date(COL_TIME_ON)) date, col_cqz from "
|
||||
.$this->config->item('table_name'). " thcv
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
|
@ -162,13 +164,15 @@ class Timeline_model extends CI_Model
|
|||
|
||||
function get_worked_bands()
|
||||
{
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -176,7 +180,7 @@ class Timeline_model extends CI_Model
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
|
|
@ -10,12 +10,14 @@ class Timeplotter_model extends CI_Model
|
|||
}
|
||||
|
||||
function get_worked_bands() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -23,7 +25,7 @@ class Timeplotter_model extends CI_Model
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
@ -64,9 +66,9 @@ class Timeplotter_model extends CI_Model
|
|||
);
|
||||
|
||||
function getTimes($postdata) {
|
||||
$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->select('time(col_time_on) time, col_call as callsign');
|
||||
|
||||
|
@ -87,7 +89,7 @@ class Timeplotter_model extends CI_Model
|
|||
$this->db->where('col_cqz', $postdata['cqzone']);
|
||||
}
|
||||
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$datearray = $this->db->get($this->config->item('table_name'));
|
||||
$this->plot($datearray->result_array());
|
||||
}
|
||||
|
@ -148,4 +150,4 @@ class Timeplotter_model extends CI_Model
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ class User_Model extends CI_Model {
|
|||
'user_column3' => isset($u->row()->user_column3) ? $u->row()->user_column3: 'RSTR',
|
||||
'user_column4' => isset($u->row()->user_column4) ? $u->row()->user_column4: 'Band',
|
||||
'user_column5' => isset($u->row()->user_column5) ? $u->row()->user_column5: 'Country',
|
||||
'active_station_logbook' => $u->row()->active_station_logbook,
|
||||
);
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
|
|
|
@ -34,13 +34,15 @@ class VUCC extends CI_Model
|
|||
|
||||
function get_worked_bands()
|
||||
{
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach ($data->result() as $row) {
|
||||
|
@ -48,7 +50,7 @@ class VUCC extends CI_Model
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach ($SAT_data->result() as $row) {
|
||||
|
@ -159,11 +161,15 @@ class VUCC extends CI_Model
|
|||
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
|
||||
*/
|
||||
function get_vucc_summary_col_vucc($band, $confirmationMethod) {
|
||||
$station_id = $this->get_station_id();
|
||||
$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_vucc_grids
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" where station_id in (" . $location_list . ")" .
|
||||
" and col_vucc_grids <> '' ";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
|
@ -195,10 +201,15 @@ class VUCC extends CI_Model
|
|||
* $confirmationMethod - qsl, lotw or both, use anything else to skip confirmed
|
||||
*/
|
||||
function get_vucc_summary($band, $confirmationMethod) {
|
||||
$station_id = $this->get_station_id();
|
||||
$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 distinct upper(substring(col_gridsquare, 1, 4)) gridsquare
|
||||
from " . $this->config->item('table_name') .
|
||||
" where station_id =" . $station_id .
|
||||
" where station_id in (" . $location_list . ")" .
|
||||
" and col_gridsquare <> ''";
|
||||
|
||||
if ($confirmationMethod == 'both') {
|
||||
|
@ -371,11 +382,5 @@ class VUCC extends CI_Model
|
|||
|
||||
return $workedGridArray;
|
||||
}
|
||||
|
||||
function get_station_id() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
return $CI->Stations->find_active();
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -34,13 +34,15 @@ class was extends CI_Model {
|
|||
}
|
||||
|
||||
function get_worked_bands() {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// get all worked slots from database
|
||||
$data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE != \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
|
||||
);
|
||||
$worked_slots = array();
|
||||
foreach($data->result() as $row){
|
||||
|
@ -48,7 +50,7 @@ class was extends CI_Model {
|
|||
}
|
||||
|
||||
$SAT_data = $this->db->query(
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_PROP_MODE = \"SAT\""
|
||||
"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\""
|
||||
);
|
||||
|
||||
foreach($SAT_data->result() as $row){
|
||||
|
@ -66,9 +68,11 @@ class was extends CI_Model {
|
|||
}
|
||||
|
||||
function get_was_array($bands, $postdata) {
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$stateArray = explode(',', $this->stateString);
|
||||
|
||||
|
@ -85,14 +89,14 @@ class was extends CI_Model {
|
|||
}
|
||||
|
||||
if ($postdata['worked'] != NULL) {
|
||||
$wasBand = $this->getWasWorked($station_id, $band, $postdata);
|
||||
$wasBand = $this->getWasWorked($location_list, $band, $postdata);
|
||||
foreach ($wasBand as $line) {
|
||||
$bandWas[$line->col_state][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>W</a></div>';
|
||||
$states[$line->col_state]['count']++;
|
||||
}
|
||||
}
|
||||
if ($postdata['confirmed'] != NULL) {
|
||||
$wasBand = $this->getWasConfirmed($station_id, $band, $postdata);
|
||||
$wasBand = $this->getWasConfirmed($location_list, $band, $postdata);
|
||||
foreach ($wasBand as $line) {
|
||||
$bandWas[$line->col_state][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . $line->col_state . '","' . $band . '","'. $postdata['mode'] . '","WAS")\'>C</a></div>';
|
||||
$states[$line->col_state]['count']++;
|
||||
|
@ -102,7 +106,7 @@ class was extends CI_Model {
|
|||
|
||||
// We want to remove the worked states in the list, since we do not want to display them
|
||||
if ($postdata['worked'] == NULL) {
|
||||
$wasBand = $this->getWasWorked($station_id, $postdata['band'], $postdata);
|
||||
$wasBand = $this->getWasWorked($location_list, $postdata['band'], $postdata);
|
||||
foreach ($wasBand as $line) {
|
||||
unset($bandWas[$line->col_state]);
|
||||
}
|
||||
|
@ -110,7 +114,7 @@ class was extends CI_Model {
|
|||
|
||||
// We want to remove the confirmed states in the list, since we do not want to display them
|
||||
if ($postdata['confirmed'] == NULL) {
|
||||
$wasBand = $this->getWasConfirmed($station_id, $postdata['band'], $postdata);
|
||||
$wasBand = $this->getWasConfirmed($location_list, $postdata['band'], $postdata);
|
||||
foreach ($wasBand as $line) {
|
||||
unset($bandWas[$line->col_state]);
|
||||
}
|
||||
|
@ -137,19 +141,21 @@ class was extends CI_Model {
|
|||
*/
|
||||
function get_was_summary($bands)
|
||||
{
|
||||
$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'));
|
||||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$worked = $this->getSummaryByBand($band, $station_id);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
|
||||
$worked = $this->getSummaryByBand($band, $location_list);
|
||||
$confirmed = $this->getSummaryByBandConfirmed($band, $location_list);
|
||||
$wasSummary['worked'][$band] = $worked[0]->count;
|
||||
$wasSummary['confirmed'][$band] = $confirmed[0]->count;
|
||||
}
|
||||
|
||||
$workedTotal = $this->getSummaryByBand('All', $station_id);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $station_id);
|
||||
$workedTotal = $this->getSummaryByBand('All', $location_list);
|
||||
$confirmedTotal = $this->getSummaryByBandConfirmed('All', $location_list);
|
||||
|
||||
$wasSummary['worked']['Total'] = $workedTotal[0]->count;
|
||||
$wasSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
|
||||
|
@ -157,11 +163,11 @@ class was extends CI_Model {
|
|||
return $wasSummary;
|
||||
}
|
||||
|
||||
function getSummaryByBand($band, $station_id)
|
||||
function getSummaryByBand($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id;
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
@ -179,11 +185,11 @@ class was extends CI_Model {
|
|||
return $query->result();
|
||||
}
|
||||
|
||||
function getSummaryByBandConfirmed($band, $station_id)
|
||||
function getSummaryByBandConfirmed($band, $location_list)
|
||||
{
|
||||
$sql = "SELECT count(distinct thcv.col_state) as count FROM " . $this->config->item('table_name') . " thcv";
|
||||
|
||||
$sql .= " where station_id = " . $station_id;
|
||||
$sql .= " where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($band == 'SAT') {
|
||||
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
|
||||
|
@ -207,9 +213,9 @@ class was extends CI_Model {
|
|||
* Function returns all worked, but not confirmed states
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getWasWorked($station_id, $band, $postdata) {
|
||||
function getWasWorked($location_list, $band, $postdata) {
|
||||
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
@ -220,7 +226,7 @@ class was extends CI_Model {
|
|||
$sql .= $this->addBandToQuery($band);
|
||||
|
||||
$sql .= " and not exists (select 1 from ". $this->config->item('table_name') .
|
||||
" where station_id = ". $station_id .
|
||||
" where station_id in (". $location_list . ")" .
|
||||
" and col_state = thcv.col_state";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
|
@ -244,9 +250,9 @@ class was extends CI_Model {
|
|||
* Function returns all confirmed states on given band and on LoTW or QSL
|
||||
* $postdata contains data from the form, in this case Lotw or QSL are used
|
||||
*/
|
||||
function getWasConfirmed($station_id, $band, $postdata) {
|
||||
function getWasConfirmed($location_list, $band, $postdata) {
|
||||
$sql = "SELECT distinct col_state FROM " . $this->config->item('table_name') . " thcv
|
||||
where station_id = " . $station_id;
|
||||
where station_id in (" . $location_list . ")";
|
||||
|
||||
if ($postdata['mode'] != 'All') {
|
||||
$sql .= " and (col_mode = '" . $postdata['mode'] . "' or col_submode = '" . $postdata['mode'] . "')";
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
<div class="container">
|
||||
<br>
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Export your logbook for use in DX Atlas to display worked / confirmed gridsquares.
|
||||
</div>
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
Only QSOs with a gridsquare defined will be exported!
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form class="form" action="<?php echo site_url('dxatlas/export'); ?>" method="post" enctype="multipart/form-data">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="station_profile"><?php echo $this->lang->line('cloudlog_station_profile'); ?></label>
|
||||
<select name="station_profile" class="station_id custom-select">
|
||||
<option value="All">All</option>
|
||||
<?php foreach ($station_profile->result() as $station) { ?>
|
||||
<option value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="band">Band</label>
|
||||
<select id="band" name="band" class="custom-select">
|
||||
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> >Every band</option>
|
||||
<?php foreach($worked_bands as $band) {
|
||||
echo '<option value="' . $band . '"';
|
||||
if ($this->input->post('band') == $band) echo ' selected';
|
||||
echo '>' . $band . '</option>'."\n";
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mode">Mode</label>
|
||||
<select id="mode" name="mode" class="form-control custom-select">
|
||||
<option value="All">All</option>
|
||||
<?php
|
||||
foreach($modes->result() as $mode){
|
||||
if ($mode->submode == null) {
|
||||
echo '<option value="' . $mode->mode . '">'. $mode->mode . '</option>'."\n";
|
||||
} else {
|
||||
echo '<option value="' . $mode->submode . '">' . $mode->submode . '</option>'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="dxcc_id">DXCC</label>
|
||||
<select class="custom-select" id="dxcc_id" name="dxcc_id">
|
||||
<option value="All">All</option>
|
||||
<?php
|
||||
foreach($dxcc as $d){
|
||||
echo '<option value=' . $d->adif . '>' . $d->prefix . ' - ' . ucwords(strtolower(($d->name))) . '</option>';
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="cqz">CQ Zone</label>
|
||||
<select class="custom-select" id="cqz" name="cqz">
|
||||
<option value="All">All</option>
|
||||
<?php
|
||||
for ($i = 1; $i<=40; $i++) {
|
||||
echo '<option value="'. $i . '">'. $i .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label for="selectPropagation">Propagation Mode</label>
|
||||
<select class="custom-select" id="selectPropagation" name="prop_mode">
|
||||
<option value="All">All</option>
|
||||
<option value="AUR">Aurora</option>
|
||||
<option value="AUE">Aurora-E</option>
|
||||
<option value="BS">Back scatter</option>
|
||||
<option value="ECH">EchoLink</option>
|
||||
<option value="EME">Earth-Moon-Earth</option>
|
||||
<option value="ES">Sporadic E</option>
|
||||
<option value="FAI">Field Aligned Irregularities</option>
|
||||
<option value="F2">F2 Reflection</option>
|
||||
<option value="INTERNET">Internet-assisted</option>
|
||||
<option value="ION">Ionoscatter</option>
|
||||
<option value="IRL">IRLP</option>
|
||||
<option value="MS">Meteor scatter</option>
|
||||
<option value="RPT">Terrestrial or atmospheric repeater or transponder</option>
|
||||
<option value="RS">Rain scatter</option>
|
||||
<option value="SAT">Satellite</option>
|
||||
<option value="TEP">Trans-equatorial</option>
|
||||
<option value="TR">Tropospheric ducting</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="datetimepicker1">From date:</label>
|
||||
<div class="dxatlasdatepicker input-group date col-md-12" id="datetimepicker1" data-target-input="nearest">
|
||||
<input name="fromdate" type="text" placeholder="DD/MM/YYYY" class="form-control datetimepicker-input" data-target="#datetimepicker1"/>
|
||||
<div class="input-group-append" data-target="#datetimepicker1" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="datetimepicker2">To date:</label>
|
||||
<div class="dxatlasdatepicker input-group date col-md-12" id="datetimepicker2" data-target-input="nearest">
|
||||
<input name="todate" "totype="text" placeholder="DD/MM/YYYY" class="form-control datetimepicker-input" data-target="#datetimepicker2"/>
|
||||
<div class="input-group-append" data-target="#datetimepicker2" data-toggle="datetimepicker">
|
||||
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<button type="submit" class="btn btn-primary mb-2" value="Export">Export</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -26,15 +26,13 @@
|
|||
<?php if ($this->uri->segment(2) == "satellites") { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Confirmed is Green | Worked but not confirmed is Red
|
||||
[This grid square map is publically viewable for sharing]
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(2) == "band") { ?>
|
||||
<div class="alert alert-success" role="alert">
|
||||
Confirmed is Green | Worked but not confirmed is Red <br>
|
||||
[This map does not include satellite, internet or repeater QSOs] <br>
|
||||
[This grid square map is publically viewable for sharing]
|
||||
[This map does not include satellite, internet or repeater QSOs]
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -154,9 +154,8 @@ $('[data-fancybox]').fancybox({
|
|||
}
|
||||
});
|
||||
|
||||
// Here we capture ALT-L to invoice the Quick lookup
|
||||
// Here we capture ALT-L to invoke the Quick lookup
|
||||
document.onkeyup = function(e) {
|
||||
// ALT-W wipe
|
||||
if (e.altKey && e.which == 76) {
|
||||
spawnLookupModal();
|
||||
}
|
||||
|
@ -2090,6 +2089,25 @@ function deleteQsl(id) {
|
|||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(1) == "dxatlas") { ?>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/tempusdominus-bootstrap-4.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('#datetimepicker1').datetimepicker({
|
||||
format: 'DD/MM/YYYY',
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$('#datetimepicker2').datetimepicker({
|
||||
format: 'DD/MM/YYYY',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->uri->segment(1) == "qslprint") { ?>
|
||||
<script>
|
||||
function deleteFromQslQueue(id) {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light main-nav">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="<?php echo site_url(); ?>">Cloudlog</a>
|
||||
<a class="navbar-brand" href="<?php echo site_url(); ?>">Cloudlog</a> <?php if(ENVIRONMENT == "development") { ?><span class="badge badge-danger">Developer Mode</span><?php } ?>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
|
||||
|
||||
|
@ -189,6 +189,8 @@
|
|||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="<?php echo site_url('user/edit')."/".$this->session->userdata('user_id'); ?>" title="Account"><i class="fas fa-user"></i> Account</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('logbooks');?>" title="Manage station logbooks"><i class="fas fa-home"></i> Station Logbooks</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('station');?>" title="Manage station locations"><i class="fas fa-home"></i> Station Locations</a>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
|
@ -199,6 +201,8 @@
|
|||
|
||||
<a class="dropdown-item" href="<?php echo site_url('kml');?>" title="KML Export for Google Earth"><i class="fas fa-sync"></i> KML Export</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('dxatlas');?>" title="DX Atlas Gridsquare Export"><i class="fas fa-sync"></i> DX Atlas Gridsquare Export</a>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('lotw');?>" title="Synchronise with Logbook of the World (LotW)"><i class="fas fa-sync"></i> Logbook of the World</a>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<div class="container" id="create_station_profile">
|
||||
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?php echo $page_title; ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div id="message" >
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<form method="post" action="<?php echo site_url('logbooks/create'); ?>" name="create_profile">
|
||||
<div class="form-group">
|
||||
<label for="stationLogbookNameInput">Station Logbook Name</label>
|
||||
<input type="text" class="form-control" name="stationLogbook_Name" id="stationLogbookNameInput" aria-describedby="stationLogbookNameHelp" placeholder="Home QTH" required>
|
||||
<small id="stationLogbookNameHelp" class="form-text text-muted">You can call a station logbook anything.</small>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Create Station Logbook</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,64 @@
|
|||
<div class="container" id="create_station_profile">
|
||||
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div id="message" >
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<form method="post" action="<?php echo site_url('logbooks/edit/'); ?><?php echo $station_logbook_details->logbook_id; ?>" name="create_profile">
|
||||
|
||||
<input type="hidden" name="logbook_id" value="<?php echo $station_logbook_details->logbook_id; ?>">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
<div class="card-header"><?php echo $page_title; ?>: <?php echo $station_logbook_details->logbook_name; ?></div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="stationLogbookNameInput">Station Logbook Name</label>
|
||||
<input type="text" class="form-control" name="station_logbook_name" id="stationLogbookNameInput" aria-describedby="stationLogbookNameInputHelp" value="<?php if(set_value('station_logbook_name') != "") { echo set_value('station_logbook_name'); } else { echo $station_logbook_details->logbook_name; } ?>" required>
|
||||
<small id="stationLogbookNameInputHelp" class="form-text text-muted">Shortname for the station location. For example: Home (IO87IP)</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md">
|
||||
<div class="card">
|
||||
<div class="card-header">Station Locations</div>
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<label for="StationLocationsSelect">Select Available Station Locations</label>
|
||||
<select name="SelectedStationLocations[]" class="form-control" id="StationLocationsSelect" multiple aria-describedby="StationLocationSelectHelp">
|
||||
<?php foreach ($station_locations_list->result() as $row) { ?>
|
||||
<option value="<?php echo $row->station_id;?>" <?php if ($station_locations_array != FALSE && in_array($row->station_id, $station_locations_array)) { echo "selected"; } ?>><?php echo $row->station_profile_name;?> (Callsign: <?php echo $row->station_callsign;?> DXCC: <?php echo $row->station_country;?>)</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<small id="StationLocationSelectHelp" class="form-text text-muted">Hold down the Ctrl (windows) or Command (Mac) button to select multiple options.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" class="form-control" name="station_logbook_id" value="<?php echo $station_logbook_details->logbook_id; ?>" required>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Update Station Logbook</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,59 @@
|
|||
<div class="container">
|
||||
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Station Locations
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">Intro to Station Logbooks.</p>
|
||||
|
||||
<p><a href="<?php echo site_url('logbooks/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Station Logbook</a></p>
|
||||
|
||||
<?php if ($my_logbooks->num_rows() > 0) { ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($my_logbooks->result() as $row) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $row->logbook_name;?><br>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php if($this->session->userdata('active_station_logbook') != $row->logbook_id) { ?>
|
||||
<a href="<?php echo site_url('logbooks/set_active')."/".$row->logbook_id; ?>" class="btn btn-outline-primary btn-sm">Set as Active Logbook</a>
|
||||
<?php } ?>
|
||||
|
||||
<a href="<?php echo site_url('logbooks/edit')."/".$row->logbook_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
|
||||
|
||||
<a href="<?php echo site_url('Logbooks/delete')."/".$row->logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile <?php echo $row->logbook_name; ?> this will delete all QSOs within this station logbook?');"><i class="fas fa-trash-alt"></i> Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
<table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
|
@ -75,6 +75,9 @@
|
|||
<span class="badge badge-light"><?php echo $row->qso_total;?> QSOs</span>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($row->user_id == "") { ?>
|
||||
<a href="<?php echo site_url('station/claim_user')."/".$row->station_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-user-plus"></i> Claim Ownership</a>
|
||||
<?php } ?>
|
||||
<a href="<?php echo site_url('station/edit')."/".$row->station_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
@ -242,4 +242,12 @@ color: #ffffff;
|
|||
.was-map-dialog .modal-dialog {
|
||||
max-width: 73% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Timepicker alignment
|
||||
*/
|
||||
.dxatlasdatepicker {
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
|
@ -82,7 +82,7 @@ function distPlot(form) {
|
|||
|
||||
options.series.push(series);
|
||||
|
||||
$('#information').html(tmp.qrb.Qsoes + " contacts were plotted.<br /> Your furthest contact was with " + tmp.qrb.Callsign
|
||||
$('#information').html(tmp.qrb.Qsos + " contacts were plotted.<br /> Your furthest contact was with " + tmp.qrb.Callsign
|
||||
+ " in gridsquare "+ tmp.qrb.Grid
|
||||
+"; the distance was "
|
||||
+tmp.qrb.Distance + tmp.unit +".");
|
||||
|
|
Ładowanie…
Reference in New Issue