[Quick Lookup] Updated code to support station logbooks
这个提交包含在:
		
							父节点
							
								
									88222ca686
								
							
						
					
					
						当前提交
						cad5c1c569
					
				
					共有  3 个文件被更改,包括 19 次插入 和 18 次删除
				
			
		|  | @ -28,12 +28,14 @@ class Lookup extends CI_Controller { | ||||||
| 
 | 
 | ||||||
| 	public function search() { | 	public function search() { | ||||||
| 		$CI =& get_instance(); | 		$CI =& get_instance(); | ||||||
| 		$CI->load->model('Stations'); | 		$CI->load->model('logbooks_model'); | ||||||
| 		$station_id = $CI->Stations->find_active(); | 		$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); | ||||||
|  | 
 | ||||||
|  | 		$location_list = "'".implode("','",$logbooks_locations_array)."'"; | ||||||
| 
 | 
 | ||||||
| 		$this->load->model('lookup_model'); | 		$this->load->model('lookup_model'); | ||||||
| 
 | 
 | ||||||
| 		$data['bands'] = $this->lookup_model->get_Worked_Bands($station_id); | 		$data['bands'] = $this->lookup_model->get_Worked_Bands($location_list); | ||||||
| 
 | 
 | ||||||
| 		$data['type'] = xss_clean($this->input->post('type')); | 		$data['type'] = xss_clean($this->input->post('type')); | ||||||
| 		$data['dxcc'] = xss_clean($this->input->post('dxcc')); | 		$data['dxcc'] = xss_clean($this->input->post('dxcc')); | ||||||
|  | @ -43,7 +45,7 @@ class Lookup extends CI_Controller { | ||||||
| 		$data['iota'] = xss_clean($this->input->post('iota')); | 		$data['iota'] = xss_clean($this->input->post('iota')); | ||||||
| 		$data['cqz']  = xss_clean($this->input->post('cqz')); | 		$data['cqz']  = xss_clean($this->input->post('cqz')); | ||||||
| 		$data['wwff'] = xss_clean($this->input->post('wwff')); | 		$data['wwff'] = xss_clean($this->input->post('wwff')); | ||||||
| 		$data['station_id'] = $station_id; | 		$data['location_list'] = $location_list; | ||||||
| 
 | 
 | ||||||
| 		$data['result'] = $this->lookup_model->getSearchResult($data); | 		$data['result'] = $this->lookup_model->getSearchResult($data); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	function getSearchResult($queryinfo){ | 	function getSearchResult($queryinfo){ | ||||||
| 		$modes = $this->get_worked_modes($queryinfo['station_id']); | 		$modes = $this->get_worked_modes($queryinfo['location_list']); | ||||||
| 
 | 
 | ||||||
| 		return $this->getResultFromDatabase($queryinfo, $modes); | 		return $this->getResultFromDatabase($queryinfo, $modes); | ||||||
| 	} | 	} | ||||||
|  | @ -54,7 +54,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 			case 'dxcc': $sqlquerytypestring .= " and col_dxcc = " . $queryinfo['dxcc']; 																break; | 			case 'dxcc': $sqlquerytypestring .= " and col_dxcc = " . $queryinfo['dxcc']; 																break; | ||||||
| 			case 'iota': $sqlquerytypestring .= " and col_iota = '" . $queryinfo['iota'] . "'"; 														break; | 			case 'iota': $sqlquerytypestring .= " and col_iota = '" . $queryinfo['iota'] . "'"; 														break; | ||||||
| 			case 'grid': $sqlquerytypestring .= " and (col_gridsquare like '%" . $fixedgrid . "%' or col_vucc_grids like '%" . $fixedgrid . "%')" ; 	break; | 			case 'grid': $sqlquerytypestring .= " and (col_gridsquare like '%" . $fixedgrid . "%' or col_vucc_grids like '%" . $fixedgrid . "%')" ; 	break; | ||||||
| 			case 'cqz':  $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; 																break; | 			case 'cqz':  $sqlquerytypestring .= " and col_cqz = " . $queryinfo['cqz']; 																	break; | ||||||
| 			case 'was':  $sqlquerytypestring .= " and col_state = '" . $queryinfo['was'] . "' and COL_DXCC in ('291', '6', '110')";; 					break; | 			case 'was':  $sqlquerytypestring .= " and col_state = '" . $queryinfo['was'] . "' and COL_DXCC in ('291', '6', '110')";; 					break; | ||||||
| 			case 'sota': $sqlquerytypestring .= " and col_sota_ref = '" . $queryinfo['sota'] . "'"; 													break; | 			case 'sota': $sqlquerytypestring .= " and col_sota_ref = '" . $queryinfo['sota'] . "'"; 													break; | ||||||
| 			case 'wwff': $sqlquerytypestring .= " and col_sig = 'WWFF' and col_sig_info = '" . $queryinfo['wwff'] . "'"; 								break; | 			case 'wwff': $sqlquerytypestring .= " and col_sig = 'WWFF' and col_sig_info = '" . $queryinfo['wwff'] . "'"; 								break; | ||||||
|  | @ -70,7 +70,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		// Fetching info for all modes and bands except satellite
 | 		// Fetching info for all modes and bands except satellite
 | ||||||
| 		$sql = "SELECT distinct col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | 		$sql = "SELECT distinct col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " where station_id = " . $queryinfo['station_id']; | 		$sql .= " where station_id in (" . $queryinfo['location_list'] . ")"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " and coalesce(col_submode, '') = ''"; | 		$sql .= " and coalesce(col_submode, '') = ''"; | ||||||
| 
 | 
 | ||||||
|  | @ -83,7 +83,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		// Fetching info for all sub_modes and bands except satellite
 | 		// Fetching info for all sub_modes and bands except satellite
 | ||||||
| 		$sql .= " union SELECT distinct col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | 		$sql .= " union SELECT distinct col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " where station_id = " . $queryinfo['station_id']; | 		$sql .= " where station_id in (" . $queryinfo['location_list'] . ")"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " and coalesce(col_submode, '') <> ''"; | 		$sql .= " and coalesce(col_submode, '') <> ''"; | ||||||
| 
 | 
 | ||||||
|  | @ -96,7 +96,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		// Fetching info for all modes on satellite
 | 		// Fetching info for all modes on satellite
 | ||||||
| 		$sql .= " union SELECT distinct 'SAT' col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | 		$sql .= " union SELECT distinct 'SAT' col_band, lower(col_mode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " where station_id = " . $queryinfo['station_id']; | 		$sql .= " where station_id in (" . $queryinfo['location_list'] . ")"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " and coalesce(col_submode, '') = ''"; | 		$sql .= " and coalesce(col_submode, '') = ''"; | ||||||
| 
 | 
 | ||||||
|  | @ -109,7 +109,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		// Fetching info for all sub_modes on satellite
 | 		// Fetching info for all sub_modes on satellite
 | ||||||
| 		$sql .= " union SELECT distinct 'SAT' col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | 		$sql .= " union SELECT distinct 'SAT' col_band, lower(col_submode) as col_mode FROM " . $this->config->item('table_name') . " thcv"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " where station_id = " . $queryinfo['station_id']; | 		$sql .= " where station_id in (" . $queryinfo['location_list'] . ")"; | ||||||
| 
 | 
 | ||||||
| 		$sql .= " and coalesce(col_submode, '') <> ''"; | 		$sql .= " and coalesce(col_submode, '') <> ''"; | ||||||
| 
 | 
 | ||||||
|  | @ -150,11 +150,11 @@ class Lookup_model extends CI_Model{ | ||||||
| 	/* | 	/* | ||||||
| 	 * Get's the worked bands from the log | 	 * Get's the worked bands from the log | ||||||
| 	 */ | 	 */ | ||||||
| 	function get_worked_bands($station_id) | 	function get_worked_bands($location_list) | ||||||
| 	{ | 	{ | ||||||
| 		// get all worked slots from database
 | 		// get all worked slots from database
 | ||||||
| 		$data = $this->db->query( | 		$data = $this->db->query( | ||||||
| 			"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE != \"SAT\"" | 			"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE != \"SAT\"" | ||||||
| 		); | 		); | ||||||
| 		$worked_slots = array(); | 		$worked_slots = array(); | ||||||
| 		foreach ($data->result() as $row) { | 		foreach ($data->result() as $row) { | ||||||
|  | @ -162,7 +162,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		$SAT_data = $this->db->query( | 		$SAT_data = $this->db->query( | ||||||
| 			"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " AND COL_PROP_MODE = \"SAT\"" | 			"SELECT distinct LOWER(`COL_PROP_MODE`) as `COL_PROP_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") AND COL_PROP_MODE = \"SAT\"" | ||||||
| 		); | 		); | ||||||
| 
 | 
 | ||||||
| 		foreach ($SAT_data->result() as $row) { | 		foreach ($SAT_data->result() as $row) { | ||||||
|  | @ -182,11 +182,11 @@ class Lookup_model extends CI_Model{ | ||||||
| 	/* | 	/* | ||||||
| 	 * Get's the worked modes from the log | 	 * Get's the worked modes from the log | ||||||
| 	 */ | 	 */ | ||||||
| 	function get_worked_modes($station_id) | 	function get_worked_modes($location_list) | ||||||
| 	{ | 	{ | ||||||
| 		// get all worked modes from database
 | 		// get all worked modes from database
 | ||||||
| 		$data = $this->db->query( | 		$data = $this->db->query( | ||||||
| 			"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " order by COL_MODE ASC" | 			"SELECT distinct LOWER(`COL_MODE`) as `COL_MODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") order by COL_MODE ASC" | ||||||
| 		); | 		); | ||||||
| 		$results = array(); | 		$results = array(); | ||||||
| 		foreach ($data->result() as $row) { | 		foreach ($data->result() as $row) { | ||||||
|  | @ -194,7 +194,7 @@ class Lookup_model extends CI_Model{ | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		$data = $this->db->query( | 		$data = $this->db->query( | ||||||
| 			"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id = " . $station_id . " and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC" | 			"SELECT distinct LOWER(`COL_SUBMODE`) as `COL_SUBMODE` FROM `" . $this->config->item('table_name') . "` WHERE station_id in (" . $location_list . ") and coalesce(COL_SUBMODE, '') <> '' order by COL_SUBMODE ASC" | ||||||
| 		); | 		); | ||||||
| 		foreach ($data->result() as $row) { | 		foreach ($data->result() as $row) { | ||||||
| 			if (!in_array($row, $results)) { | 			if (!in_array($row, $results)) { | ||||||
|  |  | ||||||
|  | @ -154,9 +154,8 @@ $('[data-fancybox]').fancybox({ | ||||||
|     } |     } | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| // Here we capture ALT-L to invoice the Quick lookup
 | // Here we capture ALT-L to invoke the Quick lookup
 | ||||||
| document.onkeyup = function(e) { | document.onkeyup = function(e) { | ||||||
| 	// ALT-W wipe
 |  | ||||||
| 	if (e.altKey && e.which == 76) { | 	if (e.altKey && e.which == 76) { | ||||||
| 		spawnLookupModal(); | 		spawnLookupModal(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用