Added Name Field, QRA Lookup, Stats Tab

这个提交包含在:
Peter Goodhall 2011-07-24 23:33:08 +01:00
父节点 eaddb5220c
当前提交 925034e3e5
共有 11 个文件被更改,包括 242 次插入30 次删除

查看文件

@ -32,10 +32,9 @@ class QSO extends CI_Controller {
}
else
{
// Add QSO
$this->logbook_model->add();
// Store Basic QSO Info for reuse
$this->session->set_userdata('band', $this->input->post('band'));
$this->session->set_userdata('freq', $this->input->post('freq'));

查看文件

@ -0,0 +1,35 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Statistics extends CI_Controller {
public function index()
{
// Database connections
$this->load->model('logbook_model');
// Store info
$data['todays_qsos'] = $this->logbook_model->todays_qsos();
$data['total_qsos'] = $this->logbook_model->total_qsos();
$data['month_qsos'] = $this->logbook_model->month_qsos();
$data['year_qsos'] = $this->logbook_model->year_qsos();
$data['total_ssb'] = $this->logbook_model->total_ssb();
$data['total_cw'] = $this->logbook_model->total_cw();
$data['total_fm'] = $this->logbook_model->total_fm();
$data['total_digi'] = $this->logbook_model->total_digi();
$data['total_bands'] = $this->logbook_model->total_bands();
$data['total_sat'] = $this->logbook_model->total_sat();
$data['page_title'] = "Statistics";
$data['total_digi'] = $this->logbook_model->total_digi();
$this->load->view('layout/header');
$this->load->view('statistics/index', $data);
$this->load->view('layout/footer');
}
}

查看文件

@ -2,21 +2,7 @@
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');

查看文件

@ -23,6 +23,7 @@ class Logbook_model extends CI_Model {
'COL_MODE' => $this->input->post('mode'),
'COL_RST_RCVD' => $this->input->post('rst_recv'),
'COL_RST_SENT' => $this->input->post('rst_sent'),
'COL_NAME' => $this->input->post('name'),
'COL_COMMENT' => $this->input->post('comment'),
'COL_SAT_NAME' => $this->input->post('sat_name'),
'COL_SAT_MODE' => $this->input->post('sat_mode'),
@ -67,6 +68,54 @@ class Logbook_model extends CI_Model {
return $this->db->get($this->config->item('table_name'));
}
/* Callsign QRA */
function call_qra($callsign) {
$this->db->select('COL_CALL, COL_GRIDSQUARE, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);
$where = "COL_GRIDSQUARE != \"\"";
$this->db->where($where);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$callsign = "";
if ($query->num_rows() > 0)
{
$data = $query->row();
$callsign = strtoupper($data->COL_GRIDSQUARE);
}
return $callsign;
}
function call_name($callsign) {
$this->db->select('COL_CALL, COL_NAME, COL_TIME_ON');
$this->db->where('COL_CALL', $callsign);
$where = "COL_NAME != \"\"";
$this->db->where($where);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$name = "";
if ($query->num_rows() > 0)
{
$data = $query->row();
$name = $data->COL_NAME;
} else {
//$json = file_get_contents("http://callbytxt.org/db/".$callsign.".json");
//$obj = json_decode($json);
//$uppercase_name = strtolower($obj->{'calls'}->{'first_name'});
// $name = ucwords($uppercase_name);
}
return $name;
}
/* Return QSO Info */
function qso_info($id) {
$this->db->where('COL_PRIMARY_KEY', $id);
@ -170,9 +219,16 @@ class Logbook_model extends CI_Model {
}
}
}
function total_sat() {
$query = $this->db->query('SELECT COL_SAT_NAME, COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE COL_SAT_NAME != \'null\' GROUP BY COL_SAT_NAME');
return $query;
}
function total_cw() {
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE COL_MODE = \'CW\'');
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').' WHERE COL_MODE = \'CW\' ');
if ($query->num_rows() > 0)
{

查看文件

@ -1,3 +1,26 @@
<script type="text/javascript" src="<?php echo base_url() ;?>/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="<?php echo base_url() ;?>/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url() ;?>/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$(".qsobox").fancybox({
'width' : '75%',
'height' : '50%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
</script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
@ -77,7 +100,7 @@
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); ?></td>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
<td><?php echo strtoupper($row->COL_CALL); ?></td>
<td><a class="qsobox" href="<?php echo site_url('logbook/view')."/".$row->COL_PRIMARY_KEY; ?>"><?php echo strtoupper($row->COL_CALL); ?></a></td>
<td><?php echo $row->COL_MODE; ?></td>
<td><?php echo $row->COL_RST_SENT; ?></td>
<td><?php echo $row->COL_RST_RCVD; ?></td>

查看文件

@ -55,7 +55,8 @@ table .titles { font-weight: bold; }
#locator { width: 55px; text-transform: uppercase; }
#country { border: none; }
#locator_info { font-size: 13px; }
#comment { width: 145px; }
#name { width: 145px; }
#comment { width: 89.5%; }
.dash_left { float: left; width: 430px; }
.dash_sidebar { float: right; width: 350px; }
@ -66,6 +67,9 @@ table .titles { font-weight: bold; }
a { text-decoration: none; color: #000; }
a:hover { text-decoration: underline; }
ul.notes_list {list-style-type: circle; padding-left: 20px; }
p {
line-height: 1.7;
margin: 10px 0;
@ -87,6 +91,7 @@ margin: 10px 0;
<li><a href="<?php echo site_url('search');?>" title="Search">Search</a></li>
<li><a href="<?php echo site_url('qso');?>" title="Add QSO">Add QSO</a></li>
<li><a href="<?php echo site_url('notes');?>" title="Notes">Notes</a></li>
<li><a href="<?php echo site_url('statistics');?>" title="statistics">Statistics</a></li>
</ul>
</div>
<div class="clear"></div>

查看文件

@ -1,11 +1,11 @@
<h2>Note</h2>
<div class="wrap_content">
<div class="wrap_content note">
<?php
if ($notes->num_rows() > 0)
{
echo "<ul>";
echo "<ul class=\"notes_list\">";
foreach ($notes->result() as $row)
{
echo "<li>";

查看文件

@ -3,10 +3,6 @@
<div class="wrap_content note">
<?php echo nl2br($row->note); ?>
<p>Options:
<ul>
<li><a href="<?php echo site_url('notes/edit'); ?>/<?php echo $row->id; ?>">Edit</a></li>
<li><a href="<?php echo site_url('notes/delete'); ?>/<?php echo $row->id; ?>">Delete</a></li>
</ul></p>
<p>Options: <a href="<?php echo site_url('notes/edit'); ?>/<?php echo $row->id; ?>"><img src="<?php echo base_url(); ?>images/application_edit.png" width="16" height="16" alt="Edit" /></a> <a href="<?php echo site_url('notes/delete'); ?>/<?php echo $row->id; ?>"><img src="<?php echo base_url(); ?>images/delete.png" width="16" height="16" alt="Delete" /></a></p>
</div>
<?php } ?>

查看文件

@ -96,7 +96,7 @@ function settime () {
<td class="title">RST Recv</td>
<td class="title">QRA</td>
<!-- <td class="title">Name</td> -->
<td class="title">Comment</td>
<td class="title">Name</td>
</tr>
<tr>
@ -160,10 +160,13 @@ function settime () {
<option value="59+30dB">59+30dB</option>
</select></td>
<td><input id="locator" type="text" name="locator" value="" size="7" /></td>
<!-- <td><input type="text" name="name" value="" /></td> -->
<td><input id="comment" type="text" name="comment" value="" /></td>
<td><input id="name" type="text" name="name" value="" /></td>
</tr>
<tr>
<td colspan="9">Comment: <input id="comment" type="text" name="comment" value="" /></td>
</tr>
</table>
<div class="info">
@ -231,6 +234,14 @@ $(document).ready(function(){
$.get('logbook/find_dxcc/' + $(this).val(), function(result) {
$('#country').val(result);
});
$.get('logbook/callsign_qra/' + $(this).val(), function(result) {
$('#locator').val(result);
});
$.get('logbook/callsign_name/' + $(this).val(), function(result) {
$('#name').val(result);
});
}
});

查看文件

@ -0,0 +1,94 @@
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawModeChart);
google.setOnLoadCallback(drawBandChart);
google.setOnLoadCallback(drawSatChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawModeChart() {
// Create our data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['SSB', <?php echo $total_ssb; ?>],
['CW', <?php echo $total_cw; ?>],
['FM', <?php echo $total_ssb; ?>],
['Digi', <?php echo $total_digi; ?>],
]);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('modechart_div'));
chart.draw(data, {width: 700, height: 440});
}
function drawBandChart() {
// Create our data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
<?php foreach($total_bands->result() as $row) { ?>
['<?php echo $row->band; ?>', <?php echo $row->count; ?>],
<?php } ?>
]);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('bandchart_div'));
chart.draw(data, {width: 700, height: 440});
}
function drawSatChart() {
// Create our data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
<?php foreach($total_sat->result() as $row1) { ?>
<?php if($row1->COL_SAT_NAME != null) { ?>
['<?php echo $row1->COL_SAT_NAME; ?>', <?php echo $row1->count; ?>],
<?php } ?>
<?php } ?>
]);
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('satchart_div'));
chart.draw(data, {width: 700, height: 440});
}
</script>
<h2><?php echo $page_title; ?></h2>
<div class="wrap_content note">
<p>Statistics built using information from the logbook.</p>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Main</a></li>
<li><a href="#tabs-2">Satellite</a></li>
<li><a href="#tabs-3">-</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>
</div>
</div>

查看文件

@ -86,6 +86,13 @@
</tr>
<?php } ?>
<?php if($row->COL_NAME != null) { ?>
<tr>
<td>Name</td>
<td><?php echo $row->COL_NAME; ?></td>
</tr>
<?php } ?>
<?php if($row->COL_COMMENT != null) { ?>
<tr>
<td>Comment</td>