Started SOTA tracking comments field - SOTA:# then awards/sota

pull/106/merge
Peter Goodhall 2012-11-01 01:50:11 +00:00
rodzic ee2eb20fef
commit 2a03c6af15
3 zmienionych plików z 85 dodań i 0 usunięć

Wyświetl plik

@ -2,6 +2,8 @@
/*
Handles Displaying of information for awards.
These are taken from comments fields or ADIF fields
*/
class Awards extends CI_Controller {
@ -13,15 +15,36 @@ class Awards extends CI_Controller {
/*
Handles Displaying of WAB Squares worked.
Comment field - WAB:#
*/
public function wab() {
// Grab all worked WABs
$this->load->model('wab');
$data['wab_all'] = $this->wab->get_all();
// Render Page
$data['page_title'] = "Awards - WAB";
$this->load->view('layout/header', $data);
$this->load->view('awards/wab/index');
$this->load->view('layout/footer');
}
/*
Handles showing worked SOTAs
Comment field - SOTA:#
*/
public function sota() {
// Grab all worked sota stations
$this->load->model('sota');
$data['sota_all'] = $this->sota->get_all();
// Render page
$data['page_title'] = "Awards - SOTA";
$this->load->view('layout/header', $data);
$this->load->view('awards/sota/index');
$this->load->view('layout/footer');
}
}

Wyświetl plik

@ -0,0 +1,18 @@
<?php
class Sota extends CI_Model {
function __construct()
{
parent::__construct();
}
function get_all() {
$this->db->order_by("COL_COMMENT", "ASC");
$this->db->like('COL_COMMENT', 'SOTA:');
return $this->db->get($this->config->item('table_name'));
}
}
?>

Wyświetl plik

@ -0,0 +1,44 @@
<div id="container">
<h1><?php echo $page_title; ?></h1>
<table width="100%" class="zebra-striped">
<tr>
<td>Reference</td>
<td>Date/Time</td>
<td>Callsign</td>
<td>Band</td>
<td>RST Sent</td>
<td>RST Recvd</td>
</tr>
<?php
if ($sota_all->num_rows() > 0) {
foreach ($sota_all->result() as $row) {
?>
<tr>
<td>
<?php
$pieces = explode(" ", $row->COL_COMMENT);
foreach($pieces as $val) {
if (strpos($val,'SOTA:') !== false) {
//echo $val;
echo $rest = substr($val, 5); // returns "cde"
}
}
?>
</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>
</div>