Ability to search for QSOs with IOTA refs eg eu-008

pull/150/head
Peter Goodhall 2013-08-06 23:02:49 +01:00
rodzic 6b3ab6c543
commit bcb01b7423
3 zmienionych plików z 64 dodań i 31 usunięć

Wyświetl plik

@ -277,31 +277,44 @@ class Logbook extends CI_Controller {
$data['results'] = $query;
$this->load->view('search/result_search.php', $data);
$this->load->view('search/result_search.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'));
$this->load->model('search');
$iota_search = $this->search->callsign_iota($id);
if ($iota_search->num_rows() > 0)
{
$data['results'] = $iota_search;
$this->load->view('search/result_search.php', $data);
} else {
// Lookup using hamio
$this->load->library('hamio');
$data['callsign'] = $this->hamio->callsign($id);
}
$data['id'] = strtoupper($id);
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'));
$this->load->view('search/result', $data);
} else {
// Lookup using hamio
$this->load->library('hamio');
$data['callsign'] = $this->hamio->callsign($id);
}
$data['id'] = strtoupper($id);
$this->load->view('search/result', $data);
}
}
}

Wyświetl plik

@ -4,19 +4,20 @@ class Search extends CI_Controller {
public 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');
}
}
// Auth check
$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');
}
}
$data['page_title'] = "Search";
$this->load->view('layout/header', $data);
$this->load->view('layout/header', $data);
$this->load->view('search/main');
$this->load->view('layout/footer');
}

Wyświetl plik

@ -0,0 +1,19 @@
<?php
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'));
return $query;
}
}
?>