HamQTH Lookup for search
这个提交包含在:
		
							父节点
							
								
									1a524b8bb2
								
							
						
					
					
						当前提交
						e8bfe6ed7f
					
				
					共有  2 个文件被更改,包括 27 次插入 和 2 次删除
				
			
		|  | @ -937,8 +937,33 @@ function worked_grid_before($gridsquare, $type, $band, $mode) | ||||||
| 						if (isset($data['callsign']['error'])) { | 						if (isset($data['callsign']['error'])) { | ||||||
| 							$data['error'] = $data['callsign']['error']; | 							$data['error'] = $data['callsign']['error']; | ||||||
| 						} | 						} | ||||||
|  | 					} else if ($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); | ||||||
|  | 						} | ||||||
|  | 
 | ||||||
|  | 						$data['callsign'] = $this->hamqth->search($id, $this->session->userdata('hamqth_session_key')); | ||||||
|  | 
 | ||||||
|  | 						// If HamQTH session has expired, start a new session and retry the search.
 | ||||||
|  | 						if($data['callsign']['error'] == "Session does not exist or expired") { | ||||||
|  | 							$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); | ||||||
|  | 							$data['callsign'] = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key')); | ||||||
|  | 						} | ||||||
|  | 						if (isset($data['callsign']['gridsquare'])) { | ||||||
|  | 							$CI = &get_instance(); | ||||||
|  | 							$CI->load->model('logbook_model'); | ||||||
|  | 							$data['grid_worked'] = $CI->logbook_model->check_if_grid_worked_in_logbook(strtoupper(substr($data['callsign']['gridsquare'],0,4)), 0, $this->session->userdata('user_default_band')); | ||||||
|  | 						} | ||||||
|  | 						if (isset($data['callsign']['error'])) { | ||||||
|  | 							$data['error'] = $data['callsign']['error']; | ||||||
|  | 						} | ||||||
| 					} else { | 					} else { | ||||||
| 						$data['error'] = 'Lookup not configured or set to hamqth. Currently only qrz is supported.'; | 						$data['error'] = 'Lookup not configured. Please review configuration.'; | ||||||
| 					} /*else { | 					} /*else { | ||||||
| 						// Lookup using hamli
 | 						// Lookup using hamli
 | ||||||
| 						$this->load->library('hamli'); | 						$this->load->library('hamli'); | ||||||
|  |  | ||||||
|  | @ -71,7 +71,7 @@ class Hamqth { | ||||||
| 
 | 
 | ||||||
|             // Create XML object
 |             // Create XML object
 | ||||||
|             $xml = simplexml_load_string($xml); |             $xml = simplexml_load_string($xml); | ||||||
|             if (empty($xml)) return; |             if (!empty($xml->session->error)) return $data['error'] = $xml->session->error; | ||||||
| 
 | 
 | ||||||
|             // Return Required Fields
 |             // Return Required Fields
 | ||||||
|             $data['callsign'] = (string)$xml->search->callsign; |             $data['callsign'] = (string)$xml->search->callsign; | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用