Feature: when adding a qso basic freq is calculated from band and mode

pull/106/merge
Peter Goodhall 2011-09-18 12:21:51 +01:00
rodzic c884530e2e
commit 8c500bae00
5 zmienionych plików z 152 dodań i 94 usunięć

Wyświetl plik

@ -97,10 +97,10 @@ class QSO extends CI_Controller {
}
function freq() {
function band_to_freq($band, $mode) {
$this->load->library('frequency');
echo $this->frequency->convent_band('40m', 'SSB');
echo $this->frequency->convent_band($band, $mode);
}
}

Wyświetl plik

@ -2,140 +2,170 @@
class Frequency {
/* Class to convert band and mode into a frequnecy in a format based on the specifications of the database table */
public function convent_band($band, $mode)
{
if($band == "160m") {
if ($mode == "SSB") {
return "1.900";
return "1900000";
}elseif($mode == "CW") {
return "1.830";
}elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "1.838";
return "1830000";
}elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "1838000";
} else {
return "1900000";
}
}
if($band == "80m") {
if ($mode == "CW") {
return "3.550";
}elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "3.583";
return "3550000";
}elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "3583000";
}elseif($mode == "SSB") {
return "3.700";
return "3700000";
} else {
return "3700000";
}
}
if($band == "40m") {
if ($mode == "CW") {
return "7.020";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "7.040";
return "7020000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "7040000";
}elseif($mode == "SSB") {
return "7.100";
return "7100000";
} else {
return "7100000";
}
}
if($band == "30m") {
if ($mode == "CW") {
return "10.120";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "10.145";
return "10120000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "10145000";
} else {
return "10120000";
}
}
if($band == "20m") {
if ($mode == "CW") {
return "14.020";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "14.080";
return "14020000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "14080000";
}elseif($mode == "SSB") {
return "14.200";
}
return "14200000";
} else {
return "14200000";
}
}
if($band == "17m") {
if ($mode == "CW") {
return "18.080";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "18.105";
return "18080000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "18105000";
}elseif($mode == "SSB") {
return "18.130";
return "18130000";
} else {
return "18130000";
}
}
if($band == "15m") {
if ($mode == "CW") {
return "21.020";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "21.080";
return "21020000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "21080000";
}elseif($mode == "SSB") {
return "21.300";
return "21300000";
} else {
return "21300000";
}
}
if($band == "12m") {
if ($mode == "CW") {
return "24.900";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "24.925";
return "24900000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "24925000";
}elseif($mode == "SSB") {
return "24.950";
return "24950000";
}
}
if($band == "10m") {
if ($mode == "CW") {
return "21.050";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "28.120";
return "21050000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "28120000";
}elseif($mode == "SSB") {
return "28.300";
return "28300000";
} else {
return "28300000";
}
}
if($band == "6m") {
if ($mode == "CW") {
return "50.090";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "50.230";
return "50090000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "50230000";
}elseif($mode == "SSB") {
return "50.150";
return "50150000";
} else {
return "50150000";
}
}
if($band == "4m") {
if ($mode == "CW") {
return "70.200";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "70.200";
return "70200000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "70200000";
}elseif($mode == "SSB") {
return "70.200";
return "70200000";
} else {
return "70200000";
}
}
if($band == "2m") {
if ($mode == "CW") {
return "144.050";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "144.370";
return "144.050000";
} elseif($mode == "PSK31" || $mode == "PSK63" || $mode == "RTTY" || $mode == "JT65") {
return "144370000";
}elseif($mode == "SSB") {
return "144.300";
return "144300000";
} else {
return "144300000";
}
}
if($band == "70cm") {
if ($mode == "CW") {
return "432.050";
return "432050000";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "432.088";
return "432088000";
}elseif($mode == "SSB") {
return "432.200";
return "432200000";
} else {
return "432200000";
}
}
if($band == "70cm") {
if ($mode == "CW") {
return "432.050";
return "432050000";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "432.088";
return "432088000";
}elseif($mode == "SSB") {
return "432.200";
return "432200000";
} else {
return "432200000";
}
}
if($band == "23cm") {
if ($mode == "CW") {
return "1296.000";
return "129600000";
} elseif($mode == "PSK31" || $mode == "RTTY" || $mode == "JT65") {
return "1296.138";
return "1296138000";
}elseif($mode == "SSB") {
return "1296.000";
return "1296000000";
} else {
return "1296000000";
}
}

Wyświetl plik

@ -26,7 +26,7 @@ class Logbook_model extends CI_Model {
'COL_TIME_OFF' => $datetime,
'COL_CALL' => strtoupper($this->input->post('callsign')),
'COL_BAND' => $this->input->post('band'),
'COL_FREQ' => $this->input->post('freq'),
'COL_FREQ' => $this->input->post('freq_display'),
'COL_MODE' => $this->input->post('mode'),
'COL_RST_RCVD' => $this->input->post('rst_recv'),
'COL_RST_SENT' => $this->input->post('rst_sent'),

Wyświetl plik

@ -107,13 +107,13 @@ function settime () {
<td><input class="input_date" type="text" name="start_date" value="<?php echo date('d-m-Y'); ?>" size="10" /></td>
<td><input class="input_time" type="text" name="start_time" value="" size="7" /></td>
<td><input size="10" id="callsign" type="text" name="callsign" value="" /></td>
<td><select name="mode">
<td><select name="mode" class="mode">
<option value="SSB" <?php if($this->session->userdata('mode') == "" || $this->session->userdata('mode') == "FM") { echo "selected=\"selected\""; } ?>>SSB</option>
<option value="FM" <?php if($this->session->userdata('mode') == "FM") { echo "selected=\"selected\""; } ?>>FM</option>
<option value="CW" <?php if($this->session->userdata('mode') == "CW") { echo "selected=\"selected\""; } ?>>CW</option>
<option value="RTTY" <?php if($this->session->userdata('mode') == "RTTY") { echo "selected=\"selected\""; } ?>>RTTY</option>
<option value="PSK31" <?php if($this->session->userdata('mode') == "PSK31") { echo "selected=\"selected\""; } ?>>PSK31</option>
<option value="PSK63" <?php if($this->session->userdata('mode') == "PSK63") { echo "selected=\"selected\""; } ?>>PSK31</option>
<option value="PSK63" <?php if($this->session->userdata('mode') == "PSK63") { echo "selected=\"selected\""; } ?>>PSK63</option>
<option value="JT65" <?php if($this->session->userdata('mode') == "JT65") { echo "selected=\"selected\""; } ?>>JT65</option>
<option value="JT65B" <?php if($this->session->userdata('mode') == "JT65B") { echo "selected=\"selected\""; } ?>>JT65B</option>
<option value="JT6M" <?php if($this->session->userdata('mode') == "JT6M") { echo "selected=\"selected\""; } ?>>JT6M</option>
@ -121,7 +121,7 @@ function settime () {
<option value="PKT" <?php if($this->session->userdata('mode') == "PKT") { echo "selected=\"selected\""; } ?>>PKT</option>
</select></td>
<td><select name="band">
<td><select name="band" class="band">
<option value="160m" <?php if($this->session->userdata('band') == "160m") { echo "selected=\"selected\""; } ?>>160m</option>
<option value="80m" <?php if($this->session->userdata('band') == "80m") { echo "selected=\"selected\""; } ?>>80m</option>
<option value="60m" <?php if($this->session->userdata('band') == "60m") { echo "selected=\"selected\""; } ?>>60m</option>
@ -213,12 +213,10 @@ function settime () {
<td>Radio</td>
<td><input type="text" name="equipment" value="" /></td>
</tr>
<?php if($this->config->item('display_freq') == true) { ?>
<tr>
<td>Frequnecy</td>
<td><input type="text" name="freq" value="<?php if($this->session->userdata('freq') != null) { echo $this->session->userdata('freq'); } ?>" /></td>
<td><input type="text" id="frequency" name="freq_display" value="" /></td>
</tr>
<?php } ?>
</table>
</div>
@ -262,37 +260,64 @@ function settime () {
</form>
<script type="text/javascript">
i=0;
$(document).ready(function(){
$("#locator").keyup(function(){
if ($(this).val()) {
$('#locator_info').load("logbook/bearing/" + $(this).val()).fadeIn("slow");
}
});
$("#callsign").keyup(function(){
if ($(this).val()) {
$('#partial_view').load("logbook/partial/" + $(this).val()).fadeIn("slow");
i=0;
$(document).ready(function(){
$.get('logbook/find_dxcc/' + $(this).val(), function(result) {
$('#country').val(result);
});
if($('#locator').val() == "") {
$.get('logbook/callsign_qra/' + $(this).val(), function(result) {
$('#locator').val(result);
});
/* On Page Load */
$('#locator_info').load("logbook/bearing/" + $(this).val()).fadeIn("slow");
}
$.get('logbook/callsign_name/' + $(this).val(), function(result) {
$('#name').val(result);
$.get('qso/band_to_freq/' + $('.band').val() + '/' + $('.mode').val(), function(result) {
$('#frequency').val(result);
});
/* Calculate Frequency */
/* on band change */
$('.band').change(function() {
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function(result) {
$('#frequency').val(result);
});
});
/* on mode change */
$('.mode').change(function() {
$.get('qso/band_to_freq/' + $('.band').val() + '/' + $('.mode').val(), function(result) {
$('#frequency').val(result);
});
});
/* On Key up Calculate Bearing and Distance */
$("#locator").keyup(function(){
if ($(this).val()) {
$('#locator_info').load("logbook/bearing/" + $(this).val()).fadeIn("slow");
}
});
}
});
});
/* On Callsign Change */
$("#callsign").keyup(function(){
if ($(this).val()) {
/* Find Callsign Matches */
$('#partial_view').load("logbook/partial/" + $(this).val()).fadeIn("slow");
/* Find and populate DXCC */
$.get('logbook/find_dxcc/' + $(this).val(), function(result) {
$('#country').val(result);
});
/* Find Locator if the field is empty */
if($('#locator').val() == "") {
$.get('logbook/callsign_qra/' + $(this).val(), function(result) {
$('#locator').val(result);
});
$('#locator_info').load("logbook/bearing/" + $(this).val()).fadeIn("slow");
}
/* Find Operators Name */
$.get('logbook/callsign_name/' + $(this).val(), function(result) {
$('#name').val(result);
});
}
});
});
</script>
</div>

Wyświetl plik

@ -8,6 +8,7 @@
google.setOnLoadCallback(drawModeChart);
google.setOnLoadCallback(drawBandChart);
google.setOnLoadCallback(drawSatChart);
google.setOnLoadCallback(drawQSLChart);
// Callback that creates and populates a data table,
@ -85,8 +86,10 @@
<ul>
<li><a href="#tabs-1">Main</a></li>
<li><a href="#tabs-2">Satellite</a></li>
<!-- <li><a href="#tabs-3">QSLing</a></li> -->
</ul>
<div id="tabs-1"><div id="modechart_div"></div> <div id="bandchart_div"></div></div>
<div id="tabs-2"><div id="satchart_div"></div></div>
<!-- <div id="tabs-3"><div id="qslchart_div"></div></div> -->
</div>
</div>