From 256a29e25a9f840a60db9238625b49386967adcf Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Fri, 15 Jan 2016 23:15:51 +0000 Subject: [PATCH] added hamqth to name/city/iota --- application/controllers/logbook.php | 38 +++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/application/controllers/logbook.php b/application/controllers/logbook.php index 1ef096b5..c089c077 100644 --- a/application/controllers/logbook.php +++ b/application/controllers/logbook.php @@ -164,13 +164,18 @@ class Logbook extends CI_Controller { $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key')); echo $callbook['city']; - } else { - // Lookup using hamli - $this->load->library('hamli'); + } elseif ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { + // Load the HamQTH library + $this->load->library('hamqth'); - $callbook = $this->hamli->callsign($callsign); + if(!$this->session->userdata('hamqth_session_key')) { + $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); + } + $callbook = $this->hamqth->search($qra, $this->session->userdata('hamqth_session_key')); echo $callbook['city']; + } } @@ -188,6 +193,18 @@ class Logbook extends CI_Controller { $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key')); echo $callbook['iota']; + } elseif ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { + // Load the HamQTH library + $this->load->library('hamqth'); + + if(!$this->session->userdata('hamqth_session_key')) { + $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); + } + + $callbook = $this->hamqth->search($qra, $this->session->userdata('hamqth_session_key')); + echo $callbook['iota']; + } } @@ -212,13 +229,18 @@ class Logbook extends CI_Controller { $callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key')); echo $callbook['name']; - } else { - // Lookup using hamli - $this->load->library('hamli'); + } elseif ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) { + // Load the HamQTH library + $this->load->library('hamqth'); - $callbook = $this->hamli->callsign($callsign); + if(!$this->session->userdata('hamqth_session_key')) { + $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); + } + $callbook = $this->hamqth->search($qra, $this->session->userdata('hamqth_session_key')); echo $callbook['name']; + } } }