| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DXCC extends CI_Model { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	function __construct() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		// Call the Model constructor
 | 
					
						
							|  |  |  | 		parent::__construct(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	*	Function: mostactive | 
					
						
							|  |  |  | 	*	Information: Returns the most active band | 
					
						
							|  |  |  | 	**/ | 
					
						
							|  |  |  | 	function info($callsign) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		$exceptions = $this->db->query(' | 
					
						
							|  |  |  | 				SELECT * | 
					
						
							|  |  |  | 				FROM `dxccexceptions` | 
					
						
							|  |  |  | 				WHERE `prefix` = \''.$callsign.'\' | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 				LIMIT 1 | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 			'); | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 		if ($exceptions->num_rows() > 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			return $exceptions; | 
					
						
							|  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 			$query = $this->db->query(' | 
					
						
							|  |  |  | 					SELECT * | 
					
						
							|  |  |  | 					FROM dxcc | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 					WHERE prefix = SUBSTRING( \''.$callsign.'\', 1, LENGTH( prefix ) ) | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 					ORDER BY LENGTH( prefix ) DESC | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 					LIMIT 1 | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 				'); | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | 			return $query; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-20 06:24:10 +08:00
										 |  |  | 	function empty_table($table) { | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | 		$this->db->empty_table($table); | 
					
						
							| 
									
										
										
										
											2012-11-20 06:24:10 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-06-17 20:52:00 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2014-09-26 06:09:44 +08:00
										 |  |  | ?>
 |