Added QSL Controller pending functions
这个提交包含在:
		
							父节点
							
								
									3ef6cc917b
								
							
						
					
					
						当前提交
						ada78ec095
					
				
					共有  5 个文件被更改,包括 45 次插入 和 78 次删除
				
			
		|  | @ -54,6 +54,8 @@ class Dashboard extends CI_Controller { | ||||||
| 	function map() { | 	function map() { | ||||||
| 		$this->load->model('logbook_model'); | 		$this->load->model('logbook_model'); | ||||||
| 		 | 		 | ||||||
|  | 		$this->load->library('qra'); | ||||||
|  | 
 | ||||||
| 		//echo date('Y-m-d')
 | 		//echo date('Y-m-d')
 | ||||||
| 		$raw = strtotime('Monday last week'); | 		$raw = strtotime('Monday last week'); | ||||||
| 		 | 		 | ||||||
|  | @ -67,7 +69,7 @@ class Dashboard extends CI_Controller { | ||||||
| 		foreach ($qsos->result() as $row) { | 		foreach ($qsos->result() as $row) { | ||||||
| 			//print_r($row);
 | 			//print_r($row);
 | ||||||
| 			if($row->COL_GRIDSQUARE != null) { | 			if($row->COL_GRIDSQUARE != null) { | ||||||
| 				$stn_loc = qra2latlong($row->COL_GRIDSQUARE); | 				$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE); | ||||||
| 				if($count != 1) { | 				if($count != 1) { | ||||||
| 					echo ","; | 					echo ","; | ||||||
| 				} | 				} | ||||||
|  | @ -102,7 +104,7 @@ class Dashboard extends CI_Controller { | ||||||
| 	 | 	 | ||||||
| 	 | 	 | ||||||
| 	function todays_map() { | 	function todays_map() { | ||||||
| 	 | 		$this->load->library('qra'); | ||||||
| 		$this->load->model('logbook_model'); | 		$this->load->model('logbook_model'); | ||||||
| 		// TODO: Auth
 | 		// TODO: Auth
 | ||||||
| 		$qsos = $this->logbook_model->get_todays_qsos(''); | 		$qsos = $this->logbook_model->get_todays_qsos(''); | ||||||
|  | @ -113,7 +115,7 @@ class Dashboard extends CI_Controller { | ||||||
| 		foreach ($qsos->result() as $row) { | 		foreach ($qsos->result() as $row) { | ||||||
| 			//print_r($row);
 | 			//print_r($row);
 | ||||||
| 			if($row->COL_GRIDSQUARE != null) { | 			if($row->COL_GRIDSQUARE != null) { | ||||||
| 				$stn_loc = qra2latlong($row->COL_GRIDSQUARE); | 				$stn_loc = $this->qra->qra2latlong($row->COL_GRIDSQUARE); | ||||||
| 				echo "{\"point\":new GLatLng(".$stn_loc[0].",".$stn_loc[1]."), \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"},"; | 				echo "{\"point\":new GLatLng(".$stn_loc[0].",".$stn_loc[1]."), \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"},"; | ||||||
| 			} else { | 			} else { | ||||||
| 				$query = $this->db->query(' | 				$query = $this->db->query(' | ||||||
|  | @ -136,73 +138,3 @@ class Dashboard extends CI_Controller { | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| } | } | ||||||
| 
 |  | ||||||
| function distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') { |  | ||||||
|   $theta = $lon1 - $lon2; |  | ||||||
|   $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * |  | ||||||
| cos(deg2rad($theta)); |  | ||||||
|   $dist = acos($dist); |  | ||||||
|   $dist = rad2deg($dist); |  | ||||||
|   $dist = $dist * 60 * 1.1515; |  | ||||||
| 
 |  | ||||||
|   if ($unit == "K") { |  | ||||||
| 	$dist *= 1.609344; |  | ||||||
|   } else if ($unit == "N") { |  | ||||||
| 	$dist *= 0.8684; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   return round($dist, 1); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function bearing($lat1, $lon1, $lat2, $lon2) { |  | ||||||
|   if (round($lon1, 1) == round($lon2, 1)) { |  | ||||||
| 	if ($lat1 < $lat2) { |  | ||||||
| 	  $bearing = 0; |  | ||||||
| 	} else { |  | ||||||
| 	  $bearing = 180; |  | ||||||
| 	} |  | ||||||
|   } else { |  | ||||||
| 	$dist = distance($lat1, $lon1, $lat2, $lon2, 'N'); |  | ||||||
| 	$arad = acos((sin(deg2rad($lat2)) - sin(deg2rad($lat1)) * cos(deg2rad($dist / 60))) / (sin(deg2rad($dist |  | ||||||
| / 60)) * cos(deg2rad($lat1)))); |  | ||||||
| 	$bearing = $arad * 180 / pi(); |  | ||||||
| 	if (sin(deg2rad($lon2 - $lon1)) < 0) { |  | ||||||
| 	  $bearing = 360 - $bearing; |  | ||||||
| 	} |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   $dirs = array("N","E","S","W"); |  | ||||||
| 
 |  | ||||||
|   $rounded = round($bearing / 22.5) % 16; |  | ||||||
|   if (($rounded % 4) == 0) { |  | ||||||
| 	$dir = $dirs[$rounded / 4]; |  | ||||||
|   } else { |  | ||||||
| 	$dir = $dirs[2 * floor(((floor($rounded / 4) + 1) % 4) / 2)]; |  | ||||||
| 	$dir .= $dirs[1 + 2 * floor($rounded / 8)]; |  | ||||||
| 	#if ($rounded % 2 == 1)
 |  | ||||||
| 	#  $dir = $dirs[round_to_int($rounded/4) % 4] . "-" . $dir;
 |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   #return $dir;
 |  | ||||||
|   return round($bearing, 0)."º ".$dir." ".$dist." miles"; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function qra2latlong($strQRA) |  | ||||||
| 
 |  | ||||||
| { |  | ||||||
| 		$strQRA = strtoupper($strQRA); |  | ||||||
| 		if (strlen($strQRA) == 4)  $strQRA .= "MM"; |  | ||||||
| 		if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}$/',$strQRA)) return false; |  | ||||||
| 		list($a,$b,$c,$d,$e,$f) = str_split($strQRA,1); |  | ||||||
| 		$a = ord($a) - ord('A'); |  | ||||||
| 		$b = ord($b) - ord('A'); |  | ||||||
| 		$c = ord($c) - ord('0'); |  | ||||||
| 		$d = ord($d) - ord('0'); |  | ||||||
| 		$e = ord($e) - ord('A'); |  | ||||||
| 		$f = ord($f) - ord('A'); |  | ||||||
| 		$nLong = ($a*20) + ($c*2) + (($e+0.5)/12) - 180; |  | ||||||
| 		$nLat = ($b*10) + $d + (($f+0.5)/24) - 90; |  | ||||||
| 		$arLatLong = array($nLat,$nLong); |  | ||||||
| 		return($arLatLong); |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								application/controllers/qsl.php
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										18
									
								
								application/controllers/qsl.php
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||||||
|  | 
 | ||||||
|  | /*  | ||||||
|  | 
 | ||||||
|  | 	Handles all functions todo with QSLing. | ||||||
|  | 
 | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | class qsl extends CI_Controller { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 	public function index() | ||||||
|  | 	{ | ||||||
|  | 		$this->load->view('layout/header'); | ||||||
|  | 		$this->load->view('qsl/main'); | ||||||
|  | 		$this->load->view('layout/footer'); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | @ -161,6 +161,7 @@ | ||||||
| 			<?php } ?>
 | 			<?php } ?>
 | ||||||
| 			<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE){ ?>
 | 			<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE){ ?>
 | ||||||
| 			<li><a href="<?php echo site_url('notes');?>" title="Notes">Notes</a></li> | 			<li><a href="<?php echo site_url('notes');?>" title="Notes">Notes</a></li> | ||||||
|  | 			<li><a href="<?php echo site_url('qsl');?>" title="Notes">QSLing</a></li> | ||||||
| 			<?php } ?>
 | 			<?php } ?>
 | ||||||
| 			<li><a href="<?php echo site_url('statistics');?>" title="Statistics">Statistics</a></li> | 			<li><a href="<?php echo site_url('statistics');?>" title="Statistics">Statistics</a></li> | ||||||
| 			<?php if(($this->config->item('use_auth') && $this->session->userdata('user_type') >= 99) || $this->config->item('use_auth') === FALSE) { ?>
 | 			<?php if(($this->config->item('use_auth') && $this->session->userdata('user_type') >= 99) || $this->config->item('use_auth') === FALSE) { ?>
 | ||||||
|  | @ -220,4 +221,12 @@ | ||||||
| 		</ul> | 		</ul> | ||||||
| 	</div> | 	</div> | ||||||
| 	<?php } ?>
 | 	<?php } ?>
 | ||||||
|  | 
 | ||||||
|  | 	<?php if($this->uri->segment(1) == "qsl") { ?>
 | ||||||
|  | 	<div id="subnav"> | ||||||
|  | 		<ul id="sublist"> | ||||||
|  | 			<li class="ui-corner-all"><a href="<?php echo site_url('qsl/print');?>" title="Print QSL Labels">Print Labels</a></li> | ||||||
|  | 		</ul> | ||||||
|  | 	</div> | ||||||
|  | 	<?php } ?>
 | ||||||
| <div id="clear" class="clear"></div> | <div id="clear" class="clear"></div> | ||||||
|  |  | ||||||
|  | @ -0,0 +1,6 @@ | ||||||
|  | <h2>QSLing</h2> | ||||||
|  | <div class="wrap_content note"> | ||||||
|  | 
 | ||||||
|  | <p>QSLing functions.</p> | ||||||
|  | 
 | ||||||
|  | </div> | ||||||
|  | @ -44,6 +44,12 @@ | ||||||
| 	}, | 	}, | ||||||
| 	"file_history": | 	"file_history": | ||||||
| 	[ | 	[ | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/view_log/qso.php", | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/logbook.php", | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/models/logbook_model.php", | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/dashboard.php", | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/view_log/index.php", | ||||||
|  | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/dashboard/index.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/backup.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/backup.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/layout/header.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/layout/header.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/backup/notes_view.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/backup/notes_view.php", | ||||||
|  | @ -58,14 +64,10 @@ | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/adif.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/adif.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/config/config.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/config/config.php", | ||||||
| 		"/C/Users/Peter/Desktop/log.kml", | 		"/C/Users/Peter/Desktop/log.kml", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/models/logbook_model.php", |  | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/dashboard.php", |  | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/view_log/qso.php", |  | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/config/routes.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/config/routes.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/social/map.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/social/map.php", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/social.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/application/controllers/social.php", | ||||||
| 		"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Default (Windows).sublime-keymap", | 		"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/User/Default (Windows).sublime-keymap", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/application/views/dashboard/index.php", |  | ||||||
| 		"/C/wamp/www/m3php/data.html", | 		"/C/wamp/www/m3php/data.html", | ||||||
| 		"/C/Users/Peter/git/HRD-Web-Frontend/index.php", | 		"/C/Users/Peter/git/HRD-Web-Frontend/index.php", | ||||||
| 		"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/Default/Base File.sublime-settings", | 		"/C/Users/Peter/AppData/Roaming/Sublime Text 2/Packages/Default/Base File.sublime-settings", | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用