kopia lustrzana https://github.com/magicbug/Cloudlog
Switched to use search.ham.io
rodzic
b1017b7b3c
commit
951b31a03f
|
@ -14,6 +14,6 @@ Copyright (c) 2011 Peter Goodhall ([2E0SQL](http://www.m3php.com)).
|
|||
|
||||
## Credits
|
||||
|
||||
* Andy (M0VKG) [http://m0vkg.org.uk](http://m0vkg.org.uk/)
|
||||
* Gavin (M1BXF) [http://www.geekshed.co.uk](http://www.geekshed.co.uk/)
|
||||
* Graham (W5ISP) [http://www.callbytxt.org](http://www.callbytxt.org)
|
||||
* Andy (M0VKG) [http://m0vkg.org.uk](http://m0vkg.org.uk/)
|
||||
* Gavin (M1BXF) [http://www.geekshed.co.uk](http://www.geekshed.co.uk/)
|
||||
* Graham (W5ISP) [http://ham.io](http://ham.io)
|
|
@ -6,26 +6,26 @@
|
|||
| Install Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'app_name' Name of the App 'Cloudlog'
|
||||
| 'app_version' Set by the dev team.
|
||||
| 'directory' directory where cloudlog is installed eg "logger"
|
||||
| 'callbook' Selects which Callbook lookup to use defaults "callbytxt" but supports "qrz"
|
||||
| 'app_name' Name of the App 'Cloudlog'
|
||||
| 'app_version' Set by the dev team.
|
||||
| 'directory' directory where cloudlog is installed eg "logger"
|
||||
| 'callbook' Selects which Callbook lookup to use defaults "hamio" but supports "qrz"
|
||||
*/
|
||||
|
||||
$config['app_name'] = "Cloudlog";
|
||||
$config['app_version'] = "0.1";
|
||||
$config['directory'] = "logbook";
|
||||
|
||||
$config['callbook'] = "callbytxt"; // Options are qrz or callbytxt
|
||||
$config['callbook'] = "hamio"; // Options are hamio or qrz
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Logbook Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'table_name' SQL table where log can be found
|
||||
| 'locator' Default locator used to calculate bearings/distance
|
||||
| 'display_freq' Show or Hide frequnecy info
|
||||
| 'table_name' SQL table where log can be found
|
||||
| 'locator' Default locator used to calculate bearings/distance
|
||||
| 'display_freq' Show or Hide frequnecy info
|
||||
*/
|
||||
|
||||
$config['table_name'] = "table_hrd_contacts_v01";
|
||||
|
@ -37,11 +37,11 @@ $config['display_freq'] = false;
|
|||
| Authentication
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'use_auth' False turns all authentication off, best used when setting up
|
||||
| 'auth_table' MySQL Database Table defaults "users"
|
||||
| 'auth_mode' Minimum user level required 0 = anonymous, 1 = viewer,
|
||||
| 2 = editor, 3 = api user, 99 = owner
|
||||
| 'auth_level[]' Defines level titles
|
||||
| 'use_auth' False turns all authentication off, best used when setting up
|
||||
| 'auth_table' MySQL Database Table defaults "users"
|
||||
| 'auth_mode' Minimum user level required 0 = anonymous, 1 = viewer,
|
||||
| 2 = editor, 3 = api user, 99 = owner
|
||||
| 'auth_level[]' Defines level titles
|
||||
*/
|
||||
|
||||
$config['use_auth'] = true;
|
||||
|
@ -59,8 +59,8 @@ $config['auth_level'][99] = "Administrator";
|
|||
| QRZ Subscription Information
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'username' QRZ.com Username
|
||||
| 'password' Default locator used to calculate bearings/distance
|
||||
| 'username' QRZ.com Username
|
||||
| 'password' Default locator used to calculate bearings/distance
|
||||
*/
|
||||
|
||||
$config['qrz_username'] = "";
|
||||
|
@ -74,13 +74,13 @@ $config['qrz_password'] = "";
|
|||
| URL to your CodeIgniter root. Typically this will be your base URL,
|
||||
| WITH a trailing slash:
|
||||
|
|
||||
| http://example.com/
|
||||
| http://example.com/
|
||||
|
|
||||
| If this is not set then CodeIgniter will guess the protocol, domain and
|
||||
| path to your installation.
|
||||
|
|
||||
*/
|
||||
$config['base_url'] = 'http://localhost/logbook';
|
||||
$config['base_url'] = 'http://localhost/logbook';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -103,14 +103,14 @@ $config['index_page'] = 'index.php';
|
|||
| URI string. The default setting of 'AUTO' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
| 'AUTO' Default - auto detects
|
||||
| 'PATH_INFO' Uses the PATH_INFO
|
||||
| 'QUERY_STRING' Uses the QUERY_STRING
|
||||
| 'REQUEST_URI' Uses the REQUEST_URI
|
||||
| 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
|
||||
|
|
||||
*/
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
$config['uri_protocol'] = 'AUTO';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -135,7 +135,7 @@ $config['url_suffix'] = '';
|
|||
| than english.
|
||||
|
|
||||
*/
|
||||
$config['language'] = 'english';
|
||||
$config['language'] = 'english';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -219,11 +219,11 @@ $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-=[]()*,';
|
|||
| use segment based URLs.
|
||||
|
|
||||
*/
|
||||
$config['allow_get_array'] = TRUE;
|
||||
$config['allow_get_array'] = TRUE;
|
||||
$config['enable_query_strings'] = FALSE;
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
||||
$config['controller_trigger'] = 'c';
|
||||
$config['function_trigger'] = 'm';
|
||||
$config['directory_trigger'] = 'd'; // experimental not currently in use
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -235,11 +235,11 @@ $config['directory_trigger'] = 'd'; // experimental not currently in use
|
|||
| You can enable error logging by setting a threshold over zero. The
|
||||
| threshold determines what gets logged. Threshold options are:
|
||||
|
|
||||
| 0 = Disables logging, Error logging TURNED OFF
|
||||
| 1 = Error Messages (including PHP errors)
|
||||
| 2 = Debug Messages
|
||||
| 3 = Informational Messages
|
||||
| 4 = All Messages
|
||||
| 0 = Disables logging, Error logging TURNED OFF
|
||||
| 1 = Error Messages (including PHP errors)
|
||||
| 2 = Debug Messages
|
||||
| 3 = Informational Messages
|
||||
| 4 = All Messages
|
||||
|
|
||||
| For a live site you'll usually only enable Errors (1) to be logged otherwise
|
||||
| your log files will fill up very fast.
|
||||
|
@ -296,28 +296,28 @@ $config['encryption_key'] = 'flossie1234555541';
|
|||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| 'sess_cookie_name' = the name you want for the cookie
|
||||
| 'sess_expiration' = the number of SECONDS you want the session to last.
|
||||
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| 'sess_expire_on_close' = Whether to cause the session to expire automatically
|
||||
| when the browser window is closed
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
| 'sess_encrypt_cookie' = Whether to encrypt the cookie
|
||||
| 'sess_use_database' = Whether to save the session data to a database
|
||||
| 'sess_table_name' = The name of the session database table
|
||||
| 'sess_match_ip' = Whether to match the user's IP address when reading the session data
|
||||
| 'sess_match_useragent' = Whether to match the User Agent when reading the session data
|
||||
| 'sess_time_to_update' = how many seconds between CI refreshing Session Information
|
||||
|
|
||||
*/
|
||||
$config['sess_cookie_name'] = 'ci_cloudlog';
|
||||
$config['sess_expiration'] = 0;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = FALSE;
|
||||
$config['sess_table_name'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
$config['sess_cookie_name'] = 'ci_cloudlog';
|
||||
$config['sess_expiration'] = 0;
|
||||
$config['sess_expire_on_close'] = FALSE;
|
||||
$config['sess_encrypt_cookie'] = FALSE;
|
||||
$config['sess_use_database'] = FALSE;
|
||||
$config['sess_table_name'] = 'ci_sessions';
|
||||
$config['sess_match_ip'] = FALSE;
|
||||
$config['sess_match_useragent'] = TRUE;
|
||||
$config['sess_time_to_update'] = 300;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -330,10 +330,10 @@ $config['sess_time_to_update'] = 300;
|
|||
| 'cookie_secure' = Cookies will only be set if a secure HTTPS connection exists.
|
||||
|
|
||||
*/
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
$config['cookie_prefix'] = "";
|
||||
$config['cookie_domain'] = "";
|
||||
$config['cookie_path'] = "/";
|
||||
$config['cookie_secure'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
class Logbook extends CI_Controller {
|
||||
|
||||
function index()
|
||||
{
|
||||
function index()
|
||||
{
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
|
||||
if($this->user_model->validate_session()) {
|
||||
|
@ -14,335 +14,335 @@ class Logbook extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$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['per_page'] = '25';
|
||||
$config['num_links'] = 6;
|
||||
$config['full_tag_open'] = '';
|
||||
$config['full_tag_close'] = '';
|
||||
$config['cur_tag_open'] = '<strong class="active"><a href="">';
|
||||
$config['cur_tag_close'] = '</a></strong>';
|
||||
|
||||
$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));
|
||||
$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['per_page'] = '25';
|
||||
$config['num_links'] = 6;
|
||||
$config['full_tag_open'] = '';
|
||||
$config['full_tag_close'] = '';
|
||||
$config['cur_tag_open'] = '<strong class="active"><a href="">';
|
||||
$config['cur_tag_close'] = '</a></strong>';
|
||||
|
||||
$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));
|
||||
|
||||
|
||||
// load the view
|
||||
$data['page_title'] = "Logbook";
|
||||
|
||||
// load the view
|
||||
$data['page_title'] = "Logbook";
|
||||
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('view_log/index');
|
||||
$this->load->view('layout/footer');
|
||||
|
||||
}
|
||||
$this->load->view('layout/header', $data);
|
||||
$this->load->view('view_log/index');
|
||||
$this->load->view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
/* Used to generate maps for displaying on /logbook/ */
|
||||
function qso_map() {
|
||||
$this->load->model('logbook_model');
|
||||
/* Used to generate maps for displaying on /logbook/ */
|
||||
function qso_map() {
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
$this->load->library('qra');
|
||||
$this->load->library('qra');
|
||||
|
||||
$data['qsos'] = $this->logbook_model->get_qsos($this->uri->segment(3),$this->uri->segment(4));
|
||||
$data['qsos'] = $this->logbook_model->get_qsos($this->uri->segment(3),$this->uri->segment(4));
|
||||
|
||||
echo "{\"markers\": [";
|
||||
$count = 1;
|
||||
foreach ($data['qsos']->result() as $row) {
|
||||
//print_r($row);
|
||||
if($row->COL_GRIDSQUARE != null) {
|
||||
$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
echo "{\"markers\": [";
|
||||
$count = 1;
|
||||
foreach ($data['qsos']->result() as $row) {
|
||||
//print_r($row);
|
||||
if($row->COL_GRIDSQUARE != null) {
|
||||
$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE);
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
|
||||
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."\"}";
|
||||
}
|
||||
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."\"}";
|
||||
}
|
||||
|
||||
$count++;
|
||||
$count++;
|
||||
|
||||
} else {
|
||||
$query = $this->db->query('
|
||||
SELECT *
|
||||
FROM dxcc
|
||||
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
|
||||
ORDER BY LENGTH( prefix ) DESC
|
||||
LIMIT 1
|
||||
');
|
||||
} else {
|
||||
$query = $this->db->query('
|
||||
SELECT *
|
||||
FROM dxcc
|
||||
WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
|
||||
ORDER BY LENGTH( prefix ) DESC
|
||||
LIMIT 1
|
||||
');
|
||||
|
||||
foreach ($query->result() as $dxcc) {
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
echo "{\"lat\":\"".$dxcc->lat."\",\"lng\":\"".$dxcc->long."\", \"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."\"}";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
foreach ($query->result() as $dxcc) {
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
echo "{\"lat\":\"".$dxcc->lat."\",\"lng\":\"".$dxcc->long."\", \"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."\"}";
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo "]";
|
||||
echo "}";
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->load->model('user_model');
|
||||
}
|
||||
echo "]";
|
||||
echo "}";
|
||||
}
|
||||
|
||||
function view($id) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$this->load->library('qra');
|
||||
$this->load->library('qra');
|
||||
|
||||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
$data['query'] = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$this->load->view('view_log/qso', $data);
|
||||
}
|
||||
|
||||
function callsign_qra($qra) {
|
||||
$this->load->model('user_model');
|
||||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
$data['query'] = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$this->load->view('view_log/qso', $data);
|
||||
}
|
||||
|
||||
function callsign_qra($qra) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
if($this->logbook_model->call_qra($qra)) {
|
||||
echo $this->logbook_model->call_qra($qra);
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($qra, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['gridsquare'];
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($qra);
|
||||
if($this->logbook_model->call_qra($qra)) {
|
||||
echo $this->logbook_model->call_qra($qra);
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($qra, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['gridsquare'];
|
||||
|
||||
} else {
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->hamio->callsign($qra);
|
||||
|
||||
echo $callbook['gridsquare'];
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $callbook['gridsquare'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function callsign_qth($callsign) {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['city'];
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($callsign);
|
||||
function callsign_qth($callsign) {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['city'];
|
||||
|
||||
} else {
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->hamio->callsign($callsign);
|
||||
|
||||
echo $callbook['city'];
|
||||
}
|
||||
}
|
||||
|
||||
function callsign_iota($callsign) {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['iota'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function callsign_name($callsign) {
|
||||
$this->load->model('user_model');
|
||||
echo $callbook['city'];
|
||||
}
|
||||
}
|
||||
|
||||
function callsign_iota($callsign) {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['iota'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function callsign_name($callsign) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$this->load->model('logbook_model');
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
if($this->logbook_model->call_name($callsign) != null) {
|
||||
echo $this->logbook_model->call_name($callsign);
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['name'];
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
|
||||
$callbook = $this->callbytxt->callsign($callsign);
|
||||
if($this->logbook_model->call_name($callsign) != null) {
|
||||
echo $this->logbook_model->call_name($callsign);
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
echo $callbook['name'];
|
||||
} else {
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->hamio->callsign($callsign);
|
||||
|
||||
echo $callbook['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function partial($id) {
|
||||
$this->load->model('user_model');
|
||||
echo $callbook['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function partial($id) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$this->db->like('COL_CALL', $id);
|
||||
$this->db->limit(5);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
echo "<h2>QSOs Matches with ".strtoupper($id)."</h2>";
|
||||
echo "<table class=\"partial\" width=\"100%\">";
|
||||
echo "<tr>";
|
||||
echo "<td>Date</td>";
|
||||
echo "<td>Callsign</td>";
|
||||
echo "<td>RST Sent</td>";
|
||||
echo "<td>RST Recv</td>";
|
||||
echo "<td>Band</td>";
|
||||
echo "<td>Mode</td>";
|
||||
echo "</tr>";
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row->COL_TIME_ON."</td>";
|
||||
echo "<td>".$row->COL_CALL."</td>";
|
||||
echo "<td>".$row->COL_RST_SENT."</td>";
|
||||
echo "<td>".$row->COL_RST_RCVD."</td>";
|
||||
echo "<td>".$row->COL_BAND."</td>";
|
||||
echo "<td>".$row->COL_MODE."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
$this->load->library('Callbytxt');
|
||||
$data['callsign'] = $this->callbytxt->callsign($id);
|
||||
$data['id'] = strtoupper($id);
|
||||
|
||||
$this->db->like('COL_CALL', $id);
|
||||
$this->db->limit(5);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
echo "<h2>QSOs Matches with ".strtoupper($id)."</h2>";
|
||||
echo "<table class=\"partial\" width=\"100%\">";
|
||||
echo "<tr>";
|
||||
echo "<td>Date</td>";
|
||||
echo "<td>Callsign</td>";
|
||||
echo "<td>RST Sent</td>";
|
||||
echo "<td>RST Recv</td>";
|
||||
echo "<td>Band</td>";
|
||||
echo "<td>Mode</td>";
|
||||
echo "</tr>";
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row->COL_TIME_ON."</td>";
|
||||
echo "<td>".$row->COL_CALL."</td>";
|
||||
echo "<td>".$row->COL_RST_SENT."</td>";
|
||||
echo "<td>".$row->COL_RST_RCVD."</td>";
|
||||
echo "<td>".$row->COL_BAND."</td>";
|
||||
echo "<td>".$row->COL_MODE."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
$this->load->library('hamio');
|
||||
$data['callsign'] = $this->hamio->callsign($id);
|
||||
$data['id'] = strtoupper($id);
|
||||
|
||||
$this->load->view('search/result', $data);
|
||||
}
|
||||
}
|
||||
|
||||
function search_result($id) {
|
||||
$this->load->model('user_model');
|
||||
$this->load->view('search/result', $data);
|
||||
}
|
||||
}
|
||||
|
||||
function search_result($id) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||
|
||||
$this->db->like('COL_CALL', $id);
|
||||
$this->db->or_like('COL_GRIDSQUARE', $id);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
$this->db->like('COL_CALL', $id);
|
||||
$this->db->or_like('COL_GRIDSQUARE', $id);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
echo "<table class=\"partial\" width=\"100%\">";
|
||||
echo "<tr>";
|
||||
echo "<td>Date</td>";
|
||||
echo "<td>Callsign</td>";
|
||||
echo "<td>RST Sent</td>";
|
||||
echo "<td>RST Recv</td>";
|
||||
echo "<td>Band</td>";
|
||||
echo "<td>Mode</td>";
|
||||
echo "<td></td>";
|
||||
echo "</tr>";
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row->COL_TIME_ON."</td>";
|
||||
echo "<td>".$row->COL_CALL."</td>";
|
||||
echo "<td>".$row->COL_RST_SENT."</td>";
|
||||
echo "<td>".$row->COL_RST_RCVD."</td>";
|
||||
if ($query->num_rows() > 0)
|
||||
{
|
||||
echo "<table class=\"partial\" width=\"100%\">";
|
||||
echo "<tr>";
|
||||
echo "<td>Date</td>";
|
||||
echo "<td>Callsign</td>";
|
||||
echo "<td>RST Sent</td>";
|
||||
echo "<td>RST Recv</td>";
|
||||
echo "<td>Band</td>";
|
||||
echo "<td>Mode</td>";
|
||||
echo "<td></td>";
|
||||
echo "</tr>";
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row->COL_TIME_ON."</td>";
|
||||
echo "<td>".$row->COL_CALL."</td>";
|
||||
echo "<td>".$row->COL_RST_SENT."</td>";
|
||||
echo "<td>".$row->COL_RST_RCVD."</td>";
|
||||
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
echo "<td>".$row->COL_SAT_NAME."</td>";
|
||||
} else {
|
||||
echo "<td>".$row->COL_BAND."</td>";
|
||||
}
|
||||
echo "<td>".$row->COL_MODE."</td>";
|
||||
if($this->user_model->authorize(2)) {
|
||||
echo "<td><a class=\"editbox\" href=\"".site_url('qso/edit')."/".$row->COL_PRIMARY_KEY."\" ><img src=\"".base_url()."/images/application_edit.png\" width=\"16\" height=\"16\" alt=\"Edit\" /></a></td>";
|
||||
} else {
|
||||
echo "<td></td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'));
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
echo "<td>".$row->COL_SAT_NAME."</td>";
|
||||
} else {
|
||||
echo "<td>".$row->COL_BAND."</td>";
|
||||
}
|
||||
echo "<td>".$row->COL_MODE."</td>";
|
||||
if($this->user_model->authorize(2)) {
|
||||
echo "<td><a class=\"editbox\" href=\"".site_url('qso/edit')."/".$row->COL_PRIMARY_KEY."\" ><img src=\"".base_url()."/images/application_edit.png\" width=\"16\" height=\"16\" alt=\"Edit\" /></a></td>";
|
||||
} else {
|
||||
echo "<td></td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
|
||||
$this->load->library('qrz');
|
||||
|
||||
if(!$this->session->userdata('qrz_session_key')) {
|
||||
$qrz_session_key = $this->qrz->session($this->config->item('qrz_username'), $this->config->item('qrz_password'));
|
||||
$this->session->set_userdata('qrz_session_key', $qrz_session_key);
|
||||
}
|
||||
|
||||
$data['callsign'] = $this->qrz->search($id, $this->session->userdata('qrz_session_key'));
|
||||
|
||||
|
||||
} else {
|
||||
// Lookup using Callbytxt
|
||||
$this->load->library('callbytxt');
|
||||
|
||||
$data['callsign'] = $this->callbytxt->callsign($id);
|
||||
}
|
||||
|
||||
$data['id'] = strtoupper($id);
|
||||
|
||||
} else {
|
||||
// Lookup using hamio
|
||||
$this->load->library('hamio');
|
||||
|
||||
$data['callsign'] = $this->hamio->callsign($id);
|
||||
}
|
||||
|
||||
$data['id'] = strtoupper($id);
|
||||
|
||||
$this->load->view('search/result', $data);
|
||||
}
|
||||
}
|
||||
|
||||
// Find DXCC
|
||||
function find_dxcc($callsign) {
|
||||
$this->load->model('dxcc');
|
||||
$this->load->view('search/result', $data);
|
||||
}
|
||||
}
|
||||
|
||||
// Find DXCC
|
||||
function find_dxcc($callsign) {
|
||||
$this->load->model('dxcc');
|
||||
|
||||
$dxccinfo = $this->dxcc->info($callsign);
|
||||
$dxccinfo = $this->dxcc->info($callsign);
|
||||
|
||||
foreach ($dxccinfo->result() as $row)
|
||||
{
|
||||
echo ucfirst(strtolower($row->name));
|
||||
}
|
||||
}
|
||||
|
||||
/* return station bearing */
|
||||
function bearing() {
|
||||
$this->load->library('Qra');
|
||||
|
||||
if($this->uri->segment(3) != null) {
|
||||
if($this->session->userdata('user_locator') != null){
|
||||
$mylocator = $this->session->userdata('user_locator');
|
||||
} else {
|
||||
$mylocator = $this->config->item('locator');
|
||||
}
|
||||
foreach ($dxccinfo->result() as $row)
|
||||
{
|
||||
echo ucfirst(strtolower($row->name));
|
||||
}
|
||||
}
|
||||
|
||||
/* return station bearing */
|
||||
function bearing() {
|
||||
$this->load->library('Qra');
|
||||
|
||||
if($this->uri->segment(3) != null) {
|
||||
if($this->session->userdata('user_locator') != null){
|
||||
$mylocator = $this->session->userdata('user_locator');
|
||||
} else {
|
||||
$mylocator = $this->config->item('locator');
|
||||
}
|
||||
|
||||
$bearing = $this->qra->bearing($mylocator, $this->uri->segment(3));
|
||||
|
||||
echo $bearing;
|
||||
}
|
||||
}
|
||||
$bearing = $this->qra->bearing($mylocator, $this->uri->segment(3));
|
||||
|
||||
echo $bearing;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,15 +3,15 @@
|
|||
class Welcome extends CI_Controller {
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('callbytxt');
|
||||
|
||||
$callbook = $this->callbytxt->callsign('m3php');
|
||||
|
||||
print_r($callbook);
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('hamio');
|
||||
|
||||
$callbook = $this->hamio->callsign('m3php');
|
||||
|
||||
print_r($callbook);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Callbytxt {
|
||||
|
||||
/*
|
||||
Communicates with the Callbytxt API functions
|
||||
*/
|
||||
|
||||
public function callsign($callsign)
|
||||
{
|
||||
ini_set ('display_errors', 1);
|
||||
$jsonurl = "http://callbytxt.org/db/".$callsign.".json";
|
||||
|
||||
$json = @file_get_contents($jsonurl,0,null,null);
|
||||
$json_output = json_decode($json);
|
||||
|
||||
if(isset($json_output)) {
|
||||
$data['callsign'] = $json_output->calls->callsign;
|
||||
$data['name'] = ucfirst(strtolower((current(explode(' ', $json_output->calls->first_name)))));
|
||||
|
||||
if(strtoupper($json_output->calls->gridsquare) == "JJ00AA") {
|
||||
$data['gridsquare'] = "";
|
||||
} else {
|
||||
$data['gridsquare'] = ucfirst($json_output->calls->gridsquare);
|
||||
}
|
||||
|
||||
$data['city'] = ucfirst(strtolower(($json_output->calls->city)));
|
||||
|
||||
$data['lat'] = ucfirst($json_output->calls->lat);
|
||||
$data['long'] = ucfirst($json_output->calls->long);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Callbytxt.php */
|
|
@ -0,0 +1,30 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Hamio {
|
||||
|
||||
/*
|
||||
Communicates with the ham.io API functions
|
||||
*/
|
||||
|
||||
public function callsign($callsign)
|
||||
{
|
||||
ini_set ('display_errors', 1);
|
||||
$jsonurl = "http://search.ham.io/api/call/".$callsign;
|
||||
|
||||
$json = @file_get_contents($jsonurl,0,null,null);
|
||||
$json_output = json_decode($json);
|
||||
|
||||
if(isset($json_output)) {
|
||||
$data['callsign'] = $json_output->calls->callsign;
|
||||
$data['name'] = "$json_output->calls->first_name $json_output->calls->last_name";
|
||||
$data['gridsquare'] = $json_output->calls->gridsquare;
|
||||
$data['city'] = ucfirst(strtolower(($json_output->calls->city)));
|
||||
$data['lat'] = ucfirst($json_output->calls->latitude);
|
||||
$data['long'] = ucfirst($json_output->calls->longitude);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file hamio.php */
|
|
@ -8,17 +8,17 @@ class Logbook_model extends CI_Model {
|
|||
parent::__construct();
|
||||
}
|
||||
|
||||
/* Add QSO to Logbook */
|
||||
function add() {
|
||||
// Join date+time
|
||||
$datetime = date('Y-m-d') ." ". $this->input->post('start_time');
|
||||
|
||||
if ($this->input->post('prop_mode') != null) {
|
||||
$prop_mode = $this->input->post('prop_mode');
|
||||
} else {
|
||||
$prop_mode = "";
|
||||
}
|
||||
|
||||
/* Add QSO to Logbook */
|
||||
function add() {
|
||||
// Join date+time
|
||||
$datetime = date('Y-m-d') ." ". $this->input->post('start_time');
|
||||
|
||||
if ($this->input->post('prop_mode') != null) {
|
||||
$prop_mode = $this->input->post('prop_mode');
|
||||
} else {
|
||||
$prop_mode = "";
|
||||
}
|
||||
|
||||
if($this->input->post('sat_name')) {
|
||||
$prop_mode = "SAT";
|
||||
}
|
||||
|
@ -29,61 +29,61 @@ class Logbook_model extends CI_Model {
|
|||
$locator = $this->config->item('locator');
|
||||
}
|
||||
|
||||
// Create array with QSO Data
|
||||
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $datetime,
|
||||
'COL_TIME_OFF' => $datetime,
|
||||
'COL_CALL' => strtoupper($this->input->post('callsign')),
|
||||
'COL_BAND' => $this->input->post('band'),
|
||||
'COL_FREQ' => $this->input->post('freq_display'),
|
||||
'COL_MODE' => $this->input->post('mode'),
|
||||
'COL_RST_RCVD' => $this->input->post('rst_recv'),
|
||||
'COL_RST_SENT' => $this->input->post('rst_sent'),
|
||||
'COL_NAME' => $this->input->post('name'),
|
||||
'COL_COMMENT' => $this->input->post('comment'),
|
||||
'COL_SAT_NAME' => strtoupper($this->input->post('sat_name')),
|
||||
'COL_SAT_MODE' => strtoupper($this->input->post('sat_mode')),
|
||||
'COL_GRIDSQUARE' => strtoupper(trim($this->input->post('locator'))),
|
||||
'COL_COUNTRY' => $this->input->post('country'),
|
||||
'COL_MY_RIG' => $this->input->post('equipment'),
|
||||
'COL_QSLSDATE' => date('Y-m-d'),
|
||||
'COL_QSLRDATE' => date('Y-m-d'),
|
||||
'COL_QSL_SENT' => $this->input->post('qsl_sent'),
|
||||
'COL_QSL_RCVD' => $this->input->post('qsl_recv'),
|
||||
'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'),
|
||||
'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'),
|
||||
'COL_QSL_VIA' => $this->input->post('qsl_via'),
|
||||
'COL_OPERATOR' => $this->session->userdata('user_callsign'),
|
||||
'COL_QTH' => $this->input->post('qth'),
|
||||
'COL_PROP_MODE' => $prop_mode,
|
||||
'COL_IOTA' => $this->input->post('iota_ref'),
|
||||
'COL_MY_GRIDSQUARE' => strtoupper($locator),
|
||||
'COL_DISTANCE' => "0",
|
||||
'COL_FREQ_RX' => 0,
|
||||
'COL_BAND_RX' => null,
|
||||
'COL_ANT_AZ' => null,
|
||||
'COL_ANT_EL' => null,
|
||||
'COL_A_INDEX' => null,
|
||||
'COL_AGE' => null,
|
||||
'COL_TEN_TEN' => null,
|
||||
'COL_TX_PWR' => null,
|
||||
'COL_STX' => null,
|
||||
'COL_SRX' => null,
|
||||
'COL_NR_BURSTS' => null,
|
||||
'COL_NR_PINGS' => null,
|
||||
'COL_MAX_BURSTS' => null,
|
||||
'COL_K_INDEX' => null,
|
||||
'COL_SFI' => null,
|
||||
'COL_RX_PWR' => null,
|
||||
'COL_LAT' => null,
|
||||
'COL_LON' => null,
|
||||
);
|
||||
// Create array with QSO Data
|
||||
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $datetime,
|
||||
'COL_TIME_OFF' => $datetime,
|
||||
'COL_CALL' => strtoupper($this->input->post('callsign')),
|
||||
'COL_BAND' => $this->input->post('band'),
|
||||
'COL_FREQ' => $this->input->post('freq_display'),
|
||||
'COL_MODE' => $this->input->post('mode'),
|
||||
'COL_RST_RCVD' => $this->input->post('rst_recv'),
|
||||
'COL_RST_SENT' => $this->input->post('rst_sent'),
|
||||
'COL_NAME' => $this->input->post('name'),
|
||||
'COL_COMMENT' => $this->input->post('comment'),
|
||||
'COL_SAT_NAME' => strtoupper($this->input->post('sat_name')),
|
||||
'COL_SAT_MODE' => strtoupper($this->input->post('sat_mode')),
|
||||
'COL_GRIDSQUARE' => strtoupper(trim($this->input->post('locator'))),
|
||||
'COL_COUNTRY' => $this->input->post('country'),
|
||||
'COL_MY_RIG' => $this->input->post('equipment'),
|
||||
'COL_QSLSDATE' => date('Y-m-d'),
|
||||
'COL_QSLRDATE' => date('Y-m-d'),
|
||||
'COL_QSL_SENT' => $this->input->post('qsl_sent'),
|
||||
'COL_QSL_RCVD' => $this->input->post('qsl_recv'),
|
||||
'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'),
|
||||
'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'),
|
||||
'COL_QSL_VIA' => $this->input->post('qsl_via'),
|
||||
'COL_OPERATOR' => $this->session->userdata('user_callsign'),
|
||||
'COL_QTH' => $this->input->post('qth'),
|
||||
'COL_PROP_MODE' => $prop_mode,
|
||||
'COL_IOTA' => $this->input->post('iota_ref'),
|
||||
'COL_MY_GRIDSQUARE' => strtoupper($locator),
|
||||
'COL_DISTANCE' => "0",
|
||||
'COL_FREQ_RX' => 0,
|
||||
'COL_BAND_RX' => null,
|
||||
'COL_ANT_AZ' => null,
|
||||
'COL_ANT_EL' => null,
|
||||
'COL_A_INDEX' => null,
|
||||
'COL_AGE' => null,
|
||||
'COL_TEN_TEN' => null,
|
||||
'COL_TX_PWR' => null,
|
||||
'COL_STX' => null,
|
||||
'COL_SRX' => null,
|
||||
'COL_NR_BURSTS' => null,
|
||||
'COL_NR_PINGS' => null,
|
||||
'COL_MAX_BURSTS' => null,
|
||||
'COL_K_INDEX' => null,
|
||||
'COL_SFI' => null,
|
||||
'COL_RX_PWR' => null,
|
||||
'COL_LAT' => null,
|
||||
'COL_LON' => null,
|
||||
);
|
||||
|
||||
$this->add_qso($data);
|
||||
}
|
||||
$this->add_qso($data);
|
||||
}
|
||||
|
||||
/* Add QSO to Logbook */
|
||||
/* Add QSO to Logbook */
|
||||
function create_qso() {
|
||||
// Join date+time
|
||||
$datetime = date("Y-m-d",strtotime($this->input->post('start_date')))." ". $this->input->post('start_time');
|
||||
|
@ -157,65 +157,65 @@ class Logbook_model extends CI_Model {
|
|||
$this->add_qso($data);
|
||||
}
|
||||
|
||||
function add_qso($data) {
|
||||
// Add QSO to database
|
||||
$this->db->insert($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
/* Edit QSO */
|
||||
function edit() {
|
||||
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $this->input->post('time_on'),
|
||||
'COL_TIME_OFF' => $this->input->post('time_off'),
|
||||
'COL_CALL' => strtoupper($this->input->post('callsign')),
|
||||
'COL_BAND' => $this->input->post('band'),
|
||||
'COL_FREQ' => $this->input->post('freq'),
|
||||
'COL_MODE' => $this->input->post('mode'),
|
||||
'COL_RST_RCVD' => $this->input->post('rst_recv'),
|
||||
'COL_RST_SENT' => $this->input->post('rst_sent'),
|
||||
'COL_GRIDSQUARE' => $this->input->post('locator'),
|
||||
'COL_COMMENT' => $this->input->post('comment'),
|
||||
'COL_NAME' => $this->input->post('name'),
|
||||
function add_qso($data) {
|
||||
// Add QSO to database
|
||||
$this->db->insert($this->config->item('table_name'), $data);
|
||||
}
|
||||
|
||||
/* Edit QSO */
|
||||
function edit() {
|
||||
|
||||
$data = array(
|
||||
'COL_TIME_ON' => $this->input->post('time_on'),
|
||||
'COL_TIME_OFF' => $this->input->post('time_off'),
|
||||
'COL_CALL' => strtoupper($this->input->post('callsign')),
|
||||
'COL_BAND' => $this->input->post('band'),
|
||||
'COL_FREQ' => $this->input->post('freq'),
|
||||
'COL_MODE' => $this->input->post('mode'),
|
||||
'COL_RST_RCVD' => $this->input->post('rst_recv'),
|
||||
'COL_RST_SENT' => $this->input->post('rst_sent'),
|
||||
'COL_GRIDSQUARE' => $this->input->post('locator'),
|
||||
'COL_COMMENT' => $this->input->post('comment'),
|
||||
'COL_NAME' => $this->input->post('name'),
|
||||
'COL_COUNTRY' => $this->input->post('country'),
|
||||
'COL_SAT_NAME' => $this->input->post('sat_name'),
|
||||
'COL_SAT_MODE' => $this->input->post('sat_mode'),
|
||||
'COL_QSLSDATE' => date('Y-m-d'),
|
||||
'COL_QSLRDATE' => date('Y-m-d'),
|
||||
'COL_QSL_SENT' => $this->input->post('qsl_sent'),
|
||||
'COL_QSL_RCVD' => $this->input->post('qsl_recv'),
|
||||
'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'),
|
||||
'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'),
|
||||
'COL_IOTA' => $this->input->post('iota_ref'),
|
||||
'COL_QTH' => $this->input->post('qth'),
|
||||
'COL_FREQ_RX' => '0',
|
||||
'COL_STX_STRING' => $this->input->post('stx_string'),
|
||||
'COL_SAT_NAME' => $this->input->post('sat_name'),
|
||||
'COL_SAT_MODE' => $this->input->post('sat_mode'),
|
||||
'COL_QSLSDATE' => date('Y-m-d'),
|
||||
'COL_QSLRDATE' => date('Y-m-d'),
|
||||
'COL_QSL_SENT' => $this->input->post('qsl_sent'),
|
||||
'COL_QSL_RCVD' => $this->input->post('qsl_recv'),
|
||||
'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'),
|
||||
'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'),
|
||||
'COL_IOTA' => $this->input->post('iota_ref'),
|
||||
'COL_QTH' => $this->input->post('qth'),
|
||||
'COL_FREQ_RX' => '0',
|
||||
'COL_STX_STRING' => $this->input->post('stx_string'),
|
||||
'COL_SRX_STRING' => $this->input->post('srx_string')
|
||||
);
|
||||
);
|
||||
|
||||
$this->db->where('COL_PRIMARY_KEY', $this->input->post('id'));
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
|
||||
}
|
||||
$this->db->where('COL_PRIMARY_KEY', $this->input->post('id'));
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
|
||||
}
|
||||
|
||||
/* Return last 10 QSOs */
|
||||
function last_ten() {
|
||||
$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');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit(10);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
/* Show custom number of qsos */
|
||||
function last_custom($num) {
|
||||
$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');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit($num);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
/* Return last 10 QSOs */
|
||||
function last_ten() {
|
||||
$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');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit(10);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
/* Show custom number of qsos */
|
||||
function last_custom($num) {
|
||||
$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');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit($num);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
/* Callsign QRA */
|
||||
|
||||
function call_qra($callsign) {
|
||||
|
@ -253,42 +253,36 @@ class Logbook_model extends CI_Model {
|
|||
{
|
||||
$data = $query->row();
|
||||
$name = $data->COL_NAME;
|
||||
} else {
|
||||
//$json = file_get_contents("http://callbytxt.org/db/".$callsign.".json");
|
||||
|
||||
//$obj = json_decode($json);
|
||||
//$uppercase_name = strtolower($obj->{'calls'}->{'first_name'});
|
||||
// $name = ucwords($uppercase_name);
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/* Return QSO Info */
|
||||
function qso_info($id) {
|
||||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
|
||||
function get_qsos($num, $offset) {
|
||||
$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, COL_GRIDSQUARE, COL_QSL_RCVD, COL_QSL_SENT, COL_STX_STRING, COL_SRX_STRING');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'), $num, $offset);
|
||||
|
||||
return $query;
|
||||
}
|
||||
/* Return QSO Info */
|
||||
function qso_info($id) {
|
||||
$this->db->where('COL_PRIMARY_KEY', $id);
|
||||
|
||||
return $this->db->get($this->config->item('table_name'));
|
||||
}
|
||||
|
||||
function get_last_qsos($num) {
|
||||
$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, COL_STX_STRING, COL_SRX_STRING');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit($num);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function get_qsos($num, $offset) {
|
||||
$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, COL_GRIDSQUARE, COL_QSL_RCVD, COL_QSL_SENT, COL_STX_STRING, COL_SRX_STRING');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'), $num, $offset);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function get_last_qsos($num) {
|
||||
$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, COL_STX_STRING, COL_SRX_STRING');
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit($num);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Get All QSOs with a Valid Grid */
|
||||
function kml_get_all_qsos() {
|
||||
|
@ -310,15 +304,15 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function get_todays_qsos() {
|
||||
|
||||
function get_todays_qsos() {
|
||||
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
$query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
$query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
|
||||
return $query;
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Return total number of qsos */
|
||||
function total_qsos() {
|
||||
|
@ -516,29 +510,29 @@ class Logbook_model extends CI_Model {
|
|||
return $query->num_rows();
|
||||
}
|
||||
|
||||
function api_search_query($query) {
|
||||
$time_start = microtime(true);
|
||||
$results = $this->db->query($query);
|
||||
function api_search_query($query) {
|
||||
$time_start = microtime(true);
|
||||
$results = $this->db->query($query);
|
||||
if(!$results) {
|
||||
return array('query' => $query, 'error' => $this->db->_error_number(), 'time' => 0);
|
||||
}
|
||||
$time_end = microtime(true);
|
||||
$time = round($time_end - $time_start, 4);
|
||||
$time_end = microtime(true);
|
||||
$time = round($time_end - $time_start, 4);
|
||||
|
||||
return array('query' => $query, 'results' => $results, 'time' => $time);
|
||||
}
|
||||
return array('query' => $query, 'results' => $results, 'time' => $time);
|
||||
}
|
||||
|
||||
function api_insert_query($query) {
|
||||
$time_start = microtime(true);
|
||||
$results = $this->db->insert($this->config->item('table_name'), $query);
|
||||
function api_insert_query($query) {
|
||||
$time_start = microtime(true);
|
||||
$results = $this->db->insert($this->config->item('table_name'), $query);
|
||||
if(!$results) {
|
||||
return array('query' => $query, 'error' => $this->db->_error_number(), 'time' => 0);
|
||||
}
|
||||
$time_end = microtime(true);
|
||||
$time = round($time_end - $time_start, 4);
|
||||
$time_end = microtime(true);
|
||||
$time = round($time_end - $time_start, 4);
|
||||
|
||||
return array('query' => $this->db->queries[2], 'result_string' => $results, 'time' => $time);
|
||||
}
|
||||
return array('query' => $this->db->queries[2], 'result_string' => $results, 'time' => $time);
|
||||
}
|
||||
|
||||
/* Delete QSO based on the QSO ID */
|
||||
function delete($id) {
|
||||
|
|
Ładowanie…
Reference in New Issue