Basics for a eQSL image download page
这个提交包含在:
		
							父节点
							
								
									21562bffc4
								
							
						
					
					
						当前提交
						c317a63236
					
				
					共有  6 个文件被更改,包括 89 次插入 和 3 次删除
				
			
		|  | @ -552,6 +552,48 @@ class eqsl extends CI_Controller { | |||
| 		$this->load->view('interface_assets/footer'); | ||||
| 	} | ||||
| 
 | ||||
| 	public function download() { | ||||
| 		// Check logged in
 | ||||
| 		$this->load->model('user_model'); | ||||
| 		if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } | ||||
| 
 | ||||
| 		$data['page_title'] = "eQSL Card Image Download"; | ||||
| 		$this->load->model('eqslmethods_model'); | ||||
| 
 | ||||
| 		$rows = ''; | ||||
| 		$qslsnotdownloaded = $this->eqslmethods_model->eqsl_not_yet_downloaded(); | ||||
| 
 | ||||
| 		foreach ($qslsnotdownloaded->result_array() as $qsl) { | ||||
| 			$rows .= "<tr>"; | ||||
| 			// eQSL username changes for linked account.
 | ||||
| 			// i.e. when operating /P it must be callsign/p
 | ||||
| 			// the password, however, is always the same as the main account
 | ||||
| 			$data['user_eqsl_name'] = $qsl['station_callsign']; | ||||
| 			$adif = $this->generateAdif($qsl, $data); | ||||
| 			 | ||||
| 			$status = $this->uploadQso($adif, $qsl); | ||||
| 			 | ||||
| 			$timestamp = strtotime($qsl['COL_TIME_ON']); | ||||
| 			$rows .= "<td>".date($custom_date_format, $timestamp)."</td>"; | ||||
| 			$rows .= "<td>".date('H:i', $timestamp)."</td>"; | ||||
| 			$rows .= "<td>".str_replace("0","Ø",$qsl['COL_CALL'])."</td>"; | ||||
| 			$rows .= "<td>".$qsl['COL_MODE']."</td>"; | ||||
| 			if(isset($qsl['COL_SUBMODE'])) { | ||||
| 				$rows .= "<td>".$qsl['COL_SUBMODE']."</td>"; | ||||
| 			} else { | ||||
| 				$rows .= "<td></td>"; | ||||
| 			} | ||||
| 			$rows .= "<td>".$qsl['COL_BAND']."</td>"; | ||||
| 			$rows .= "<td>".$status."</td>"; | ||||
| 		} | ||||
| 		$rows .= "</tr>"; | ||||
| 		$data['eqsl_table'] = $this->generateResultTable($custom_date_format, $rows); | ||||
| 		// Load frontend
 | ||||
| 		$this->load->view('interface_assets/header', $data); | ||||
| 		$this->load->view('eqsl/download'); | ||||
| 		$this->load->view('interface_assets/footer'); | ||||
| 	} | ||||
| 
 | ||||
| 	public function mark_all_sent() { | ||||
| 		// Check logged in
 | ||||
| 		$this->load->model('user_model'); | ||||
|  |  | |||
|  | @ -67,6 +67,37 @@ class Eqslmethods_model extends CI_Model { | |||
|         return $this->db->get(); | ||||
|     } | ||||
| 
 | ||||
|     // Show all QSOs whose eQSL card images we did not download yet
 | ||||
|     function eqsl_not_yet_downloaded($userid = null) { | ||||
|         $CI =& get_instance(); | ||||
|         if ($userid == null) { | ||||
|             $CI->load->model('logbooks_model'); | ||||
|             $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); | ||||
|         } else { | ||||
|             $stations = $this->get_all_user_locations($userid); | ||||
|             $logbooks_locations_array = array(); | ||||
|             foreach ($stations->result() as $row) { | ||||
|                 array_push($logbooks_locations_array, $row->station_id); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         $this->db->select('station_profile.*, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_COMMENT, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_PROP_MODE, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_SAT_MODE, '.$this->config->item('table_name').'.COL_QSLMSG'); | ||||
|         $this->db->from('station_profile'); | ||||
|         $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); | ||||
|         $this->db->where("coalesce(station_profile.eqslqthnickname, '') <> ''"); | ||||
|         $this->db->where($this->config->item('table_name').'.COL_CALL !=', ''); | ||||
|         $this->db->group_start(); | ||||
|         $this->db->where($this->config->item('table_name').'.COL_EQSL_QSL_SENT is null'); | ||||
|         $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', ''); | ||||
|         $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'R'); | ||||
|         $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'Q'); | ||||
|         $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'N'); | ||||
|         $this->db->group_end(); | ||||
|         $this->db->where_in('station_profile.station_id', $logbooks_locations_array); | ||||
| 
 | ||||
|         return $this->db->get(); | ||||
|     } | ||||
| 
 | ||||
|     // Mark the QSO as sent to eQSL
 | ||||
|     function eqsl_mark_sent($primarykey) { | ||||
|         $data = array( | ||||
|  |  | |||
|  | @ -16,6 +16,9 @@ $custom_date_format = $this->session->userdata('user_date_format'); | |||
|       <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/tools');?>">Tools</a> | ||||
|       </li> | ||||
|       <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/download');?>">Download eQSL Images</a> | ||||
|       </li> | ||||
|     </ul> | ||||
|   </div> | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,6 +14,9 @@ | |||
| 	  <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/tools');?>">Tools</a> | ||||
|       </li> | ||||
|       <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/download');?>">Download eQSL Images</a> | ||||
|       </li> | ||||
|     </ul> | ||||
|   </div> | ||||
| 
 | ||||
|  |  | |||
|  | @ -14,6 +14,9 @@ | |||
| 	  <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/tools');?>">Tools</a> | ||||
|       </li> | ||||
|       <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/download');?>">Download eQSL Images</a> | ||||
|       </li> | ||||
|     </ul> | ||||
|   </div> | ||||
|   <div class="card-body"> | ||||
|  |  | |||
|  | @ -15,6 +15,10 @@ | |||
|       <li class="nav-item"> | ||||
|         <a class="nav-link active" href="<?php echo site_url('eqsl/tools');?>">Tools</a> | ||||
|       </li> | ||||
| 
 | ||||
|       <li class="nav-item"> | ||||
|         <a class="nav-link" href="<?php echo site_url('eqsl/download');?>">Download eQSL Images</a> | ||||
|       </li> | ||||
|     </ul> | ||||
|   </div> | ||||
| 
 | ||||
|  |  | |||
		正在加载…
	
		在新工单中引用