当前提交
37caa30ce9
共有 3 个文件被更改,包括 317 次插入 和 271 次删除
|
|
@ -3,74 +3,75 @@
|
||||||
|
|
||||||
class Logbook extends CI_Controller {
|
class Logbook extends CI_Controller {
|
||||||
|
|
||||||
function index()
|
function index()
|
||||||
{
|
{
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
|
if(!$this->user_model->authorize($this->config->item('auth_mode'))) {
|
||||||
if($this->user_model->validate_session()) {
|
if($this->user_model->validate_session()) {
|
||||||
$this->user_model->clear_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);
|
show_error('Access denied<p>Click <a href="'.site_url('user/login').'">here</a> to log in as another user', 403);
|
||||||
} else {
|
} else {
|
||||||
redirect('user/login');
|
redirect('user/login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->load->library('pagination');
|
$this->load->library('pagination');
|
||||||
$config['base_url'] = base_url().'index.php/logbook/index/';
|
$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->db->count_all($this->config->item('table_name'));
|
||||||
$config['per_page'] = '25';
|
$config['per_page'] = '25';
|
||||||
$config['num_links'] = 6;
|
$config['num_links'] = 6;
|
||||||
$config['full_tag_open'] = '';
|
$config['full_tag_open'] = '';
|
||||||
$config['full_tag_close'] = '';
|
$config['full_tag_close'] = '';
|
||||||
$config['cur_tag_open'] = '<strong class="active"><a href="">';
|
$config['cur_tag_open'] = '<strong class="active"><a href="">';
|
||||||
$config['cur_tag_close'] = '</a></strong>';
|
$config['cur_tag_close'] = '</a></strong>';
|
||||||
|
|
||||||
$this->pagination->initialize($config);
|
$this->pagination->initialize($config);
|
||||||
|
|
||||||
//load the model and get results
|
//load the model and get results
|
||||||
$this->load->model('logbook_model');
|
$this->load->model('logbook_model');
|
||||||
$data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3));
|
$data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3));
|
||||||
|
|
||||||
// Calculate Lat/Lng from Locator to use on Maps
|
// Calculate Lat/Lng from Locator to use on Maps
|
||||||
if($this->session->userdata('user_locator')) {
|
if($this->session->userdata('user_locator')) {
|
||||||
$this->load->library('qra');
|
$this->load->library('qra');
|
||||||
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
|
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
|
||||||
$data['qra'] = "set";
|
$data['qra'] = "set";
|
||||||
$data['qra_lat'] = $qra_position[0];
|
$data['qra_lat'] = $qra_position[0];
|
||||||
$data['qra_lng'] = $qra_position[1];
|
$data['qra_lng'] = $qra_position[1];
|
||||||
} else {
|
} else {
|
||||||
$data['qra'] = "none";
|
$data['qra'] = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// load the view
|
// load the view
|
||||||
$data['page_title'] = "Logbook";
|
$data['page_title'] = "Logbook";
|
||||||
|
|
||||||
$this->load->view('layout/header', $data);
|
$this->load->view('layout/header', $data);
|
||||||
$this->load->view('view_log/index');
|
$this->load->view('view_log/index');
|
||||||
$this->load->view('layout/footer');
|
$this->load->view('layout/footer');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function json($callsign)
|
function json($callsign)
|
||||||
{
|
{
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||||
|
|
||||||
$this->load->model('logbook_model');
|
$this->load->model('logbook_model');
|
||||||
|
|
||||||
$return = [
|
$return = [
|
||||||
"dxcc" => false,
|
"dxcc" => false,
|
||||||
"callsign_name" => "",
|
"callsign_name" => "",
|
||||||
"callsign_qra" => "",
|
"callsign_qra" => "",
|
||||||
"callsign_qth" => "",
|
"callsign_qth" => "",
|
||||||
"callsign_iota" => "",
|
"callsign_iota" => "",
|
||||||
"bearing" => ""
|
"bearing" => "",
|
||||||
];
|
"workedBefore" => false
|
||||||
|
];
|
||||||
|
|
||||||
$return['dxcc'] = $this->find_dxcc($callsign);
|
$return['dxcc'] = $this->find_dxcc($callsign);
|
||||||
$return['partial'] = $this->partial($callsign);
|
$return['partial'] = $this->partial($callsign);
|
||||||
|
|
||||||
// Do we have local data for the Callsign?
|
// Do we have local data for the Callsign?
|
||||||
if($this->logbook_model->call_name($callsign) != null)
|
if($this->logbook_model->call_name($callsign) != null)
|
||||||
|
|
@ -80,6 +81,7 @@ class Logbook extends CI_Controller {
|
||||||
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
|
$return['callsign_qth'] = $this->logbook_model->call_qth($callsign);
|
||||||
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
|
$return['callsign_iota'] = $this->logbook_model->call_iota($callsign);
|
||||||
$return['bearing'] = $this->bearing($return['callsign_qra']);
|
$return['bearing'] = $this->bearing($return['callsign_qra']);
|
||||||
|
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra']);
|
||||||
echo json_encode($return, JSON_PRETTY_PRINT);
|
echo json_encode($return, JSON_PRETTY_PRINT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -103,8 +105,8 @@ class Logbook extends CI_Controller {
|
||||||
$this->load->library('hamqth');
|
$this->load->library('hamqth');
|
||||||
|
|
||||||
if(!$this->session->userdata('hamqth_session_key')) {
|
if(!$this->session->userdata('hamqth_session_key')) {
|
||||||
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
|
$hamqth_session_key = $this->hamqth->session($this->config->item('hamqth_username'), $this->config->item('hamqth_password'));
|
||||||
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
|
$this->session->set_userdata('hamqth_session_key', $hamqth_session_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
|
$callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
|
||||||
|
|
@ -116,228 +118,244 @@ class Logbook extends CI_Controller {
|
||||||
$return['callsign_qra'] = $callbook['gridsquare'];
|
$return['callsign_qra'] = $callbook['gridsquare'];
|
||||||
$return['callsign_qth'] = $callbook['city'];
|
$return['callsign_qth'] = $callbook['city'];
|
||||||
$return['callsign_iota'] = $callbook['iota'];
|
$return['callsign_iota'] = $callbook['iota'];
|
||||||
|
$return['workedBefore'] = $this->worked_grid_before($return['callsign_qra']);
|
||||||
}
|
}
|
||||||
$return['bearing'] = $this->bearing($return['callsign_qra']);
|
$return['bearing'] = $this->bearing($return['callsign_qra']);
|
||||||
|
|
||||||
echo json_encode($return, JSON_PRETTY_PRINT);
|
echo json_encode($return, JSON_PRETTY_PRINT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used to generate maps for displaying on /logbook/ */
|
function worked_grid_before($gridsquare)
|
||||||
function qso_map() {
|
{
|
||||||
$this->load->model('logbook_model');
|
if (strlen($gridsquare) < 4)
|
||||||
|
return false;
|
||||||
|
|
||||||
$this->load->library('qra');
|
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
|
||||||
|
$query = $this->db->get($this->config->item('table_name'), 1, 0);
|
||||||
$data['qsos'] = $this->logbook_model->get_qsos($this->uri->segment(3),$this->uri->segment(4));
|
foreach ($query->result() as $workedBeforeRow)
|
||||||
|
{
|
||||||
echo "{\"markers\": [";
|
return true;
|
||||||
$count = 1;
|
}
|
||||||
foreach ($data['qsos']->result() as $row) {
|
return false;
|
||||||
//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."\"}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$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
|
|
||||||
');
|
|
||||||
|
|
||||||
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');
|
|
||||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
|
||||||
|
|
||||||
$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 partial($id) {
|
|
||||||
$this->load->model('user_model');
|
|
||||||
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
|
||||||
|
|
||||||
$html = "";
|
|
||||||
$this->db->like('COL_CALL', $id);
|
|
||||||
$this->db->order_by("COL_TIME_ON", "desc");
|
|
||||||
$this->db->limit(16);
|
|
||||||
$query = $this->db->get($this->config->item('table_name'));
|
|
||||||
|
|
||||||
if ($query->num_rows() > 0)
|
|
||||||
{
|
|
||||||
$html .= "<h2>QSOs Matches with ".strtoupper($id)."</h2>";
|
|
||||||
$html .= "<table class=\"partial\" width=\"100%\">";
|
|
||||||
$html .= "<tr>";
|
|
||||||
$html .= "<td>Date</td>";
|
|
||||||
$html .= "<td>Callsign</td>";
|
|
||||||
$html .= "<td>RST Sent</td>";
|
|
||||||
$html .= "<td>RST Recv</td>";
|
|
||||||
$html .= "<td>Band</td>";
|
|
||||||
$html .= "<td>Mode</td>";
|
|
||||||
$html .= "</tr>";
|
|
||||||
foreach ($query->result() as $row)
|
|
||||||
{
|
|
||||||
$html .= "<tr>";
|
|
||||||
$html .= "<td>".$row->COL_TIME_ON."</td>";
|
|
||||||
$html .= "<td>".$row->COL_CALL."</td>";
|
|
||||||
$html .= "<td>".$row->COL_RST_SENT."</td>";
|
|
||||||
$html .= "<td>".$row->COL_RST_RCVD."</td>";
|
|
||||||
if($row->COL_SAT_NAME != null) {
|
|
||||||
$html .= "<td>".$row->COL_SAT_NAME."</td>";
|
|
||||||
} else {
|
|
||||||
$html .= "<td>".$row->COL_BAND."</td>";
|
|
||||||
}
|
|
||||||
$html .= "<td>".$row->COL_MODE."</td>";
|
|
||||||
$html .= "</tr>";
|
|
||||||
}
|
|
||||||
$html .= "</table>";
|
|
||||||
return $html;
|
|
||||||
} 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'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// There's no hamli integration? Disabled for now.
|
|
||||||
/*else {
|
|
||||||
// Lookup using hamli
|
|
||||||
$this->load->library('hamli');
|
|
||||||
|
|
||||||
$data['callsign'] = $this->hamli->callsign($id);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$data['id'] = strtoupper($id);
|
|
||||||
|
|
||||||
return $this->load->view('search/result', $data, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
$this->db->order_by("COL_TIME_ON", "desc");
|
|
||||||
$query = $this->db->get($this->config->item('table_name'));
|
|
||||||
|
|
||||||
if ($query->num_rows() > 0)
|
|
||||||
{
|
|
||||||
$data['results'] = $query;
|
|
||||||
$this->load->view('view_log/partial/log.php', $data);
|
|
||||||
} else {
|
|
||||||
$this->load->model('search');
|
|
||||||
|
|
||||||
$iota_search = $this->search->callsign_iota($id);
|
|
||||||
|
|
||||||
if ($iota_search->num_rows() > 0)
|
|
||||||
{
|
|
||||||
$data['results'] = $iota_search;
|
|
||||||
$this->load->view('view_log/partial/log.php', $data);
|
|
||||||
} 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 hamli
|
|
||||||
$this->load->library('hamli');
|
|
||||||
|
|
||||||
$data['callsign'] = $this->hamli->callsign($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['id'] = strtoupper($id);
|
|
||||||
|
|
||||||
$this->load->view('search/result', $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find DXCC
|
|
||||||
function find_dxcc($callsign) {
|
|
||||||
// Live lookup against Clublogs API
|
|
||||||
$url = "https://secure.clublog.org/dxcc?call=".$callsign."&api=a11c3235cd74b88212ce726857056939d52372bd&full=1";
|
|
||||||
|
|
||||||
$json = file_get_contents($url);
|
|
||||||
$data = json_decode($json, TRUE);
|
|
||||||
|
|
||||||
// echo ucfirst(strtolower($data['Name']));
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Provide a dxcc search, returning results json encoded
|
|
||||||
*/
|
|
||||||
function local_find_dxcc($call = "", $date = "") {
|
|
||||||
$this->load->model("logbook_model");
|
|
||||||
if ($date == ''){
|
|
||||||
$date = date("Y-m-d");
|
|
||||||
}
|
|
||||||
$ans = $this->logbook_model->check_dxcc_stored_proc($call, $date);
|
|
||||||
print json_encode($ans);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* return station bearing */
|
/* Used to generate maps for displaying on /logbook/ */
|
||||||
function bearing($locator) {
|
function qso_map() {
|
||||||
$this->load->library('Qra');
|
$this->load->model('logbook_model');
|
||||||
|
|
||||||
if($locator != null) {
|
$this->load->library('qra');
|
||||||
if($this->session->userdata('user_locator') != null){
|
|
||||||
$mylocator = $this->session->userdata('user_locator');
|
|
||||||
} else {
|
|
||||||
$mylocator = $this->config->item('locator');
|
|
||||||
}
|
|
||||||
|
|
||||||
$bearing = $this->qra->bearing($mylocator, $locator);
|
$data['qsos'] = $this->logbook_model->get_qsos($this->uri->segment(3),$this->uri->segment(4));
|
||||||
|
|
||||||
return $bearing;
|
echo "{\"markers\": [";
|
||||||
}
|
$count = 1;
|
||||||
return "";
|
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."\"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$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
|
||||||
|
');
|
||||||
|
|
||||||
|
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');
|
||||||
|
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||||
|
|
||||||
|
$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 partial($id) {
|
||||||
|
$this->load->model('user_model');
|
||||||
|
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
|
||||||
|
|
||||||
|
$html = "";
|
||||||
|
$this->db->like('COL_CALL', $id);
|
||||||
|
$this->db->order_by("COL_TIME_ON", "desc");
|
||||||
|
$this->db->limit(16);
|
||||||
|
$query = $this->db->get($this->config->item('table_name'));
|
||||||
|
|
||||||
|
if ($query->num_rows() > 0)
|
||||||
|
{
|
||||||
|
$html .= "<h2>QSOs Matches with ".strtoupper($id)."</h2>";
|
||||||
|
$html .= "<table class=\"partial\" width=\"100%\">";
|
||||||
|
$html .= "<tr>";
|
||||||
|
$html .= "<td>Date</td>";
|
||||||
|
$html .= "<td>Callsign</td>";
|
||||||
|
$html .= "<td>RST Sent</td>";
|
||||||
|
$html .= "<td>RST Recv</td>";
|
||||||
|
$html .= "<td>Band</td>";
|
||||||
|
$html .= "<td>Mode</td>";
|
||||||
|
$html .= "</tr>";
|
||||||
|
foreach ($query->result() as $row)
|
||||||
|
{
|
||||||
|
$html .= "<tr>";
|
||||||
|
$html .= "<td>".$row->COL_TIME_ON."</td>";
|
||||||
|
$html .= "<td>".$row->COL_CALL."</td>";
|
||||||
|
$html .= "<td>".$row->COL_RST_SENT."</td>";
|
||||||
|
$html .= "<td>".$row->COL_RST_RCVD."</td>";
|
||||||
|
if($row->COL_SAT_NAME != null) {
|
||||||
|
$html .= "<td>".$row->COL_SAT_NAME."</td>";
|
||||||
|
} else {
|
||||||
|
$html .= "<td>".$row->COL_BAND."</td>";
|
||||||
|
}
|
||||||
|
$html .= "<td>".$row->COL_MODE."</td>";
|
||||||
|
$html .= "</tr>";
|
||||||
|
}
|
||||||
|
$html .= "</table>";
|
||||||
|
return $html;
|
||||||
|
} 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'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// There's no hamli integration? Disabled for now.
|
||||||
|
/*else {
|
||||||
|
// Lookup using hamli
|
||||||
|
$this->load->library('hamli');
|
||||||
|
|
||||||
|
$data['callsign'] = $this->hamli->callsign($id);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$data['id'] = strtoupper($id);
|
||||||
|
|
||||||
|
return $this->load->view('search/result', $data, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
$this->db->order_by("COL_TIME_ON", "desc");
|
||||||
|
$query = $this->db->get($this->config->item('table_name'));
|
||||||
|
|
||||||
|
if ($query->num_rows() > 0)
|
||||||
|
{
|
||||||
|
$data['results'] = $query;
|
||||||
|
$this->load->view('view_log/partial/log.php', $data);
|
||||||
|
} else {
|
||||||
|
$this->load->model('search');
|
||||||
|
|
||||||
|
$iota_search = $this->search->callsign_iota($id);
|
||||||
|
|
||||||
|
if ($iota_search->num_rows() > 0)
|
||||||
|
{
|
||||||
|
$data['results'] = $iota_search;
|
||||||
|
$this->load->view('view_log/partial/log.php', $data);
|
||||||
|
} 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 hamli
|
||||||
|
$this->load->library('hamli');
|
||||||
|
|
||||||
|
$data['callsign'] = $this->hamli->callsign($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['id'] = strtoupper($id);
|
||||||
|
|
||||||
|
$this->load->view('search/result', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find DXCC
|
||||||
|
function find_dxcc($callsign) {
|
||||||
|
// Live lookup against Clublogs API
|
||||||
|
$url = "https://secure.clublog.org/dxcc?call=".$callsign."&api=a11c3235cd74b88212ce726857056939d52372bd&full=1";
|
||||||
|
|
||||||
|
$json = file_get_contents($url);
|
||||||
|
$data = json_decode($json, TRUE);
|
||||||
|
|
||||||
|
// echo ucfirst(strtolower($data['Name']));
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provide a dxcc search, returning results json encoded
|
||||||
|
*/
|
||||||
|
function local_find_dxcc($call = "", $date = "") {
|
||||||
|
$this->load->model("logbook_model");
|
||||||
|
if ($date == ''){
|
||||||
|
$date = date("Y-m-d");
|
||||||
|
}
|
||||||
|
$ans = $this->logbook_model->check_dxcc_stored_proc($call, $date);
|
||||||
|
print json_encode($ans);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* return station bearing */
|
||||||
|
function bearing($locator) {
|
||||||
|
$this->load->library('Qra');
|
||||||
|
|
||||||
|
if($locator != 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, $locator);
|
||||||
|
|
||||||
|
return $bearing;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -464,6 +464,27 @@
|
||||||
if($('#locator').val() == "") {
|
if($('#locator').val() == "") {
|
||||||
$('#locator').val(result.callsign_qra);
|
$('#locator').val(result.callsign_qra);
|
||||||
$('#locator_info').html(result.bearing);
|
$('#locator_info').html(result.bearing);
|
||||||
|
|
||||||
|
if (result.callsign_qra != "")
|
||||||
|
{
|
||||||
|
if (result.workedBefore)
|
||||||
|
{
|
||||||
|
$('#locator').addClass("workedGrid");
|
||||||
|
$('#locator').attr('title', 'Grid was already worked in the past');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#locator').addClass("newGrid");
|
||||||
|
$('#locator').attr('title', 'New grid!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#locator').removeClass("workedGrid");
|
||||||
|
$('#locator').removeClass("newGrid");
|
||||||
|
$('#locator').attr('title', '');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find Operators Name */
|
/* Find Operators Name */
|
||||||
|
|
|
||||||
11
css/main.css
11
css/main.css
|
|
@ -30,9 +30,16 @@ table .title { font-weight: bold; color: #439BF6; }
|
||||||
#sat_name { text-transform: uppercase; }
|
#sat_name { text-transform: uppercase; }
|
||||||
#sat_mode { text-transform: uppercase; }
|
#sat_mode { text-transform: uppercase; }
|
||||||
#iota_ref { text-transform: uppercase; }
|
#iota_ref { text-transform: uppercase; }
|
||||||
|
.workedGrid {
|
||||||
|
background-color: #B33A3A;
|
||||||
|
color: #FFF !important;
|
||||||
|
}
|
||||||
|
.newGrid {
|
||||||
|
background-color: #4BB543;
|
||||||
|
color: #FFF !important;
|
||||||
|
}
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
color: #000000 !important;
|
color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pull-right { color: #fff; }
|
.pull-right { color: #fff; }
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用