Merge branch 'cloudlog8' into mergesolve

pull/1294/head
Andreas Kristiansen 2021-11-13 20:00:48 +01:00 zatwierdzone przez GitHub
commit 7d404c31db
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
285 zmienionych plików z 5216 dodań i 3959 usunięć

Wyświetl plik

@ -19,6 +19,8 @@ $config['directory'] = "logbook";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
$config['datadir'] = null; // default to install directory
/*
|--------------------------------------------------------------------------
| Logbook Options
@ -72,12 +74,9 @@ $config['hamqth_password'] = "";
$config['use_auth'] = true;
$config['auth_table'] = "users";
$config['auth_mode'] = "0";
$config['auth_mode'] = "3";
$config['auth_level'][0] = "Anonymous";
$config['auth_level'][1] = "Viewer";
$config['auth_level'][2] = "Editor";
$config['auth_level'][3] = "API User";
$config['auth_level'][3] = "Operator";
$config['auth_level'][99] = "Administrator";
/*

Wyświetl plik

@ -21,7 +21,8 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 71;
$config['migration_version'] = 79;
/*
|--------------------------------------------------------------------------

Wyświetl plik

@ -16,9 +16,9 @@ class Accumulated extends CI_Controller {
// Render Page
$data['page_title'] = "Accumulated Statistics";
$this->load->model('Accumulate_model');
$this->load->model('bands');
$data['worked_bands'] = $this->Accumulate_model->get_worked_bands();
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$this->load->model('modes');

Wyświetl plik

@ -7,7 +7,6 @@ class API extends CI_Controller {
{
}
/*
TODOs
- Search Callsign (Return Json)
@ -476,8 +475,10 @@ class API extends CI_Controller {
die();
}
$user_id = $this->api_model->key_userid($obj['key']);
// Store Result to Database
$this->cat->update($obj);
$this->cat->update($obj, $user_id);
// Return Message

Wyświetl plik

@ -27,10 +27,12 @@ class Awards extends CI_Controller {
public function dok ()
{
//echo "Needs Developed";
$this->load->model('dok');
$this->load->model('bands');
$data['doks'] = $this->dok->show_stats();
$data['worked_bands'] = $this->dok->get_worked_bands();
$data['worked_bands'] = $this->bands->get_worked_bands_dok(); // Used in the view for band select
// Render Page
$data['page_title'] = "Awards - DOK";
@ -76,8 +78,9 @@ class Awards extends CI_Controller {
public function dxcc () {
$this->load->model('dxcc');
$this->load->model('modes');
$this->load->model('bands');
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
@ -142,7 +145,8 @@ class Awards extends CI_Controller {
public function vucc() {
$this->load->model('vucc');
$data['worked_bands'] = $this->vucc->get_worked_bands();
$this->load->model('bands');
$data['worked_bands'] = $this->bands->get_worked_bands();
$data['vucc_array'] = $this->vucc->get_vucc_array($data);
@ -226,15 +230,18 @@ 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');
$this->load->model('bands');
$data['worked_bands'] = $this->cq->get_worked_bands($station_id);
$data['worked_bands'] = $this->bands->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 +277,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";
@ -283,8 +290,9 @@ class Awards extends CI_Controller {
public function was() {
$this->load->model('was');
$this->load->model('modes');
$this->load->model('bands');
$data['worked_bands'] = $this->was->get_worked_bands();
$data['worked_bands'] = $this->bands->get_worked_bands();
$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.
@ -333,8 +341,9 @@ class Awards extends CI_Controller {
public function iota () {
$this->load->model('iota');
$this->load->model('modes');
$this->load->model('bands');
$data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
@ -475,7 +484,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);

Wyświetl plik

@ -4,13 +4,24 @@ class Dashboard extends CI_Controller {
public function index()
{
// Check our version and run any migrations
$this->load->library('Migration');
$this->migration->current();
// Database connections
$this->load->model('logbook_model');
$this->load->model('user_model');
// Check if users logged in
if($this->user_model->validate_session() == 0) {
// user is not logged in
redirect('user/login');
}
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
if($this->user_model->validate_session()) {
$this->user_model->clear_session();

Wyświetl plik

@ -16,9 +16,9 @@ class Distances extends CI_Controller {
// Render Page
$data['page_title'] = "Distances Worked";
$this->load->model('Distances_model');
$data['bands_available'] = $this->Distances_model->get_worked_bands();
$data['sats_available'] = $this->Distances_model->get_worked_sats();
$this->load->model('bands');
$data['bands_available'] = $this->bands->get_worked_bands_distances();
$data['sats_available'] = $this->bands->get_worked_sats();
$this->load->view('interface_assets/header', $data);
$this->load->view('distances/index');

Wyświetl plik

@ -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('logbook_model');
$this->load->model('stations');
$this->load->model('bands');
$data['station_profile'] = $this->stations->all(); // Used in the view for station location select
$data['worked_bands'] = $this->bands->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);
}
}

Wyświetl plik

@ -12,12 +12,12 @@ class Kml extends CI_Controller {
public function index() {
$this->load->model('user_model');
$this->load->model('modes');
$this->load->model('dxcc');
$this->load->model('logbook_model');
$this->load->model('bands');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$data['worked_bands'] = $this->bands->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

Wyświetl plik

@ -17,19 +17,19 @@ class Logbook extends CI_Controller {
function index()
{
$this->load->model('user_model');
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
if($this->user_model->validate_session()) {
$this->user_model->clear_session();
show_error('Access denied<p>Click <a href="'.site_url('user/login').'">here</a> to log in as another user', 403);
} else {
redirect('user/login');
}
}
// Check if users logged in
$this->load->model('user_model');
if($this->user_model->validate_session() == 0) {
// user is not logged in
redirect('user/login');
}
$this->load->model('logbook_model');
$this->load->library('pagination');
$config['base_url'] = base_url().'index.php/logbook/index/';
$config['total_rows'] = $this->db->count_all($this->config->item('table_name'));
$config['total_rows'] = $this->logbook_model->total_qsos();
$config['per_page'] = '25';
$config['num_links'] = 6;
$config['full_tag_open'] = '';
@ -40,7 +40,6 @@ class Logbook extends CI_Controller {
$this->pagination->initialize($config);
//load the model and get results
$this->load->model('logbook_model');
$data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3));
// Calculate Lat/Lng from Locator to use on Maps
@ -196,9 +195,8 @@ class Logbook extends CI_Controller {
return false;
$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'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
@ -208,7 +206,7 @@ class Logbook extends CI_Controller {
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where('station_id', $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc");
$this->db->limit(1);
@ -237,8 +235,8 @@ class Logbook extends CI_Controller {
];
$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'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
@ -249,7 +247,7 @@ class Logbook extends CI_Controller {
}
$this->db->where('station_id', $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
@ -271,8 +269,8 @@ class Logbook extends CI_Controller {
];
$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'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
@ -283,7 +281,7 @@ class Logbook extends CI_Controller {
}
$this->db->where('station_id', $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY', urldecode($country));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
@ -308,8 +306,8 @@ class Logbook extends CI_Controller {
];
$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'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
@ -320,7 +318,7 @@ class Logbook extends CI_Controller {
}
$this->db->where('station_id', $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_CALL', strtoupper($callsign));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
@ -704,5 +702,4 @@ class Logbook extends CI_Controller {
return $this->db->get();
}
}

Wyświetl plik

@ -0,0 +1,119 @@
<?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_of_user();
$data['station_locations_linked'] = $this->logbooks_model->list_logbooks_linked($station_logbook_id);
$data['page_title'] = "Edit Station Logbook";
$this->form_validation->set_rules('station_logbook_id', '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
{
$data['notice'] = "Station Logbooks ".$this->security->xss_clean($this->input->post('station_logbook_name', true))." Updated";
if($this->input->post('SelectedStationLocation') != "") {
if($this->logbooks_model->relationship_exists($this->input->post('station_logbook_id'), $this->input->post('SelectedStationLocation')) != TRUE) {
// If no link exisits create
$this->logbooks_model->create_logbook_location_link($this->input->post('station_logbook_id'), $this->input->post('SelectedStationLocation'));
}
} else {
$this->logbooks_model->edit();
}
redirect('logbooks/edit/'.$this->input->post('station_logbook_id'));
}
}
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');
}
public function delete_relationship($logbook_id, $station_id) {
$this->load->model('logbooks_model');
$this->logbooks_model->delete_relationship($logbook_id, $station_id);
redirect('logbooks/edit/'.$logbook_id);
}
}

Wyświetl plik

@ -28,12 +28,15 @@ 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');
$this->load->model('bands');
$data['bands'] = $this->lookup_model->get_Worked_Bands($station_id);
$data['bands'] = $this->bands->get_worked_bands();
$data['type'] = xss_clean($this->input->post('type'));
$data['dxcc'] = xss_clean($this->input->post('dxcc'));
@ -43,7 +46,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);

Wyświetl plik

@ -466,6 +466,7 @@ class Lotw extends CI_Controller {
$tableheaders .= "<td>LoTW QSL Received</td>";
$tableheaders .= "<td>Date LoTW Confirmed</td>";
$tableheaders .= "<td>State</td>";
$tableheaders .= "<td>Gridsquare</td>";
$tableheaders .= "<td>Log Status</td>";
$tableheaders .= "<td>LoTW Status</td>";
$tableheaders .= "</tr>";
@ -512,8 +513,15 @@ class Lotw extends CI_Controller {
} else {
$state = "";
}
// Present only if the QSLing station specified a single valid grid square value in its station location uploaded to LoTW.
if (isset($record['gridsquare'])) {
$qsl_gridsquare = $record['gridsquare'];
} else {
$qsl_gridsquare = "";
}
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state);
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare);
}
@ -525,6 +533,7 @@ class Lotw extends CI_Controller {
$table .= "<td>".$record['qsl_rcvd']."</td>";
$table .= "<td>".$qsl_date."</td>";
$table .= "<td>".$state."</td>";
$table .= "<td>".$qsl_gridsquare."</td>";
$table .= "<td>QSO Record: ".$status."</td>";
$table .= "<td>LoTW Record: ".$lotw_status."</td>";
$table .= "</tr>";

Wyświetl plik

@ -13,7 +13,7 @@ class Map extends CI_Controller {
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
$data['qra_lng'] = $qra_position[1];
} else {
$data['qra'] = "none";
}
@ -34,14 +34,14 @@ class Map extends CI_Controller {
function custom()
{
$this->load->model('dxcc');
$this->load->model('modes');
$this->load->model('bands');
//$this->load->model('modes');
$data['worked_bands'] = $this->dxcc->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
//$data['modes'] = $this->modes->active(); // Used in the view for mode select
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
$bands = $data['worked_bands'];
}
else {
@ -61,20 +61,20 @@ class Map extends CI_Controller {
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
$data['qra'] = "set";
$data['qra_lat'] = $qra_position[0];
$data['qra_lng'] = $qra_position[1];
$data['qra_lng'] = $qra_position[1];
} else {
$data['qra'] = "none";
}
$this->load->model('Stations');
$station_id = $this->Stations->find_active();
$station_data = $this->Stations->profile_clean($station_id);
$CI =& get_instance();
$CI->load->model('logbooks_model');
$result = $CI->logbooks_model->logbook($this->session->userdata('active_station_logbook'))->result();
$logbook_name = $result[0]->logbook_name;
// load the view
$data['station_profile'] = $station_data;
$data['logbook_name'] = $logbook_name;
$data['page_title'] = "Map QSOs";
if ($this->input->post('from')) {
$from = $this->input->post('from');
$from = DateTime::createFromFormat('m/d/Y g:i A', $from);
@ -93,7 +93,6 @@ class Map extends CI_Controller {
$footer_data['date_to'] = $temp_to->format('Y-m-d H:i:00');
}
$this->load->view('interface_assets/header', $data);
$this->load->view('map/custom_date');
$this->load->view('interface_assets/footer',$footer_data);
@ -105,7 +104,7 @@ class Map extends CI_Controller {
$end_date = $this->uri->segment(4);
$band = $this->uri->segment(5);
$this->load->model('logbook_model');
$this->load->library('qra');
$qsos = $this->logbook_model->map_custom_qsos(rawurldecode($start_date), rawurldecode($end_date), $band);
@ -120,7 +119,7 @@ class Map extends CI_Controller {
echo ",";
}
if($row->COL_SAT_NAME != null) {
if($row->COL_SAT_NAME != null) {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
} else {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
@ -134,7 +133,7 @@ class Map extends CI_Controller {
FROM dxcc_entities
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
LIMIT 1
');
foreach ($query->result() as $dxcc) {
@ -154,12 +153,12 @@ class Map extends CI_Controller {
function map_data() {
$this->load->model('logbook_model');
$this->load->library('qra');
//echo date('Y-m-d')
$raw = strtotime('Monday last week');
$mon = date('Y-m-d', $raw);
$sun = date('Y-m-d', strtotime('Monday next week'));
@ -175,7 +174,7 @@ class Map extends CI_Controller {
echo ",";
}
if($row->COL_SAT_NAME != null) {
if($row->COL_SAT_NAME != null) {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
} else {
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"}";
@ -189,7 +188,7 @@ class Map extends CI_Controller {
FROM dxcc_entities
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
LIMIT 1
');
foreach ($query->result() as $dxcc) {
@ -206,4 +205,4 @@ class Map extends CI_Controller {
echo "}";
}
}
}

Wyświetl plik

@ -14,8 +14,8 @@ class Options extends CI_Controller {
$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'); }
}
// Default /options view just gives some text to explain the options area
function index() {
@ -23,14 +23,14 @@ class Options extends CI_Controller {
//echo $this->config->item('option_theme');
//echo $this->optionslib->get_option('theme');
$data['page_title'] = "Cloudlog Options";
$this->load->view('interface_assets/header', $data);
$this->load->view('options/index');
$this->load->view('interface_assets/footer');
}
// function used to display the /appearance url
function appearance() {
@ -41,6 +41,10 @@ class Options extends CI_Controller {
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Appearance";
$this->load->model('Themes_model');
$data['themes'] = $this->Themes_model->getThemes();
$this->load->view('interface_assets/header', $data);
$this->load->view('options/appearance');
$this->load->view('interface_assets/footer');
@ -101,10 +105,10 @@ class Options extends CI_Controller {
// function used to display the /radio url
function radio() {
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Radio Settings";
$this->load->view('interface_assets/header', $data);
$this->load->view('options/radios');
$this->load->view('interface_assets/footer');

Wyświetl plik

@ -30,7 +30,7 @@ class QSO extends CI_Controller {
$data['active_station_profile'] = $this->stations->find_active();
$data['notice'] = false;
$data['stations'] = $this->stations->all();
$data['stations'] = $this->stations->all_of_user();
$data['radios'] = $this->cat->radios();
$data['query'] = $this->logbook_model->last_custom('5');
$data['dxcc'] = $this->logbook_model->fetchDxcc();

Wyświetl plik

@ -7,21 +7,21 @@
// Check Auth
$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'); }
// load the view
$data['page_title'] = "Radio Interface";
$data['page_title'] = "Hardware Interfaces";
$this->load->view('interface_assets/header', $data);
$this->load->view('radio/index');
$this->load->view('interface_assets/footer');
}
function status() {
// Check Auth
$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('cat');
$query = $this->cat->status();
if ($query->num_rows() > 0)
@ -58,14 +58,14 @@
echo "<td colspan=\"4\">No CAT Interfaced radios found.</td>";
echo "</tr>";
}
}
function json($id)
{
header('Content-Type: application/json');
$this->load->model('cat');
$query = $this->cat->radio_status($id);
@ -97,8 +97,8 @@
}
// Get Satellite Mode
$uplink_mode = $this->get_mode_designator($row->uplink_freq);
$downlink_mode = $this->get_mode_designator($row->downlink_freq);
$uplink_mode = $this->get_mode_designator($row->uplink_freq);
$downlink_mode = $this->get_mode_designator($row->downlink_freq);
if ($uplink_mode != "" && $downlink_mode != "") {
$sat_mode = $uplink_mode."/".$downlink_mode;
@ -119,7 +119,7 @@
$sat_mode = "";
}
// Calculate how old the data is in minutes
// Calculate how old the data is in minutes
$datetime1 = new DateTime(); // Today's Date/Time
$datetime2 = new DateTime($row->newtime);
$interval = $datetime1->diff($datetime2);
@ -127,7 +127,7 @@
$minutes = $interval->days * 24 * 60;
$minutes += $interval->h * 60;
$minutes += $interval->i;
$updated_at = $minutes;
// Return Json data
@ -143,7 +143,7 @@
}
}
function get_mode_designator($frequency)
{
if ($frequency > 21000000 && $frequency < 22000000)
@ -176,13 +176,13 @@
// Check Auth
$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('cat');
$this->cat->delete($id);
$this->session->set_flashdata('message', 'Radio Profile Deleted');
redirect('radio');
}

Wyświetl plik

@ -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');

Wyświetl plik

@ -0,0 +1,89 @@
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
This controller will contain features for contesting
*/
class Themes extends CI_Controller {
function __construct()
{
parent::__construct();
$this->lang->load('contesting');
$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'); }
}
public function index()
{
$this->load->model('Themes_model');
$data['themes'] = $this->Themes_model->getThemes();
// Render Page
$data['page_title'] = "Themes";
$this->load->view('interface_assets/header', $data);
$this->load->view('themes/index.php');
$this->load->view('interface_assets/footer');
}
public function add()
{
$this->load->model('Themes_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Theme Name', 'required');
$this->form_validation->set_rules('foldername', 'Folder Name', 'required');
if ($this->form_validation->run() == FALSE)
{
$data['page_title'] = "Create Theme";
$this->load->view('themes/add', $data);
}
else
{
$this->Themes_model->add();
}
}
public function edit($id)
{
$this->load->library('form_validation');
$this->load->model('Themes_model');
$item_id_clean = $this->security->xss_clean($id);
$data['theme'] = $this->Themes_model->theme($item_id_clean);
$data['page_title'] = "Edit Theme";
$this->form_validation->set_rules('name', 'Theme Name', 'required');
$this->form_validation->set_rules('foldername', 'Folder Name', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('interface_assets/header', $data);
$this->load->view('themes/edit');
$this->load->view('interface_assets/footer');
}
else
{
$this->Themes_model->edit($item_id_clean);
$data['notice'] = "Theme ".$this->security->xss_clean($this->input->post('name', true))." Updated";
redirect('themes');
}
}
public function delete() {
$id = $this->input->post('id');
$this->load->model('Themes_model');
$this->Themes_model->delete($id);
}
}

Wyświetl plik

@ -40,11 +40,12 @@ class Timeline extends CI_Controller {
}
$this->load->model('modes');
$this->load->model('bands');
$data['modes'] = $this->modes->active();
$data['timeline_array'] = $this->Timeline_model->get_timeline($band, $mode, $award);
$data['worked_bands'] = $this->Timeline_model->get_worked_bands();
$data['worked_bands'] = $this->bands->get_worked_bands();
$data['bandselect'] = $band;
$data['modeselect'] = $mode;

Wyświetl plik

@ -16,9 +16,9 @@ class Timeplotter extends CI_Controller {
// Render Page
$data['page_title'] = "Timeplotter";
$this->load->model('Timeplotter_model');
$this->load->model('bands');
$data['worked_bands'] = $this->Timeplotter_model->get_worked_bands();
$data['worked_bands'] = $this->bands->get_worked_bands();
$this->load->model('dxcc');
$data['dxcc_list'] = $this->dxcc->list();

Wyświetl plik

@ -17,6 +17,19 @@ class Update extends CI_Controller {
}
/*
* Create a path to a file in the updates folder, respecting the datadir
* configuration option.
*/
private function make_update_path($path) {
$path = "updates/" . $path;
$datadir = $this->config->item('datadir');
if(!$datadir) {
return $path;
}
return $datadir . "/" . $path;
}
/*
* Load the dxcc entities
*/
@ -25,7 +38,7 @@ class Update extends CI_Controller {
$this->load->model('dxcc_entities');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
//$xml_data->entities->entity->count();
@ -74,7 +87,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_exceptions');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->exceptions->exception as $record) {
@ -114,7 +127,7 @@ class Update extends CI_Controller {
// Load Database connectors
$this->load->model('dxcc_prefixes');
// Load the cty file
$xml_data = simplexml_load_file("updates/cty.xml");
$xml_data = simplexml_load_file($this->make_update_path("cty.xml"));
$count = 0;
foreach ($xml_data->prefixes->prefix as $record) {
@ -169,8 +182,8 @@ class Update extends CI_Controller {
$data .= gzgetc($gz);
}
gzclose($gz);
file_put_contents('./updates/cty.xml', $data);
file_put_contents($this->make_update_path("cty.xml"), $data);
// Clear the tables, ready for new data
$this->db->empty_table("dxcc_entities");
@ -203,7 +216,7 @@ class Update extends CI_Controller {
$html = $done."....<br/>";
}
file_put_contents('./updates/status.html', $html);
file_put_contents($this->make_update_path("status.html"), $html);
}
@ -231,7 +244,7 @@ class Update extends CI_Controller {
}
public function update_clublog_scp() {
$strFile = "./updates/clublog_scp.txt";
$strFile = $this->make_update_path("clublog_scp.txt");
$url = "https://cdn.clublog.org/clublog.scp.gz";
set_time_limit(300);
$this->update_status("Downloading Club Log SCP file");

Wyświetl plik

@ -42,6 +42,9 @@ class User extends CI_Controller {
$this->form_validation->set_rules('user_locator', 'Locator', 'required');
$this->form_validation->set_rules('user_timezone', 'Timezone', 'required');
// Get themes list
$data['themes'] = $this->user_model->getThemes();
// Get timezones
$data['timezones'] = $this->user_model->timezones();
@ -158,6 +161,9 @@ class User extends CI_Controller {
$this->form_validation->set_rules('user_locator', 'Locator', 'required|xss_clean');
$this->form_validation->set_rules('user_timezone', 'Timezone', 'required');
// Get themes list
$data['themes'] = $this->user_model->getThemes();
// Get timezones
$data['timezones'] = $this->user_model->timezones();
@ -453,7 +459,7 @@ class User extends CI_Controller {
if ($this->form_validation->run() == FALSE)
{
$data['page_title'] = "Login";
$this->load->view('interface_assets/header', $data);
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('user/login');
$this->load->view('interface_assets/footer');

Wyświetl plik

@ -9,6 +9,6 @@ class Migration_add_queries_table extends CI_Migration
public function down()
{
$this->db->query("");
}
}

Wyświetl plik

@ -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');
}
}

Wyświetl plik

@ -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');
}
}

Wyświetl plik

@ -0,0 +1,22 @@
<?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',
);
if (!$this->db->field_exists('user_id', 'station_profile')) {
$this->dbforge->add_column('station_profile', $fields);
}
}
public function down()
{
$this->dbforge->drop_column('station_profile', 'user_id');
}
}

Wyświetl plik

@ -0,0 +1,27 @@
<?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)',
);
if (!$this->db->field_exists('active_station_logbook', 'users')) {
$this->dbforge->add_column('users', $fields);
}
}
public function down()
{
$this->dbforge->drop_column('users', 'active_station_logbook');
}
}

Wyświetl plik

@ -0,0 +1,22 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_Theme_table extends CI_Migration {
public function up()
{
// create themes table
if (!$this->db->table_exists('themes')) {
$this->db->query("create table themes (id integer not null auto_increment, name varchar(256) not null, foldername varchar(256) not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;");
$this->db->query("INSERT INTO themes (name, foldername) values ('Blue','blue');");
$this->db->query("INSERT INTO themes (name, foldername) values ('Cosmo','cosmo');");
$this->db->query("INSERT INTO themes (name, foldername) values ('Cyborg (Dark)','cyborg');");
$this->db->query("INSERT INTO themes (name, foldername) values ('Darkly (Dark)','darkly');");
$this->db->query("INSERT INTO themes (name, foldername) values ('Default','default');");
$this->db->query("INSERT INTO themes (name, foldername) values ('Superhero (Dark)','superhero');");
}
}
public function down(){
}
}

Wyświetl plik

@ -0,0 +1,21 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_userid_to_notes extends CI_Migration
{
public function up()
{
$fields = array(
'user_id BIGINT(20) DEFAULT NULL',
);
if (!$this->db->field_exists('user_id', 'notes')) {
$this->dbforge->add_column('notes', $fields);
}
}
public function down()
{
$this->dbforge->drop_column('notes', 'user_id');
}
}

Wyświetl plik

@ -0,0 +1,22 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Migration_add_userid_to_hardware extends CI_Migration {
public function up()
{
$fields = array(
'user_id BIGINT(20) DEFAULT NULL',
);
if (!$this->db->field_exists('user_id', 'cat')) {
$this->dbforge->add_column('cat', $fields);
}
}
public function down()
{
$this->dbforge->drop_column('cat', 'user_id');
}
}

Wyświetl plik

@ -0,0 +1,21 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Migration_add_userid_to_api extends CI_Migration
{
public function up()
{
$fields = array(
'user_id BIGINT(20) DEFAULT NULL',
);
if (!$this->db->field_exists('user_id', 'api')) {
$this->dbforge->add_column('api', $fields);
}
}
public function down()
{
$this->dbforge->drop_column('api', 'user_id');
}
}

Wyświetl plik

@ -3,39 +3,35 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Accumulate_model extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
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 +44,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 +60,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 +79,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 +103,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 +122,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 +142,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 +166,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 +182,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 +199,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 +223,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 +239,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')";
}
@ -257,58 +255,4 @@ class Accumulate_model extends CI_Model
return $query->result();
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
}

Wyświetl plik

@ -2,12 +2,6 @@
class adif_data extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function export_all() {
$this->load->model('stations');
$active_station_id = $this->stations->find_active();
@ -128,12 +122,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");

Wyświetl plik

@ -8,37 +8,39 @@
class API_Model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
// GET API Keys
function keys() {
$this->db->where('user_id', $this->session->userdata('user_id'));
return $this->db->get('api');
}
function key_description($key) {
$this->db->where('key', $key);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('key', $key);
$query = $this->db->get('api');
return $query->result_array()[0];
}
function key_userid($key) {
$this->db->where('key', $key);
$query = $this->db->get('api');
return $query->result_array()[0]['user_id'];
}
function update_key_description($key, $description) {
$data = array(
'description' => xss_clean($description),
);
$this->db->where('key', xss_clean($key));
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->update('api', xss_clean($data));
}
function country_worked($dxcc_num, $band, $mode){
if($band == "all") {
@ -93,35 +95,38 @@ class API_Model extends CI_Model {
function delete_key($key) {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('key', xss_clean($key));
$this->db->delete('api');
}
// Generate API Key
function generate_key($rights) {
// Expects either rw (Read, Write) or r (read only)
// Generate Unique Key
$data['key'] = uniqid("cl");
$data['rights'] = $rights;
// Set API key to active
$data['status'] = "active";
$this->db->insert('api', $data);
$data['user_id'] = $this->session->userdata('user_id');
$this->db->insert('api', $data);
}
function access($key) {
// No key = no access, mate
if(!$key) {
return $status = "No Key Found";
}
// Check that the key is valid
$this->db->where('key', $key);
$this->db->where('key', $key);
$query = $this->db->get('api');
if ($query->num_rows() > 0)
@ -334,7 +339,7 @@ class API_Model extends CI_Model {
$s[12] = '/~([a-zA-Z0-9\-\_\*\(\)\=\~]+)/';
// *, which becomes '%'
$s[13] = '/\*/';
$r[0] = ' AND ';
$r[1] = ' OR ';
$r[2] = ' < ';

Wyświetl plik

@ -0,0 +1,145 @@
<?php
class Bands extends CI_Model {
public $bandslots = array(
"160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0,
"SAT"=>0,
);
function __construct() {
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
$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 in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\""
);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
$SAT_data = $this->db->query(
"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){
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
function get_worked_bands_distances() {
$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 in (" . $location_list . ")";
$data = $this->db->query($sql);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
function get_worked_sats() {
$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 in (" . $location_list . ") and coalesce(col_sat_name, '') <> '' ORDER BY col_sat_name";
$data = $this->db->query($sql);
$worked_sats = array();
foreach($data->result() as $row){
array_push($worked_sats, $row->col_sat_name);
}
return $worked_sats;
}
function get_worked_bands_dok() {
$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 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){
array_push($worked_slots, $row->COL_BAND);
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
}
?>

Wyświetl plik

@ -2,17 +2,12 @@
class Cat extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function update($result, $user_id) {
function update($result) {
$this->db->where('radio', $result['radio']);
$this->db->where('radio', $result['radio']);
$this->db->where('user_id', $user_id);
$query = $this->db->get('cat');
if ($query->num_rows() > 0)
{
if($result['radio'] == "SatPC32") {
@ -20,7 +15,7 @@
foreach ($query->result() as $row)
{
$radio_id = $row->id;
$data = array(
'sat_name' => $result['sat_name'],
'downlink_freq' => $result['downlink_freq'],
@ -30,14 +25,15 @@
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
$this->db->where('user_id', $user_id);
$this->db->update('cat', $data);
}
} else {
// Update the record
foreach ($query->result() as $row)
{
$radio_id = $row->id;
$data = array(
'frequency' => $result['frequency'],
'mode' => $result['mode'],
@ -45,12 +41,13 @@
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->update('cat', $data);
}
}
} else {
// Add a new record
if($result['radio'] == "SatPC32") {
$data = array(
'radio' => $result['radio'],
@ -61,6 +58,7 @@
'uplink_freq' => $result['uplink_freq'],
'downlink_mode' => $result['downlink_mode'],
'uplink_mode' => $result['uplink_mode'],
'user_id' => $user_id,
);
} else {
$data = array(
@ -68,23 +66,25 @@
'frequency' => $result['frequency'],
'mode' => $result['mode'],
'timestamp' => $result['timestamp'],
'user_id' => $user_id,
);
}
$this->db->insert('cat', $data);
$this->db->insert('cat', $data);
}
}
function status() {
//$this->db->where('radio', $result['radio']);
//$this->db->where('radio', $result['radio']);
$this->db->where('user_id', $this->session->userdata('user_id'));
$query = $this->db->get('cat');
return $query;
}
function recent_status() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where("timestamp > date_sub(now(), interval 15 minute)", NULL, FALSE);
$query = $this->db->get('cat');
@ -94,27 +94,23 @@
/* Return list of radios */
function radios() {
$this->db->select('id, radio');
$this->db->where('user_id', $this->session->userdata('user_id'));
$query = $this->db->get('cat');
return $query;
}
function radio_status($id) {
return $this->db->query('SELECT *, CONVERT_TZ(`timestamp`, @@session.time_zone, \'+00:00\' ) as newtime FROM `cat` WHERE id = '.$id.' ');
$sql = 'SELECT *, CONVERT_TZ(`timestamp`, @@session.time_zone, \'+00:00\' ) as newtime FROM `cat` WHERE id = ' . $id . ' and user_id =' . $this->session->userdata('user_id');
return $this->db->query($sql);
}
function delete($id) {
$this->db->where('id', $id);
$this->db->delete('cat');
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->delete('cat');
return true;
}
}
?>

Wyświetl plik

@ -2,11 +2,6 @@
class Clublog_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_clublog_auth_info($username) {
$this->db->select('user_name, user_clublog_name, user_clublog_password');
$this->db->where('user_name', $username);

Wyświetl plik

@ -1,11 +1,5 @@
<?php
class Contesting_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
/*
* This function gets the QSOs to fill the "Contest Logbook" under the contesting form.

Wyświetl plik

@ -3,11 +3,6 @@
class Counties extends CI_Model
{
function __construct() {
// Call the Model constructor
parent::__construct();
}
/*
* Fetches worked and confirmed counties
*/
@ -28,14 +23,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 +42,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 +53,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 +71,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'";

Wyświetl plik

@ -2,11 +2,6 @@
class CQ extends CI_Model{
function __construct(){
// Call the Model constructor
parent::__construct();
}
function get_zones(){
$CI =& get_instance();
$CI->load->model('Stations');
@ -22,59 +17,7 @@ class CQ extends CI_Model{
return $data->result();
}
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
function get_worked_bands($station_id)
{
// 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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
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 +30,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 +47,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 +55,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 +80,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 +91,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 +113,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 +162,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 +179,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 +198,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 . "'";

Wyświetl plik

@ -3,21 +3,17 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Dayswithqso_model extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
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 +146,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();
}
}
}

Wyświetl plik

@ -3,101 +3,96 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Distances_model extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
public $bandslots = array("160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0);
function get_worked_sats() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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";
$data = $this->db->query($sql);
$worked_sats = array();
foreach($data->result() as $row){
array_push($worked_sats, $row->col_sat_name);
}
return $worked_sats;
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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;
$data = $this->db->query($sql);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
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 +133,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 +151,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 +160,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 +214,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 +228,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 +239,4 @@ class Distances_model extends CI_Model
return round(6371*$ca);
}
}
}
}

Wyświetl plik

@ -2,66 +2,18 @@
class DOK extends CI_Model {
public $bandslots = array("160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0);
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
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'));
// 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 "
);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
$this->load->model('bands');
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
function show_stats(){
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$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"
);
@ -70,20 +22,20 @@ class DOK extends CI_Model {
foreach($data->result() as $row){
if ($last_dok != $row->COL_DARC_DOK){
// new row
$results[$row->COL_DARC_DOK] = $this->bandslots;
$results[$row->COL_DARC_DOK] = $this->bands->bandslots;
$last_dok = $row->COL_DARC_DOK;
}
// 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;
}

Wyświetl plik

@ -0,0 +1,166 @@
<?php
class Dxatlas_model extends CI_Model
{
/*
* 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();
}
}
?>

Wyświetl plik

@ -2,133 +2,6 @@
class DXCC extends CI_Model {
public $bandslots = array("160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0,
"SAT"=>0,
);
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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\""
);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach($SAT_data->result() as $row){
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
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 +42,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 +60,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 +76,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 +85,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 +94,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 +104,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 +120,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 +155,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 +190,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 +232,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 +254,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 +289,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 +384,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 +405,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 +425,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 . "'";

Wyświetl plik

@ -17,11 +17,6 @@ CREATE TABLE IF NOT EXISTS `dxcc_entities` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
*/
function __construct(){
parent::__construct();
}
function empty_table($table){
$this->db->empty_table($table);
}

Wyświetl plik

@ -18,14 +18,7 @@ CREATE TABLE IF NOT EXISTS `dxcc_exceptions` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
*/
function __construct(){
parent::__construct();
}
function empty_table($table){
$this->db->empty_table($table);
}
}

Wyświetl plik

@ -16,14 +16,7 @@ CREATE TABLE IF NOT EXISTS `dxcc_prefixes` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
*/
function __construct(){
parent::__construct();
}
function empty_table($table){
$this->db->empty_table($table);
}
}
}

Wyświetl plik

@ -2,11 +2,6 @@
class Eqsl_images extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_image($qso_id) {
$this->db->where('qso_id', $qso_id);
$query = $this->db->get('eQSL_images');

Wyświetl plik

@ -2,11 +2,6 @@
class Eqslmethods_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function mark_all_as_sent() {
$data = array(
'COL_EQSL_QSL_SENT' => 'Y',

Wyświetl plik

@ -2,46 +2,55 @@
class Gridsquares_model extends CI_Model {
function __construct()
{
// 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('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 substring(COL_GRIDSQUARE,1,6) as SAT_SQUARE, COL_SAT_NAME FROM '
. $this->config->item('table_name')
. ' WHERE station_id in (' . $location_list . ') AND COL_GRIDSQUARE != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query($sql);
}
function get_confirmed_sat_squares() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
function get_confirmed_sat_vucc_squares() {
$CI =& get_instance();
$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")');
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";
function get_confirmed_sat_vucc_squares() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$sql = 'SELECT COL_VUCC_GRIDS, COL_SAT_NAME FROM '
. $this->config->item('table_name')
. ' WHERE station_id in (' . $location_list . ') AND COL_VUCC_GRIDS != "" AND COL_SAT_NAME != "" AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y") AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query('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")');
}
return $this->db->query($sql);
}
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 +58,62 @@ 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
.'"
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=', "SAT");
$this->db->where('COL_PROP_MODE !=', "INTERNET");
$this->db->where('COL_PROP_MODE !=', "ECH");
$this->db->where('COL_PROP_MODE !=', "RPT");
$this->db->where('COL_SAT_NAME =', "");
}
return $this->db->get($this->config->item('table_name'));
}
function get_band_confirmed($band) {
$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 substring(COL_GRIDSQUARE,1,6) as GRID_SQUARES, COL_BAND FROM '
.$this->config->item('table_name')
.' WHERE station_id in ('
.$location_list.') AND COL_GRIDSQUARE != ""';
if ($band != 'All') {
$sql .= ' AND COL_BAND = "' . $band
.'"
AND COL_PROP_MODE != "SAT"
AND COL_PROP_MODE != "INTERNET"
AND COL_PROP_MODE != "ECH"
AND COL_PROP_MODE != "RPT"
AND COL_SAT_NAME = ""';
}
}
return $this->db->query($sql);
}
$sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
function get_band_confirmed($band) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$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 = ""';
}
$sql .= ' AND (COL_LOTW_QSL_RCVD = "Y" OR COL_QSL_RCVD = "Y")';
return $this->db->query($sql);
}
return $this->db->query($sql);
}
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 +134,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"';

Wyświetl plik

@ -2,71 +2,12 @@
class IOTA extends CI_Model {
public $bandslots = array("160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0,
"SAT"=>0,
);
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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\""
);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach($SAT_data->result() as $row){
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
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 +20,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 +28,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 +37,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 +47,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 +63,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 +93,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 +123,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 +132,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 +156,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 +205,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 +275,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 +297,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 +317,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 . "'";

Wyświetl plik

@ -2,12 +2,6 @@
class Logbook_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
/* Add QSO to Logbook */
function create_qso() {
// Join date+time
@ -236,8 +230,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':
@ -268,7 +262,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") {
@ -287,11 +281,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. "%')";
@ -308,9 +305,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') {
@ -325,7 +322,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;
@ -462,8 +459,16 @@ class Logbook_model extends CI_Model {
/* Edit QSO */
function edit() {
$entity = $this->get_entity($this->input->post('dxcc_id'));
$stationId = $this->input->post('station_profile');
$country = $entity['name'];
// be sure that station belongs to user
$CI =& get_instance();
$CI->load->model('Stations');
if (!$CI->Stations->check_station_is_accessible($stationId)) {
return;
}
$mode = $this->get_main_mode_if_submode($this->input->post('mode'));
if ($mode == null) {
$mode = $this->input->post('mode');
@ -538,11 +543,11 @@ class Logbook_model extends CI_Model {
'COL_FREQ_RX' => $this->parse_frequency($this->input->post('freq_display_rx')),
'COL_STX_STRING' => $this->input->post('stx_string'),
'COL_SRX_STRING' => $this->input->post('srx_string'),
'COL_STX' => $stx_string,
'COL_SRX' => $srx_string,
'COL_CONTEST_ID' => $this->input->post('contest_name'),
'COL_STX' => $stx_string,
'COL_SRX' => $srx_string,
'COL_CONTEST_ID' => $this->input->post('contest_name'),
'COL_QSL_VIA' => $this->input->post('qsl_via_callsign'),
'station_id' => $this->input->post('station_profile'),
'station_id' => $stationId,
'COL_OPERATOR' => $this->input->post('operator_callsign'),
'COL_STATE' =>$this->input->post('usa_state'),
'COL_CNTY' => $uscounty
@ -825,10 +830,15 @@ class Logbook_model extends CI_Model {
}
function get_qsos($num, $offset) {
$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').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*');
$this->db->from($this->config->item('table_name'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->where_in('station_profile.station_id', $logbooks_locations_array);
$this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc");
$this->db->limit($num);
@ -897,16 +907,21 @@ class Logbook_model extends CI_Model {
function get_last_qsos($num) {
$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_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_STX_STRING, COL_SRX_STRING, COL_IOTA, COL_STATE, COL_GRIDSQUARE');
$this->db->where("station_id", $station_id);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit($num);
$query = $this->db->get($this->config->item('table_name'));
if ($logbooks_locations_array) {
//$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_STX_STRING, COL_SRX_STRING, COL_IOTA, COL_STATE, COL_GRIDSQUARE');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit($num);
$query = $this->db->get($this->config->item('table_name'));
return $query;
} else {
return null;
}
return $query;
}
/* Get all QSOs with a valid grid for use in the KML export */
@ -979,64 +994,80 @@ 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 ($logbooks_locations_array) {
$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)
{
return $row->count;
}
foreach ($query->result() as $row)
{
return $row->count;
}
}
} else {
return null;
}
}
/* 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'));
if ($logbooks_locations_array) {
$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.'\'');
$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)
{
return $row->count;
}
foreach ($query->result() as $row)
{
return $row->count;
}
}
} else {
return null;
}
}
/* Return QSOs over a period of days */
function map_week_qsos($start, $end) {
$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("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where("station_id", $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "ASC");
$query = $this->db->get($this->config->item('table_name'));
@ -1045,13 +1076,12 @@ class Logbook_model extends CI_Model {
/* used to return custom qsos requires start, end date plus a band */
function map_custom_qsos($start, $end, $band) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where("station_id", $station_id);
$this->db->where_in("station_id", $logbooks_locations_array);
if($band != "All" && $band != "SAT") {
$this->db->where("COL_BAND", $band);
@ -1070,14 +1100,14 @@ class Logbook_model extends CI_Model {
/* Returns QSOs for the date sent eg 2011-09-30 */
function map_day($date) {
$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'));
$start = $date." 00:00:00";
$end = $date." 23:59:59";
$this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where("station_id", $station_id);
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "ASC");
$query = $this->db->get($this->config->item('table_name'));
@ -1088,8 +1118,10 @@ 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'));
if ($logbooks_locations_array) {
$morning = date('Y-m-01 00:00:00');
@ -1098,7 +1130,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)
{
@ -1107,6 +1143,9 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return QSOs for the year for the active profile */
@ -1127,12 +1166,19 @@ 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'));
if ($logbooks_locations_array) {
$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)
{
@ -1141,16 +1187,25 @@ class Logbook_model extends CI_Model {
return $row->count;
}
}
} else {
return null;
}
}
/* Return total amount of SSB QSOs logged */
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)
{
@ -1164,11 +1219,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;
}
@ -1177,10 +1236,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)
{
@ -1195,10 +1257,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)
{
@ -1213,10 +1278,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)
{
@ -1235,14 +1309,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 */
@ -1430,28 +1508,49 @@ class Logbook_model extends CI_Model {
}
}
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state) {
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare) {
if($state != "") {
$data = array(
'COL_LOTW_QSLRDATE' => $qsl_date,
'COL_LOTW_QSL_RCVD' => $qsl_status,
'COL_LOTW_QSL_SENT' => 'Y',
'COL_STATE' => $state
);
} else {
$data = array(
'COL_LOTW_QSLRDATE' => $qsl_date,
'COL_LOTW_QSL_RCVD' => $qsl_status,
'COL_LOTW_QSL_SENT' => 'Y'
);
}
$data = array(
'COL_LOTW_QSLRDATE' => $qsl_date,
'COL_LOTW_QSL_RCVD' => $qsl_status,
'COL_LOTW_QSL_SENT' => 'Y'
);
if($state != "") {
$data['COL_STATE'] = $state;
}
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
$this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band);
$this->db->update($this->config->item('table_name'), $data);
unset($data);
if($qsl_gridsquare != "") {
$data = array(
'COL_GRIDSQUARE' => $qsl_gridsquare
);
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
$this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band);
$this->db->group_start();
$this->db->where('COL_VUCC_GRIDS');
$this->db->or_where('COL_VUCC_GRIDS', '');
$this->db->group_end();
if(strlen($qsl_gridsquare) > 4) {
$this->db->group_start();
$this->db->where('COL_GRIDSQUARE', "");
$this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 4));
if(strlen($qsl_gridsquare) > 6) {
$this->db->or_where('COL_GRIDSQUARE', substr($qsl_gridsquare, 0, 6));
}
$this->db->group_end();
} else {
$this->db->where('COL_GRIDSQUARE', "");
}
$this->db->update($this->config->item('table_name'), $data);
}
return "Updated";
}
@ -2152,8 +2251,8 @@ class Logbook_model extends CI_Model {
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
->where('call', $call)
->where('(start <= CURDATE()')
->or_where('start is null', NULL, false)
->where('end >= CURDATE()')
->or_where('start is null)', NULL, false)
->where('(end >= CURDATE()')
->or_where('end is null)', NULL, false)
->get('dxcc_exceptions');
@ -2501,11 +2600,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');

Wyświetl plik

@ -0,0 +1,188 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Logbooks_model extends CI_Model {
function show_all() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->order_by('logbook_name');
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) {
// Clean input
$cleanId = xss_clean($id);
// be sure that logbook belongs to user
if (!$this->check_logbook_is_accessible($cleanId)) {
return;
}
$data = array(
'active_station_logbook' => $cleanId,
);
$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) {
// Clean ID
$clean_logbook_id = $this->security->xss_clean($logbook_id);
$clean_location_id = $this->security->xss_clean($location_id);
// be sure that logbook belongs to user
if (!$this->check_logbook_is_accessible($clean_logbook_id)) {
return;
}
// be sure that station belongs to user
$CI =& get_instance();
$CI->load->model('Stations');
if (!$CI->Stations->check_station_is_accessible($clean_location_id)) {
return;
}
// Create data array with field values
$data = array(
'station_logbook_id' => $clean_logbook_id,
'station_location_id' => $clean_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;
}
}
function list_logbooks_linked($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);
}
$this->db->where_in('station_id', $relationships_array);
$query = $this->db->get('station_profile');
return $query;
}
else{
return false;
}
}
function delete_relationship($logbook_id, $station_id) {
// Clean ID
$clean_logbook_id = $this->security->xss_clean($logbook_id);
$clean_station_id = $this->security->xss_clean($station_id);
// be sure that logbook belongs to user
if (!$this->check_logbook_is_accessible($clean_logbook_id)) {
return;
}
// be sure that station belongs to user
$CI =& get_instance();
$CI->load->model('Stations');
if (!$CI->Stations->check_station_is_accessible($clean_station_id)) {
return;
}
// Delete relationship
$this->db->where('station_logbook_id', $clean_logbook_id);
$this->db->where('station_location_id', $clean_station_id);
$this->db->delete('station_logbooks_relationship');
}
public function check_logbook_is_accessible($id) {
// check if logbook belongs to user
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('logbook_id', $id);
$query = $this->db->get('station_logbooks');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
}
?>

Wyświetl plik

@ -2,13 +2,8 @@
class Lookup_model extends CI_Model{
function __construct(){
// Call the Model constructor
parent::__construct();
}
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 +49,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 +65,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 +78,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 +91,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 +104,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, '') <> ''";
@ -124,69 +119,14 @@ class Lookup_model extends CI_Model{
return $query->result();
}
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
/*
* Get's the worked bands from the log
*/
function get_worked_bands($station_id)
{
// 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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
/*
* 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 +134,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)) {

Wyświetl plik

@ -2,12 +2,6 @@
class LotwCert extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
/*
|--------------------------------------------------------------------------
| Function: lotw_certs

Wyświetl plik

@ -2,12 +2,6 @@
class Modes extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function all() {
$this->db->order_by('mode', 'ASC');
$this->db->order_by('submode', 'ASC');

Wyświetl plik

@ -2,13 +2,8 @@
class Note extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function list_all() {
$this->db->where('user_id', $this->session->userdata('user_id'));
return $this->db->get('notes');
}
@ -16,10 +11,11 @@ class Note extends CI_Model {
$data = array(
'cat' => xss_clean($this->input->post('category')),
'title' => xss_clean($this->input->post('title')),
'note' => xss_clean($this->input->post('content'))
'note' => xss_clean($this->input->post('content')),
'user_id' => $this->session->userdata('user_id')
);
$this->db->insert('notes', $data);
$this->db->insert('notes', $data);
}
function edit() {
@ -30,19 +26,21 @@ class Note extends CI_Model {
);
$this->db->where('id', xss_clean($this->input->post('id')));
$this->db->update('notes', $data);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->update('notes', $data);
}
function delete($id) {
$this->db->delete('notes', array('id' => xss_clean($id)));
$this->db->delete('notes', array('id' => xss_clean($id), 'user_id' =>$this->session->userdata('user_id')));
}
function view($id) {
// Get Note
$this->db->where('id', xss_clean($id));
$this->db->where('id', xss_clean($id));
$this->db->where('user_id', $this->session->userdata('user_id'));
return $this->db->get('notes');
}
}
?>
?>

Wyświetl plik

@ -8,11 +8,6 @@
class Options_model extends CI_Model {
function __construct()
{
parent::__construct();
}
// Returns all options that are autoload yes
function get_autoloads() {
$this->db->where('autoload', "yes");

Wyświetl plik

@ -1,12 +1,5 @@
<?php
class Qsl_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function getQsoWithQslList() {
$CI =& get_instance();
$CI->load->model('Stations');

Wyświetl plik

@ -2,11 +2,6 @@
class Qslprint_model extends CI_Model {
function __construct()
{
parent::__construct();
}
function mark_qsos_printed($station_id2 = NULL) {
$CI =& get_instance();
$CI->load->model('Stations');

Wyświetl plik

@ -2,11 +2,6 @@
class Search extends CI_Model {
function __construct()
{
parent::__construct();
}
function callsign_iota($reference) {
$this->db->where('COL_IOTA', $reference);
$query = $this->db->get($this->config->item('table_name'));

Wyświetl plik

@ -2,11 +2,6 @@
class Search_filter extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_table_columns() {
$query = $this->db->query('DESCRIBE '.$this->config->item('table_name'));

Wyświetl plik

@ -2,31 +2,28 @@
class Sig extends CI_Model {
function __construct()
{
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 +34,4 @@ class Sig extends CI_Model {
}
?>
?>

Wyświetl plik

@ -2,22 +2,17 @@
class Sota extends CI_Model {
function __construct()
{
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'));
}
}
?>
?>

Wyświetl plik

@ -2,25 +2,29 @@
class Stations extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function all_with_count() {
$this->db->select('station_profile.*, count('.$this->config->item('table_name').'.station_id) as qso_total');
$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);
$this->db->order_by('station_profile.station_profile_name');
return $this->db->get();
}
// Returns ALL station profiles regardless of user logged in
// This is also used by LoTW sync so must not be changed.
function all() {
return $this->db->get('station_profile');
}
function all_of_user() {
$this->db->where('user_id', $this->session->userdata('user_id'));
return $this->db->get('station_profile');
}
function profile($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
@ -92,6 +96,7 @@ class Stations extends CI_Model {
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', xss_clean($this->input->post('station_id', true)));
$this->db->update('station_profile', $data);
}
@ -114,55 +119,76 @@ 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
$clean_current = $this->security->xss_clean($current);
$clean_new = $this->security->xss_clean($new);
// Deselect current default
// be sure that stations belong to user
if ($clean_current != 0) {
if (!$this->check_station_is_accessible($clean_current)) {
return;
}
}
if (!$this->check_station_is_accessible($clean_new)) {
return;
}
// Deselect current default
$current_default = array(
'station_active' => null,
'station_active' => null,
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $clean_current);
$this->db->update('station_profile', $current_default);
// Deselect current default
$newdefault = array(
'station_active' => 1,
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $clean_new);
$this->db->update('station_profile', $newdefault);
}
}
public function find_active() {
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
public function find_active() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_id;
}
} else {
} else {
return "0";
}
}
public function find_gridsquare() {
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_gridsquare;
}
} else {
} else {
return "0";
}
}
}
public function reassign($id) {
// Clean ID
@ -262,6 +288,16 @@ class Stations extends CI_Model {
return $query->num_rows();
}
public function check_station_is_accessible($id) {
// check if station belongs to user
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $id);
$query = $this->db->get('station_profile');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
}
?>

Wyświetl plik

@ -2,11 +2,6 @@
class Stats extends CI_Model {
function __construct()
{
parent::__construct();
}
function result() {
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME');

Wyświetl plik

@ -0,0 +1,50 @@
<?php
class Themes_model extends CI_Model {
// FUNCTION: array getThemes()
// Returns a list of themes
function getThemes() {
$result = $this->db->query('SELECT * FROM themes order by name');
return $result->result();
}
function delete($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
// Delete Theme
$this->db->delete('themes', array('id' => $clean_id));
}
function add() {
$data = array(
'name' => xss_clean($this->input->post('name', true)),
'foldername' => xss_clean($this->input->post('foldername', true)),
);
$this->db->insert('themes', $data);
}
function theme($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$sql = "SELECT * FROM themes where id =" . $clean_id;
$data = $this->db->query($sql);
return ($data->row());
}
function edit($id) {
$data = array(
'name' => xss_clean($this->input->post('name', true)),
'foldername' => xss_clean($this->input->post('foldername', true)),
);
$this->db->where('id', $id);
$this->db->update('themes', $data);
}
}

Wyświetl plik

@ -3,32 +3,28 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Timeline_model extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
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 +48,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 +78,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 +106,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') {
@ -136,61 +132,5 @@ class Timeline_model extends CI_Model
return $query->result();
}
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
function get_worked_bands()
{
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
}

Wyświetl plik

@ -3,70 +3,11 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
class Timeplotter_model extends CI_Model
{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
$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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
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 +28,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 +89,4 @@ class Timeplotter_model extends CI_Model
}
}
}
}

Wyświetl plik

@ -13,12 +13,6 @@
class User_Model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
}
// FUNCTION: object get($username)
// Retrieve a user
function get($username) {
@ -283,6 +277,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);
@ -370,6 +365,14 @@ class User_Model extends CI_Model {
return $ts;
}
// FUNCTION: array getThemes()
// Returns a list of themes
function getThemes() {
$result = $this->db->query('SELECT * FROM themes order by name');
return $result->result();
}
// FUNCTION: bool _auth($password, $hash)
// Checks a password against the stored hash
private function _auth($password, $hash) {

Wyświetl plik

@ -2,69 +2,6 @@
class VUCC extends CI_Model
{
public $bandslots = array("160m" => 0,
"80m" => 0,
"60m" => 0,
"40m" => 0,
"30m" => 0,
"20m" => 0,
"17m" => 0,
"15m" => 0,
"12m" => 0,
"10m" => 0,
"6m" => 0,
"4m" => 0,
"2m" => 0,
"70cm" => 0,
"23cm" => 0,
"13cm" => 0,
"9cm" => 0,
"6cm" => 0,
"3cm" => 0,
"1.25cm" => 0,
"SAT" => 0,
);
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands()
{
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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\""
);
$worked_slots = array();
foreach ($data->result() as $row) {
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach ($SAT_data->result() as $row) {
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach (array_keys($this->bandslots) as $slot) {
if (in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
/*
* Fetches worked and confirmed gridsquare on each band and total
*/
@ -159,11 +96,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 +136,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 +317,5 @@ class VUCC extends CI_Model
return $workedGridArray;
}
function get_station_id() {
$CI =& get_instance();
$CI->load->model('Stations');
return $CI->Stations->find_active();
}
}
?>
?>

Wyświetl plik

@ -4,71 +4,12 @@ class was extends CI_Model {
public $stateString = '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';
public $bandslots = array("160m"=>0,
"80m"=>0,
"60m"=>0,
"40m"=>0,
"30m"=>0,
"20m"=>0,
"17m"=>0,
"15m"=>0,
"12m"=>0,
"10m"=>0,
"6m" =>0,
"4m" =>0,
"2m" =>0,
"70cm"=>0,
"23cm"=>0,
"13cm"=>0,
"9cm"=>0,
"6cm"=>0,
"3cm"=>0,
"1.25cm"=>0,
"SAT"=>0,
);
function __construct()
{
// Call the Model constructor
parent::__construct();
}
function get_worked_bands() {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
// 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\""
);
$worked_slots = array();
foreach($data->result() as $row){
array_push($worked_slots, $row->COL_BAND);
}
$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\""
);
foreach($SAT_data->result() as $row){
array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
}
// bring worked-slots in order of defined $bandslots
$results = array();
foreach(array_keys($this->bandslots) as $slot) {
if(in_array($slot, $worked_slots)) {
array_push($results, $slot);
}
}
return $results;
}
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 +26,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 +43,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 +51,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 +78,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 +100,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 +122,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 +150,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 +163,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 +187,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'] . "')";

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -404,9 +404,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();
}
@ -2127,6 +2126,90 @@ function deleteQsl(id) {
<script src="<?php echo base_url() ;?>assets/js/sections/contestingnames.js"></script>
<?php } ?>
<?php if ($this->uri->segment(1) == "themes") { ?>
<script>
function deleteTheme(id, name) {
BootstrapDialog.confirm({
title: 'DANGER',
message: 'Warning! Are you sure you want to delete the following theme: ' + name + '?' ,
type: BootstrapDialog.TYPE_DANGER,
closable: true,
draggable: true,
btnOKClass: 'btn-danger',
callback: function(result) {
if(result) {
$.ajax({
url: base_url + 'index.php/themes/delete',
type: 'post',
data: {'id': id
},
success: function(data) {
$(".theme_" + id).parent("tr:first").remove(); // removes mode from table
}
});
}
}
});
}
function addThemeDialog() {
$.ajax({
url: base_url + 'index.php/themes/add',
type: 'post',
success: function(html) {
BootstrapDialog.show({
title: 'Create Theme',
size: BootstrapDialog.SIZE_WIDE,
cssClass: 'create-theme-dialog',
nl2br: false,
message: html,
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}
function addTheme(form) {
if (form.name.value != '') {
$.ajax({
url: base_url + 'index.php/themes/add',
type: 'post',
data: {
'name': form.name.value,
'foldername': form.foldername.value,
},
success: function(html) {
location.reload();
}
});
}
}
</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) {

Wyświetl plik

@ -39,7 +39,10 @@
<?php if ($this->uri->segment(1) == "adif") { ?>
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/datepicker.css" />
<?php } ?>
<link rel="icon" href="<?php echo base_url(); ?>/favicon.ico">
<?php if (file_exists(APPPATH.'../assets/css/custom.css')) { echo '<link rel="stylesheet" href="'.base_url().'assets/css/custom.css">'; } ?>
<link rel="icon" href="<?php echo base_url(); ?>favicon.ico">
<title><?php if(isset($page_title)) { echo $page_title; } ?> - Cloudlog</title>
</head>
@ -47,7 +50,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>
@ -120,6 +123,7 @@
</div>
</li>
<?php if(($this->config->item('use_auth')) && ($this->session->userdata('user_type') == 99)) { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Admin</a>
@ -140,6 +144,10 @@
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('themes');?>" title="Manage Themes"><i class="fas fa-cog"></i> Themes</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="<?php echo site_url('backup');?>" title="Backup Cloudlog content"><i class="fas fa-save"></i> Backup</a>
<div class="dropdown-divider"></div>
@ -153,6 +161,7 @@
<?php } ?>
</div>
</li>
<?php } ?>
<?php } ?>
</ul>
@ -185,6 +194,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>
@ -195,6 +206,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>

Wyświetl plik

@ -18,8 +18,10 @@
<!-- Maps -->
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/js/leaflet/leaflet.css" />
<link rel="icon" href="<?php echo base_url(); ?>/favicon.ico">
<?php if (file_exists(APPPATH.'../assets/css/custom.css')) { echo '<link rel="stylesheet" href="'.base_url().'assets/css/custom.css">'; } ?>
<link rel="icon" href="<?php echo base_url(); ?>favicon.ico">
<title><?php if(isset($page_title)) { echo $page_title; } ?> - Cloudlog</title>
</head>
<body>
<body>

Wyświetl plik

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

Wyświetl plik

@ -0,0 +1,105 @@
<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(); ?>
<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">
<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="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>
<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 Name</button>
</form>
</div>
</div>
</div>
<div class="col-md">
<div class="card">
<div class="card-header">Station Locations</div>
<div class="card-body">
<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="form-group">
<label for="StationLocationsSelect">Select Available Station Locations</label>
<select name="SelectedStationLocation" class="form-control" id="StationLocationSelect" aria-describedby="StationLocationSelectHelp">
<?php foreach ($station_locations_list->result() as $row) { ?>
<option value="<?php echo $row->station_id;?>"><?php echo $row->station_profile_name;?> (Callsign: <?php echo $row->station_callsign;?> DXCC: <?php echo $row->station_country;?>)</option>
<?php } ?>
</select>
</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> Link Location</button>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
Linked Locations
</div>
<div class="table-responsive">
<table class="table table-hover">
<thead class="thead-light">
<tr>
<th scope="col">Location Name</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
if ($station_locations_linked) {
foreach ($station_locations_linked->result() as $row) {
?>
<tr>
<td><?php echo $row->station_profile_name;?> (Callsign: <?php echo $row->station_callsign;?> DXCC: <?php echo $row->station_country;?>)</td>
<td><a href="<?php echo site_url('logbooks/delete_relationship/'); ?><?php echo $station_logbook_details->logbook_id; ?>/<?php echo $row->station_id;?>" class="btn btn-danger"><i class="fas fa-trash-alt"></i></a></td>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="2">No linked locations</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -47,12 +47,15 @@
<div class="form-group">
<label for="themeSelect">Theme</label>
<select class="custom-select" id="themeSelect" name="theme" aria-describedby="themeHelp" required>
<option value='default' <?php if($this->optionslib->get_option('theme') == "default") { echo "selected=\"selected\""; } ?>>Default</option>
<option value='blue' <?php if($this->optionslib->get_option('theme')== "blue") { echo "selected=\"selected\""; } ?>>Blue</option>
<option value='cosmo' <?php if($this->optionslib->get_option('theme') == "cosmo") { echo "selected=\"selected\""; } ?>>Cosmo</option>
<option value='cyborg' <?php if($this->optionslib->get_option('theme') == "cyborg") { echo "selected=\"selected\""; } ?>>Cyborg (Dark)</option>
<option value='darkly' <?php if($this->optionslib->get_option('theme') == "darkly") { echo "selected=\"selected\""; } ?>> Darkly (Dark)</option>
<option value='superhero' <?php if($this->optionslib->get_option('theme') == "superhero") { echo "selected=\"selected\""; } ?>>Superhero (Dark)</option>
<?php
foreach ($themes as $theme) {
echo '<option value="' . $theme->foldername . '"';
if ($this->optionslib->get_option('theme') == $theme->foldername) {
echo 'selected="selected"';
}
echo '>' . $theme->name . '</option>';
}
?>
</select>
<small id="themeHelp" class="form-text text-muted">Global Theme Choice, this is used when users arent logged in.</small>
</div>
@ -74,4 +77,4 @@
</div>
</div>
</div>
</div>

Wyświetl plik

@ -17,7 +17,7 @@
<div class="card-body">
<p class="card-text">Station Locations define operating locations, such as your QTH, a friend's QTH, or a portable station.</p>
<p class="card-text">Similar to logbooks, a station profile keeps a set of QSOs together.</p>
<p class="card-text">Only one logbook may be active at a time. In the table below this is shown with the "Active Logbook" badge.</p>
<p class="card-text">Only one station may be active at a time. In the table below this is shown with the "Active Station" badge.</p>
<p><a href="<?php echo site_url('station/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Station Location</a></p>
@ -62,9 +62,9 @@
<td><?php echo $row->station_gridsquare;?></td>
<td style="text-align: center">
<?php if($row->station_active != 1) { ?>
<a href="<?php echo site_url('station/set_active/').$current_active."/".$row->station_id; ?>" class="btn btn-outline-secondary btn-sm" onclick="return confirm('Are you sure you want to make logbook <?php echo $row->station_profile_name; ?> the active logbook?');">Set Active</a>
<a href="<?php echo site_url('station/set_active/').$current_active."/".$row->station_id; ?>" class="btn btn-outline-secondary btn-sm" onclick="return confirm('Are you sure you want to make station <?php echo $row->station_profile_name; ?> the active station?');">Set Active</a>
<?php } else { ?>
<span class="badge badge-success">Active Logbook</span>
<span class="badge badge-success">Active Station</span>
<?php } ?>
<?php if($is_there_qsos_with_no_station_id >= 1) { ?>
@ -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>

Wyświetl plik

@ -0,0 +1,37 @@
<div class="container" id="create_mode">
<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>
<div class="form-group">
<label for="nameInput">Theme Name</label>
<input type="text" class="form-control" name="name" id="nameInput" aria-describedby="nameInputHelp" required>
<small id="nameInputHelp" class="form-text text-muted">This is the name that is used to display the theme in the theme list.</small>
</div>
<div class="form-group">
<label for="foldernameInput">Folder Name</label>
<input type="text" class="form-control" name="foldername" id="foldernameInput" aria-describedby="foldernameInputHelp">
<small id="foldernameInputHelp" class="form-text text-muted">This is the name of the folder where your CSS-files are placed under assets/css.</small>
</div>
<button type="button" onclick="addTheme(this.form);" class="btn btn-primary"><i class="fas fa-plus-square"></i> Add theme</button>
</form>
</div>

Wyświetl plik

@ -0,0 +1,50 @@
<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 } ?>
<div class="card">
<div class="card-header">
<?php echo $page_title; ?>
</div>
<div class="card-body">
<h5 class="card-title"></h5>
<p class="card-text"></p>
<?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('themes/edit/'); ?><?php echo $theme->id; ?>" name="edit_theme">
<div class="form-group">
<label for="themenameInput">Theme Name</label>
<input type="text" class="form-control" name="name" id="nameInput" aria-describedby="themenameInputHelp" value="<?php if(set_value('name') != "") { echo set_value('name'); } else { echo $theme->name; } ?>" required>
<small id="themenameInputHelp" class="form-text text-muted">This is the name that is used to display the theme in the theme list.</small>
</div>
<div class="form-group">
<label for="foldernameInput">Folder Name</label>
<input type="text" class="form-control" name="foldername" id="foldernameInput" aria-describedby="foldernameInputHelp" value="<?php if(set_value('foldername') != "") { echo set_value('foldername'); } else { echo $theme->foldername; } ?>">
<small id="foldernameInputHelp" class="form-text text-muted">This is the name of the folder where your CSS-files are placed under assets/css.</small>
</div>
<button type="submit" class="btn btn-primary btn-sm"><i class="fas fa-plus-square"></i> Update Theme</button>
</form>
</div>
</div>
<br>
</div>

Wyświetl plik

@ -0,0 +1,51 @@
<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">
Themes list
</div>
<div class="card-body">
<p class="card-text">
Using the theme list, you can control which Themes are shown in the account settings. Deleting a theme here, does not delete the css theme folder.
</p>
<div class="table-responsive">
<table style="width:100%" class="contesttable table table-sm table-striped">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Foldername</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php foreach ($themes as $theme) { ?>
<tr>
<td><?php echo $theme->name;?></td>
<td><?php echo $theme->foldername;?></td>
<td>
<a href="<?php echo site_url('themes/edit')."/".$theme->id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
</td>
<td class='theme_<?php echo $theme->id ?>'>
<a href="javascript:deleteTheme('<?php echo $theme->id; ?>', '<?php echo $theme->name; ?>');" class="btn btn-danger btn-sm" ><i class="fas fa-trash-alt"></i> Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
<table>
</div>
<br/>
<p><button onclick="addThemeDialog();" class="btn btn-primary btn-sm"><i class="fas fa-plus"></i> Add a Theme</button></p>
</div>
</div>

Wyświetl plik

@ -30,10 +30,16 @@
<select class="custom-select" name="user_type">
<?php
$levels = $this->config->item('auth_level');
while (list($key, $val) = each($levels)) {
?>
<option value="<?php echo $key; ?>" <?php if(isset($user_type)) { if($user_type == $key) { echo "selected=\"selected\""; } } ?>><?php echo $val; ?></option>
<?php } ?>
foreach ($levels as $key => $value) {
echo '<option value="'. $key . '"';
if(isset($user_type)) {
if($user_type == $key) {
echo "selected=\"selected\"";
}
}
echo '>' . $value . '</option>';
}
?>
</select>
</div>
@ -111,12 +117,15 @@
<div class="form-group">
<label for="user_stylesheet">Theme</label>
<select class="custom-select" id="user_stylesheet" name="user_stylesheet" required>
<option value='default' selected="selected">Default</option>
<option value='blue'>Blue</option>
<option value='cosmo'>Cosmo</option>
<option value='cyborg'>Cyborg (Dark)</option>
<option value='darkly'>Darkly (Dark)</option>
<option value='superhero'>Superhero (Dark)</option>
<?php
foreach ($themes as $theme) {
echo '<option value="' . $theme->foldername . '"';
if( $theme->foldername == 'default') {
echo 'selected="selected"';
}
echo '>' . $theme->name . '</option>';
}
?>
</select>
</div>

Wyświetl plik

@ -71,10 +71,14 @@
<select class="custom-select" name="user_type">
<?php
$levels = $this->config->item('auth_level');
while (list($key, $val) = each($levels)) {
?>
<option value="<?php echo $key; ?>" <?php if($user_type == $key) { echo "selected=\"selected\""; } ?>><?php echo $val; ?></option>
<?php } ?>
foreach ($levels as $key => $value) {
echo '<option value="'. $key . '"';
if($user_type == $key) {
echo "selected=\"selected\"";
}
echo '>' . $value . '</option>';
}
?>
</select>
<?php } else {
$l = $this->config->item('auth_level');
@ -94,12 +98,15 @@
<div class="form-group">
<label>Stylesheet</label>
<select class="custom-select" id="user_stylesheet" name="user_stylesheet" required>
<option value='default' <?php if($user_stylesheet == "default") { echo "selected=\"selected\""; } ?>>Default</option>
<option value='blue' <?php if($user_stylesheet == "blue") { echo "selected=\"selected\""; } ?>>Blue</option>
<option value='cosmo' <?php if($user_stylesheet == "cosmo") { echo "selected=\"selected\""; } ?>>Cosmo</option>
<option value='cyborg' <?php if($user_stylesheet == "cyborg") { echo "selected=\"selected\""; } ?>>Cyborg (Dark)</option>
<option value='darkly' <?php if($user_stylesheet == "darkly") { echo "selected=\"selected\""; } ?>> Darkly (Dark)</option>
<option value='superhero' <?php if($user_stylesheet == "superhero") { echo "selected=\"selected\""; } ?>>Superhero (Dark)</option>
<?php
foreach ($themes as $theme) {
echo '<option value="' . $theme->foldername . '"';
if( $user_stylesheet == $theme->foldername) {
echo 'selected="selected"';
}
echo '>' . $theme->name . '</option>';
}
?>
</select>
</div>
</div>

Wyświetl plik

@ -244,6 +244,14 @@ color: #ffffff;
}
}
/*
* Timepicker alignment
*/
.dxatlasdatepicker {
padding-right: 0;
padding-left: 0;
}
.modal-body {
max-height: calc(100vh - 200px);
overflow-y: auto;

Wyświetl plik

@ -106,7 +106,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 +".");

Wyświetl plik

@ -1,4 +1,11 @@
$( document ).ready(function() {
$("#sat_name").change(function(){
var sat = $("#sat_name").val();
if (sat == "") {
$("#sat_mode").val("");
$("#selectPropagation").val("");
}
});
$('#input_usa_state').change(function(){
var state = $("#input_usa_state option:selected").text();

Wyświetl plik

@ -18,6 +18,8 @@ $config['app_version'] = "1.7";
$config['directory'] = "%directory%";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz
$config['datadir'] = null; // default to install directory
/*
|--------------------------------------------------------------------------
| Logbook Options
@ -72,12 +74,9 @@ $config['hamqth_password'] = "";
$config['use_auth'] = true;
$config['auth_table'] = "users";
$config['auth_mode'] = "0";
$config['auth_mode'] = "3";
$config['auth_level'][0] = "Anonymous";
$config['auth_level'][1] = "Viewer";
$config['auth_level'][2] = "Editor";
$config['auth_level'][3] = "API User";
$config['auth_level'][3] = "Operator";
$config['auth_level'][99] = "Administrator";
/*

Wyświetl plik

@ -1 +1,6 @@
Deny from all
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

Wyświetl plik

@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/benchmark.html
* @link https://codeigniter.com/userguide3/libraries/benchmark.html
*/
class CI_Benchmark {

Wyświetl plik

@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Front-controller
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/
* @link https://codeigniter.com/userguide3/
*/
/**
@ -55,7 +55,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @var string
*
*/
const CI_VERSION = '3.1.6';
const CI_VERSION = '3.2.0-dev';
/*
* ------------------------------------------------------
@ -79,57 +79,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
*/
require_once(BASEPATH.'core/Common.php');
/*
* ------------------------------------------------------
* Security procedures
* ------------------------------------------------------
*/
if ( ! is_php('5.4'))
{
ini_set('magic_quotes_runtime', 0);
if ((bool) ini_get('register_globals'))
{
$_protected = array(
'_SERVER',
'_GET',
'_POST',
'_FILES',
'_REQUEST',
'_SESSION',
'_ENV',
'_COOKIE',
'GLOBALS',
'HTTP_RAW_POST_DATA',
'system_path',
'application_folder',
'view_folder',
'_protected',
'_registered'
);
$_registered = ini_get('variables_order');
foreach (array('E' => '_ENV', 'G' => '_GET', 'P' => '_POST', 'C' => '_COOKIE', 'S' => '_SERVER') as $key => $superglobal)
{
if (strpos($_registered, $key) === FALSE)
{
continue;
}
foreach (array_keys($$superglobal) as $var)
{
if (isset($GLOBALS[$var]) && ! in_array($var, $_protected, TRUE))
{
$GLOBALS[$var] = NULL;
}
}
}
}
}
/*
* ------------------------------------------------------
* Define a custom error handler so we can log PHP errors
@ -192,20 +141,6 @@ if ( ! is_php('5.4'))
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');
/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT =& load_class('Hooks', 'core');
/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->call_hook('pre_system');
/*
* ------------------------------------------------------
* Instantiate the config class
@ -227,6 +162,20 @@ if ( ! is_php('5.4'))
}
}
/*
* ------------------------------------------------------
* Instantiate the hooks class
* ------------------------------------------------------
*/
$EXT =& load_class('Hooks', 'core', $CFG);
/*
* ------------------------------------------------------
* Is there a "pre_system" hook?
* ------------------------------------------------------
*/
$EXT->call_hook('pre_system');
/*
* ------------------------------------------------------
* Important charset-related stuff
@ -294,14 +243,14 @@ if ( ! is_php('5.4'))
* Instantiate the UTF-8 class
* ------------------------------------------------------
*/
$UNI =& load_class('Utf8', 'core');
$UNI =& load_class('Utf8', 'core', $charset);
/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI =& load_class('URI', 'core');
$URI =& load_class('URI', 'core', $CFG);
/*
* ------------------------------------------------------
@ -332,14 +281,14 @@ if ( ! is_php('5.4'))
* Load the security class for xss and csrf support
* -----------------------------------------------------
*/
$SEC =& load_class('Security', 'core');
$SEC =& load_class('Security', 'core', $charset);
/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN =& load_class('Input', 'core');
$IN =& load_class('Input', 'core', $SEC);
/*
* ------------------------------------------------------
@ -402,13 +351,17 @@ if ( ! is_php('5.4'))
$class = ucfirst($RTR->class);
$method = $RTR->method;
if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
if (empty($class) OR !(file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php') OR file_exists(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php')))
{
$e404 = TRUE;
}
else
{
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
if (file_exists(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php')) {
require_once(APPPATH.'third_party/controllers/'.$RTR->directory.$class.'.php');
} else {
require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
}
if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
{
@ -434,7 +387,7 @@ if ( ! is_php('5.4'))
* ReflectionMethod::isConstructor() is the ONLY reliable check,
* knowing which method will be executed as a constructor.
*/
elseif ( ! is_callable(array($class, $method)))
else
{
$reflection = new ReflectionMethod($class, $method);
if ( ! $reflection->isPublic() OR $reflection->isConstructor())

Wyświetl plik

@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage CodeIgniter
* @category Common Functions
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/
* @link https://codeigniter.com/userguide3/
*/
// ------------------------------------------------------------------------
@ -81,8 +81,7 @@ if ( ! function_exists('is_really_writable'))
* Tests for file writability
*
* is_writable() returns TRUE on Windows servers when you really can't write to
* the file, based on the read-only attribute. is_writable() is also unreliable
* on Unix servers if safe_mode is on.
* the file, based on the read-only attribute.
*
* @link https://bugs.php.net/bug.php?id=54709
* @param string
@ -90,8 +89,8 @@ if ( ! function_exists('is_really_writable'))
*/
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable
if (DIRECTORY_SEPARATOR === '/' && (is_php('5.4') OR ! ini_get('safe_mode')))
// If we're on a UNIX-like server, just is_writable()
if (DIRECTORY_SEPARATOR === '/')
{
return is_writable($file);
}
@ -499,6 +498,7 @@ if ( ! function_exists('set_status_header'))
$stati = array(
100 => 'Continue',
101 => 'Switching Protocols',
103 => 'Early Hints',
200 => 'OK',
201 => 'Created',
@ -507,6 +507,7 @@ if ( ! function_exists('set_status_header'))
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
@ -515,6 +516,7 @@ if ( ! function_exists('set_status_header'))
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
@ -534,11 +536,13 @@ if ( ! function_exists('set_status_header'))
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
421 => 'Misdirected Request',
422 => 'Unprocessable Entity',
426 => 'Upgrade Required',
428 => 'Precondition Required',
429 => 'Too Many Requests',
431 => 'Request Header Fields Too Large',
451 => 'Unavailable For Legal Reasons',
500 => 'Internal Server Error',
501 => 'Not Implemented',
@ -565,7 +569,7 @@ if ( ! function_exists('set_status_header'))
return;
}
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2'), TRUE))
$server_protocol = (isset($_SERVER['SERVER_PROTOCOL']) && in_array($_SERVER['SERVER_PROTOCOL'], array('HTTP/1.0', 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0'), TRUE))
? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
header($server_protocol.' '.$code.' '.$text, TRUE, $code);
}
@ -625,7 +629,7 @@ if ( ! function_exists('_error_handler'))
// If the error is fatal, the execution of the script should be stopped because
// errors can't be recovered from. Halting the script conforms with PHP's
// default error handling. See http://www.php.net/manual/en/errorfunc.constants.php
// default error handling. See https://secure.php.net/manual/en/errorfunc.constants.php
if ($is_error)
{
exit(1); // EXIT_ERROR

Wyświetl plik

@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/libraries/config.html
* @link https://codeigniter.com/userguide3/libraries/config.html
*/
class CI_Config {
@ -169,7 +169,7 @@ class CI_Config {
$this->is_loaded[] = $file_path;
$config = NULL;
$loaded = TRUE;
log_message('debug', 'Config file loaded: '.$file_path);
log_message('info', 'Config file loaded: '.$file_path);
}
}
@ -350,20 +350,6 @@ class CI_Config {
// --------------------------------------------------------------------
/**
* System URL
*
* @deprecated 3.0.0 Encourages insecure practices
* @return string
*/
public function system_url()
{
$x = explode('/', preg_replace('|/*(.+?)/*$|', '\\1', BASEPATH));
return $this->slash_item('base_url').end($x).'/';
}
// --------------------------------------------------------------------
/**
* Set a config file item
*

Wyświetl plik

@ -6,7 +6,7 @@
*
* This content is released under the MIT License (MIT)
*
* Copyright (c) 2014 - 2017, British Columbia Institute of Technology
* Copyright (c) 2014 - 2019, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -29,8 +29,8 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
@ -47,7 +47,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
* @subpackage Libraries
* @category Libraries
* @author EllisLab Dev Team
* @link https://codeigniter.com/user_guide/general/controllers.html
* @link https://codeigniter.com/userguide3/general/controllers.html
*/
class CI_Controller {
@ -58,6 +58,13 @@ class CI_Controller {
*/
private static $instance;
/**
* CI_Loader
*
* @var CI_Loader
*/
public $load;
/**
* Class constructor
*

Some files were not shown because too many files have changed in this diff Show More