kopia lustrzana https://github.com/magicbug/Cloudlog
				
				
				
			Refactor table and add View/Download button
							rodzic
							
								
									9d77d199b4
								
							
						
					
					
						commit
						322085d2f6
					
				|  | @ -558,39 +558,11 @@ class eqsl extends CI_Controller { | |||
| 		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"; | ||||
| 		$custom_date_format = $this->session->userdata('user_date_format'); | ||||
| 		$this->load->model('eqslmethods_model'); | ||||
| 
 | ||||
| 		$rows = ''; | ||||
| 		$qslsnotdownloaded = $this->eqslmethods_model->eqsl_not_yet_downloaded(); | ||||
| 		$data['custom_date_format'] = $this->session->userdata('user_date_format'); | ||||
| 		$data['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);
 | ||||
| 			$status = "none"; | ||||
| 			 | ||||
| 			$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'); | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ class Eqslmethods_model extends CI_Model { | |||
|             } | ||||
|         } | ||||
| 
 | ||||
|         $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, eQSL_images.*'); | ||||
|         $this->db->select('station_profile.station_id, '.$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_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, eQSL_images.qso_id'); | ||||
|         $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->join('eQSL_images','eQSL_images.qso_id = '.$this->config->item('table_name').'.COL_PRIMARY_KEY','left outer'); | ||||
|  | @ -91,10 +91,7 @@ class Eqslmethods_model extends CI_Model { | |||
|         $this->db->where('qso_id', NULL); | ||||
|         $this->db->where_in('station_profile.station_id', $logbooks_locations_array); | ||||
| 
 | ||||
|         $result = $this->db->get(); | ||||
|         log_message('info','SQL: '.$this->db->last_query()); | ||||
|         return $result; | ||||
|         //return $this->db->get();
 | ||||
|         return $this->db->get(); | ||||
|     } | ||||
| 
 | ||||
|     // Mark the QSO as sent to eQSL
 | ||||
|  |  | |||
|  | @ -24,31 +24,44 @@ | |||
|   <?php $this->load->view('layout/messages'); ?>
 | ||||
| 
 | ||||
| <?php | ||||
| 	if (isset($eqsl_table)) | ||||
| 	{ | ||||
|    if (! empty($qslsnotdownloaded->result())) { | ||||
| ?>
 | ||||
|     	<p>Below is a table of QSOs that have been confirmed on eQSL but QSL images have not been downloaded yet.</p> | ||||
| 
 | ||||
|     	<!--<p><span class="badge badge-info">Info</span> Please make sure the "eQSL QTH Nickname" field is set in your station profile and that the value matches the QTH Nickname you set within eQSL.</p>--> | ||||
|  <?php | ||||
| 
 | ||||
|     	echo $eqsl_table; | ||||
|     	echo "<p>Clicking \"Upload QSOs\" will send QSO information to eQSL.cc.</p>"; | ||||
| 		echo form_open('eqsl/export'); | ||||
| 		echo "<input type=\"hidden\" name=\"eqslexport\" id=\"eqslexport\" value=\"export\" />"; | ||||
| 		echo "<input class=\"btn btn-primary\" type=\"submit\" value=\"Upload QSOs\" /></form>"; | ||||
| 		<table = style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center"> | ||||
| 			<thead><tr class="titles"> | ||||
| 				<th>Date</th> | ||||
| 				<th>Time</th> | ||||
| 				<th>Call</th> | ||||
| 				<th>Mode</th> | ||||
| 				<th>Submode</th> | ||||
| 				<th>Band</th> | ||||
| 				<th>Action</th> | ||||
| 			</tr></thead><tbody> | ||||
| <?php | ||||
| foreach ($qslsnotdownloaded->result_array() as $qsl) { | ||||
| 	echo "<tr>"; | ||||
| 	$timestamp = strtotime($qsl['COL_TIME_ON']); | ||||
| 	echo "<td>".date($custom_date_format, $timestamp)."</td>"; | ||||
| 	echo "<td>".date('H:i', $timestamp)."</td>"; | ||||
| 	echo "<td>".str_replace("0","Ø",$qsl['COL_CALL'])."</td>"; | ||||
| 	echo "<td>".$qsl['COL_MODE']."</td>"; | ||||
| 	if(isset($qsl['COL_SUBMODE'])) { | ||||
| 		echo "<td>".$qsl['COL_SUBMODE']."</td>"; | ||||
| 	} else { | ||||
| 		echo "<td></td>"; | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 		if (isset($eqsl_results_table)) | ||||
| 		{ | ||||
| 			echo "<p>The following QSOs were sent to eQSL.</p>"; | ||||
| 			echo $eqsl_results_table; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			echo "<p>There are no QSOs whose eQSL card images have not yet been downloaded. Go log some more QSOs!</p>"; | ||||
| 		} | ||||
| 	echo "<td>".$qsl['COL_BAND']."</td>"; | ||||
| 	echo "<td><a href=\"".site_url()."/eqsl/image/".$qsl['COL_PRIMARY_KEY']."\" data-fancybox=\"images\" data-width=\"528\" data-height=\"336\" class=\"btn btn-primary btn-sm\">View/Download</a></td>"; | ||||
| } | ||||
| 	echo "</tr>"; | ||||
| ?>
 | ||||
| 		</tbody></table> | ||||
| 
 | ||||
| <?php | ||||
| 	} else { | ||||
| 		echo "<p>There are no QSOs whose eQSL card images have not yet been downloaded. Go log some more QSOs!</p>"; | ||||
| 	} | ||||
| ?>
 | ||||
| </div> | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 phl0
						phl0