[Award] SIG added to awards. Based on the work by @daccle.
这个提交包含在:
		
							父节点
							
								
									7ad66ef669
								
							
						
					
					
						当前提交
						ebc4ac0c4b
					
				
					共有  6 个文件被更改,包括 191 次插入 和 16 次删除
				
			
		|  | @ -477,4 +477,54 @@ class Awards extends CI_Controller { | ||||||
|         $data['filter'] = "county " . $state; |         $data['filter'] = "county " . $state; | ||||||
|         $this->load->view('awards/details', $data); |         $this->load->view('awards/details', $data); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  | 	/* | ||||||
|  | 		Handles showing worked Sigs | ||||||
|  | 		Adif fields: my_sig | ||||||
|  | 	*/ | ||||||
|  | 	public function sig() { | ||||||
|  | 		// Grab all worked sig stations
 | ||||||
|  | 		$this->load->model('sig'); | ||||||
|  | 
 | ||||||
|  | 		$data['sig_types'] = $this->sig->get_all_sig_types(); | ||||||
|  | 
 | ||||||
|  | 		// Render page
 | ||||||
|  | 		$data['page_title'] = "Awards - SIG"; | ||||||
|  | 		$this->load->view('interface_assets/header', $data); | ||||||
|  | 		$this->load->view('awards/sig/index'); | ||||||
|  | 		$this->load->view('interface_assets/footer'); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/* | ||||||
|  | 	Handles showing worked Sigs | ||||||
|  | 	*/ | ||||||
|  | 	public function sig_details() { | ||||||
|  | 
 | ||||||
|  | 		// Grab all worked sig stations
 | ||||||
|  | 		$this->load->model('sig'); | ||||||
|  | 		$type = str_replace('"', "", $this->input->get("type")); | ||||||
|  | 		$data['sig_all'] = $this->sig->get_all($type); | ||||||
|  | 		$data['type'] = $type; | ||||||
|  | 
 | ||||||
|  | 		// Render page
 | ||||||
|  | 		$data['page_title'] = "Awards - SIG - " . $type; | ||||||
|  | 		$this->load->view('interface_assets/header', $data); | ||||||
|  | 		$this->load->view('awards/sig/qso_list'); | ||||||
|  | 		$this->load->view('interface_assets/footer'); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/* | ||||||
|  | 	Handles exporting SIGS to ADIF | ||||||
|  | 	*/ | ||||||
|  | 	public function sigexportadif() { | ||||||
|  | 		// Set memory limit to unlimited to allow heavy usage
 | ||||||
|  | 		ini_set('memory_limit', '-1'); | ||||||
|  | 
 | ||||||
|  | 		$this->load->model('adif_data'); | ||||||
|  | 		//$type = str_replace('"', "", $this->input->get("type"));
 | ||||||
|  | 		$type = $this->uri->segment(3); | ||||||
|  | 		$data['qsos'] = $this->adif_data->sig_all($type); | ||||||
|  | 
 | ||||||
|  | 		$this->load->view('adif/data/exportsat', $data); | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -121,6 +121,22 @@ class adif_data extends CI_Model { | ||||||
|     	$this->db->where('COL_PRIMARY_KEY', $id); |     	$this->db->where('COL_PRIMARY_KEY', $id); | ||||||
|     	$this->db->update($this->config->item('table_name'), $data); |     	$this->db->update($this->config->item('table_name'), $data); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  | 	function sig_all($type) { | ||||||
|  | 		$this->load->model('stations'); | ||||||
|  | 		$active_station_id = $this->stations->find_active(); | ||||||
|  | 
 | ||||||
|  | 		$this->db->select(''.$this->config->item('table_name').'.*, station_profile.*'); | ||||||
|  | 		$this->db->from($this->config->item('table_name')); | ||||||
|  | 		$this->db->where($this->config->item('table_name').'.station_id', $active_station_id); | ||||||
|  | 		$this->db->where($this->config->item('table_name').'.COL_SIG', $type); | ||||||
|  | 
 | ||||||
|  | 		$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC"); | ||||||
|  | 
 | ||||||
|  | 		$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); | ||||||
|  | 
 | ||||||
|  | 		return $this->db->get(); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ?>
 | ?>
 | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								application/models/Sig.php
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										40
									
								
								application/models/Sig.php
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,40 @@ | ||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | class Sig extends CI_Model { | ||||||
|  | 
 | ||||||
|  | 	function __construct() | ||||||
|  | 	{ | ||||||
|  | 		parent::__construct(); | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	function get_all($type) { | ||||||
|  | 		$CI =& get_instance(); | ||||||
|  |       	$CI->load->model('Stations'); | ||||||
|  |       	$station_id = $CI->Stations->find_active(); | ||||||
|  | 
 | ||||||
|  | 		$this->db->where("station_id", $station_id); | ||||||
|  | 		$this->db->order_by("COL_SIG_INFO", "ASC"); | ||||||
|  | 		$this->db->where('COL_SIG =', $type); | ||||||
|  | 		 | ||||||
|  | 		return $this->db->get($this->config->item('table_name')); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  |     function get_all_sig_types() { | ||||||
|  |         $CI =& get_instance(); | ||||||
|  |         $CI->load->model('Stations'); | ||||||
|  |         $station_id = $CI->Stations->find_active(); | ||||||
|  | 
 | ||||||
|  |         $sql = "select col_sig, count(*) qsos, count(distinct col_sig_info) refs from " . $this->config->item('table_name') . | ||||||
|  |                 " where col_sig <> ''" . | ||||||
|  |                 " and station_id = " . $station_id . | ||||||
|  |                 " group by col_sig"; | ||||||
|  | 
 | ||||||
|  |         $query = $this->db->query($sql); | ||||||
|  | 
 | ||||||
|  |         return $query->result(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ?>
 | ||||||
|  | @ -0,0 +1,35 @@ | ||||||
|  | <div class="container"> | ||||||
|  | <h2><?php echo $page_title; ?></h2>
 | ||||||
|  | 
 | ||||||
|  | <?php if ($sig_types) { ?>
 | ||||||
|  |     <table style="width:100%" class="table-sm table tabledxcc table-bordered table-hover table-striped table-condensed text-center"> | ||||||
|  | 
 | ||||||
|  | 	<tr> | ||||||
|  | 		<td>Award Type</td> | ||||||
|  |         <td># QSOs</td>
 | ||||||
|  |         <td># Refs</td>
 | ||||||
|  |     </tr> | ||||||
|  | 
 | ||||||
|  |     <?php | ||||||
|  |     foreach ($sig_types as $row) { | ||||||
|  | 	?>
 | ||||||
|  | 
 | ||||||
|  |     <tr> | ||||||
|  | 		<td> | ||||||
|  | 			<?php echo $row->col_sig; ?>
 | ||||||
|  | 		</td> | ||||||
|  |         <td> | ||||||
|  |             <a href='sig_details?type="<?php echo $row->col_sig; ?>"'><?php echo $row->qsos; ?></a>
 | ||||||
|  |         </td> | ||||||
|  |         <td> | ||||||
|  |             <a href='sig_details?type="<?php echo $row->col_sig; ?>"'><?php echo $row->refs; ?></a>
 | ||||||
|  |         </td> | ||||||
|  | 	</tr> | ||||||
|  |     <?php } ?>
 | ||||||
|  | 	</table> | ||||||
|  | <?php } | ||||||
|  | else { | ||||||
|  |     echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>'; | ||||||
|  | } | ||||||
|  | ?>
 | ||||||
|  | </div> | ||||||
|  | @ -0,0 +1,32 @@ | ||||||
|  | <div class="container"> | ||||||
|  |     <h2><?php echo $page_title; ?></h2>
 | ||||||
|  | 
 | ||||||
|  |     <?php if ($sig_all) { ?>
 | ||||||
|  | 
 | ||||||
|  |     <table class="table table-sm table-striped table-hover"> | ||||||
|  | 
 | ||||||
|  |         <tr> | ||||||
|  |             <td>Reference</td> | ||||||
|  |             <td>Date/Time</td> | ||||||
|  |             <td>Callsign</td> | ||||||
|  |             <td>Band</td> | ||||||
|  |             <td>RST Sent</td> | ||||||
|  |             <td>RST Received</td> | ||||||
|  |         </tr> | ||||||
|  |         <?php foreach ($sig_all->result() as $row) { ?>
 | ||||||
|  |             <tr> | ||||||
|  |                 <td> | ||||||
|  |                     <?php echo $row->COL_SIG_INFO; ?>
 | ||||||
|  |                 </td> | ||||||
|  |                 <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - <?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
 | ||||||
|  |                 <td><?php echo $row->COL_CALL; ?></td>
 | ||||||
|  |                 <td><?php echo $row->COL_BAND; ?></td>
 | ||||||
|  |                 <td><?php echo $row->COL_RST_SENT; ?></td>
 | ||||||
|  |                 <td><?php echo $row->COL_RST_RCVD; ?></td>
 | ||||||
|  |             </tr> | ||||||
|  |                 <?php } ?>
 | ||||||
|  | 
 | ||||||
|  |     </table> | ||||||
|  |     <?php } ?>
 | ||||||
|  |     <p><a href="<?php echo site_url('/awards/sigexportadif/' . $type); ?>" title="Export QSOs to ADIF" target="_blank" class="btn btn-primary">Export QSOs to ADIF</a></p> | ||||||
|  | </div> | ||||||
|  | @ -106,7 +106,9 @@ | ||||||
|                     <a class="dropdown-item" href="<?php echo site_url('awards/dxcc');?>">DXCC</a> |                     <a class="dropdown-item" href="<?php echo site_url('awards/dxcc');?>">DXCC</a> | ||||||
|                     <div class="dropdown-divider"></div> |                     <div class="dropdown-divider"></div> | ||||||
|                     <a class="dropdown-item" href="<?php echo site_url('awards/iota');?>">IOTA</a> |                     <a class="dropdown-item" href="<?php echo site_url('awards/iota');?>">IOTA</a> | ||||||
|                     <div class="dropdown-divider"></div> | 					<div class="dropdown-divider"></div> | ||||||
|  | 					<a class="dropdown-item" href="<?php echo site_url('awards/sig');?>">SIG</a> | ||||||
|  | 					<div class="dropdown-divider"></div> | ||||||
|                     <a class="dropdown-item" href="<?php echo site_url('awards/sota');?>">SOTA</a> |                     <a class="dropdown-item" href="<?php echo site_url('awards/sota');?>">SOTA</a> | ||||||
|                     <div class="dropdown-divider"></div> |                     <div class="dropdown-divider"></div> | ||||||
|                     <a class="dropdown-item" href="<?php echo site_url('awards/counties');?>">US Counties</a> |                     <a class="dropdown-item" href="<?php echo site_url('awards/counties');?>">US Counties</a> | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用