pull/657/head
Peter Goodhall 2020-10-12 15:35:23 +01:00
commit 4a1fc0b035
10 zmienionych plików z 267 dodań i 5 usunięć

Wyświetl plik

@ -283,6 +283,7 @@ class Awards extends CI_Controller {
}
$data['cq_array'] = $this->cq->get_cq_array($bands, $postdata);
$data['cq_summary'] = $this->cq->get_cq_summary($bands);
// Render page
$data['page_title'] = "Awards - CQ Magazine";
@ -411,6 +412,7 @@ class Awards extends CI_Controller {
$iotalist = $this->iota->fetchIota($postdata);
$data['iota_array'] = $this->iota->get_iota_array($iotalist, $bands, $postdata);
$data['iota_summary'] = $this->iota->get_iota_summary($bands);
// Render Page
$data['page_title'] = "Awards - IOTA (Islands On The Air)";

Wyświetl plik

@ -90,4 +90,22 @@ class Mode extends CI_Controller {
redirect('mode');
}
public function activate() {
$id = $this->input->post('id');
$this->load->model('modes');
$this->modes->activate($id);
header('Content-Type: application/json');
echo json_encode(array('message' => 'OK'));
return;
}
public function deactivate() {
$id = $this->input->post('id');
$this->load->model('modes');
$this->modes->deactivate($id);
header('Content-Type: application/json');
echo json_encode(array('message' => 'OK'));
return;
}
}

Wyświetl plik

@ -212,4 +212,58 @@ class CQ extends CI_Model{
return $sql;
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
function get_cq_summary($bands) {
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
foreach ($bands as $band) {
$worked = $this->getSummaryByBand($band, $station_id);
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
$cqSummary['worked'][$band] = $worked[0]->count;
$cqSummary['confirmed'][$band] = $confirmed[0]->count;
}
return $cqSummary;
}
function getSummaryByBand($band, $station_id) {
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $station_id;
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band ='" . $band . "'";
}
$query = $this->db->query($sql);
return $query->result();
}
function getSummaryByBandConfirmed($band, $station_id){
$sql = "SELECT count(distinct thcv.col_cqz) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $station_id;
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band ='" . $band . "'";
}
$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
$query = $this->db->query($sql);
return $query->result();
}
}

Wyświetl plik

@ -307,5 +307,62 @@ class IOTA extends CI_Model {
}
return $sql;
}
/*
* Function gets worked and confirmed summary on each band on the active stationprofile
*/
function get_iota_summary($bands)
{
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
foreach ($bands as $band) {
$worked = $this->getSummaryByBand($band, $station_id);
$confirmed = $this->getSummaryByBandConfirmed($band, $station_id);
$iotaSummary['worked'][$band] = $worked[0]->count;
$iotaSummary['confirmed'][$band] = $confirmed[0]->count;
}
return $iotaSummary;
}
function getSummaryByBand($band, $station_id)
{
$sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $station_id;
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band ='" . $band . "'";
}
$query = $this->db->query($sql);
return $query->result();
}
function getSummaryByBandConfirmed($band, $station_id)
{
$sql = "SELECT count(distinct thcv.col_iota) as count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " where station_id = " . $station_id;
if ($band == 'SAT') {
$sql .= " and thcv.col_prop_mode ='" . $band . "'";
} else {
$sql .= " and thcv.col_prop_mode !='SAT'";
$sql .= " and thcv.col_band ='" . $band . "'";
}
$sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')";
$query = $this->db->query($sql);
return $query->result();
}
}
?>

Wyświetl plik

@ -72,6 +72,36 @@ class Modes extends CI_Model {
$this->db->delete('adif_modes', array('id' => $clean_id));
}
function activate($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$data = array(
'active' => '1',
);
$this->db->where('id', $clean_id);
$this->db->update('adif_modes', $data);
return true;
}
function deactivate($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$data = array(
'active' => '0',
);
$this->db->where('id', $clean_id);
$this->db->update('adif_modes', $data);
return true;
}
}
?>

Wyświetl plik

@ -165,7 +165,37 @@
}
echo '</tr>';
}
echo '</tfoot></table></div>';
echo '</table>
<h2>Summary</h2>
<table class="table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr><td></td>';
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '</tr>';
echo '</tr>
</thead>
<tbody>
<tr><td>Total worked</td>';
foreach ($cq_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr><tr>
<td>Total confirmed</td>';
foreach ($cq_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr>
</table>
</div>';
}
else {

Wyświetl plik

@ -125,7 +125,38 @@
}
echo '</tr>';
}
echo '</tfoot></table></div>';
echo '</table>
<h2>Summary</h2>
<table class="table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr><td></td>';
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '</tr>';
echo '</tr>
</thead>
<tbody>
<tr><td>Total worked</td>';
foreach ($iota_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr><tr>
<td>Total confirmed</td>';
foreach ($iota_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
echo '</tr>
</table>
</div>';
}
else {

Wyświetl plik

@ -1809,6 +1809,38 @@ $(document).ready(function(){
</script>
<?php } ?>
<?php if ($this->uri->segment(1) == "mode") { ?>
<script>
function deactivateMode(modeid) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/mode/deactivate',
type: 'post',
data: {'id': modeid },
success: function(html) {
$(".mode_" + modeid).text('not active');
$('.btn_'+modeid).html('Activate');
$('.btn_'+modeid).attr('onclick', 'activateMode('+modeid+')')
}
});
}
function activateMode(modeid) {
var baseURL= "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/mode/activate',
type: 'post',
data: {'id': modeid },
success: function(html) {
$('.mode_'+modeid).text('active');
$('.btn_'+modeid).html('Deactivate');
$('.btn_'+modeid).attr('onclick', 'deactivateMode('+modeid+')')
}
});
}
</script>
<?php } ?>
<?php if ($this->uri->segment(1) == "accumulated") { ?>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script>

Wyświetl plik

@ -32,12 +32,20 @@
<td><?php echo $row->mode;?></td>
<td><?php echo $row->submode;?></td>
<td><?php echo $row->qrgmode;?></td>
<td><?php if ($row->active == 1) { echo "active";} else { echo "not active";};?></td>
<td class='mode_<?php echo $row->id ?>'><?php if ($row->active == 1) { echo "active";} else { echo "not active";};?></td>
<td>
<?php if ($row->active == 1) {
echo "<button onclick='javascript:deactivateMode(". $row->id . ")' class='btn_" . $row->id . " btn btn-success btn-sm'><i class='fas fa-edit-alt'></i> Deactivate</button>";
} else {
echo "<button onclick='javascript:activateMode(". $row->id . ")' class='btn_" . $row->id . " btn btn-success btn-sm'><i class='fas fa-edit-alt'></i> Activate</button>";
};?>
</td>
<td>
<a href="<?php echo site_url('mode/edit')."/".$row->id; ?>" class="btn btn-info btn-sm"><i class="fas fa-edit-alt"></i> Edit</a>
</td>
<td>
<a href="<?php echo site_url('mode/delete')."/".$row->id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode <?php echo $row->mode; ?> ');"><i class="fas fa-trash-alt"></i> Delete</a></td>
<a href="<?php echo site_url('mode/delete')."/".$row->id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete mode <?php echo $row->mode; ?> ');"><i class="fas fa-trash-alt"></i> Delete</a>
</td>
</tr>
<?php } ?>

Wyświetl plik

@ -71,7 +71,7 @@
<a href="<?php echo site_url('station/edit')."/".$row->station_id; ?>" class="btn btn-info btn-sm"><i class="fas fa-edit"></i> Edit</a>
</td>
<td>
<a href="<?php echo site_url('station/deletelog')."/".$row->station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete all QSOs within this station profile?');"><i class="fas fa-trash-alt"></i> Empty Station Profile</a></td>
<a href="<?php echo site_url('station/deletelog')."/".$row->station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want to delete all QSOs within this station profile?');"><i class="fas fa-trash-alt"></i> Empty Log</a></td>
</td>
<td>
<a href="<?php echo site_url('station/delete')."/".$row->station_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile <?php echo $row->station_profile_name; ?> this will delete all QSOs within this station profile?');"><i class="fas fa-trash-alt"></i> Delete Profile</a></td>