diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php
index 4abefd1e..1fb865c5 100644
--- a/application/controllers/Awards.php
+++ b/application/controllers/Awards.php
@@ -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)";
diff --git a/application/controllers/Mode.php b/application/controllers/Mode.php
index a5afe7c3..b6176fbb 100644
--- a/application/controllers/Mode.php
+++ b/application/controllers/Mode.php
@@ -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;
+ }
}
\ No newline at end of file
diff --git a/application/models/Cq.php b/application/models/Cq.php
index e62ee86f..d5d47d38 100644
--- a/application/models/Cq.php
+++ b/application/models/Cq.php
@@ -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();
+ }
+
}
diff --git a/application/models/Iota.php b/application/models/Iota.php
index 12c5d539..a2f054b7 100644
--- a/application/models/Iota.php
+++ b/application/models/Iota.php
@@ -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();
+ }
}
?>
\ No newline at end of file
diff --git a/application/models/Modes.php b/application/models/Modes.php
index 76aaee7b..07d9ec28 100644
--- a/application/models/Modes.php
+++ b/application/models/Modes.php
@@ -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;
+ }
+
}
?>
\ No newline at end of file
diff --git a/application/views/awards/cq/index.php b/application/views/awards/cq/index.php
index 7d273505..24de609a 100644
--- a/application/views/awards/cq/index.php
+++ b/application/views/awards/cq/index.php
@@ -165,7 +165,37 @@
}
echo '';
}
- echo '';
+ echo '
+
Summary
+
+
+
+ | ';
+
+ foreach($bands as $band) {
+ echo '' . $band . ' | ';
+ }
+ echo '
';
+
+ echo '
+
+
+
+ Total worked | ';
+
+ foreach ($cq_summary['worked'] as $dxcc) { // Fills the table with the data
+ echo '' . $dxcc . ' | ';
+ }
+
+ echo '
+ Total confirmed | ';
+ foreach ($cq_summary['confirmed'] as $dxcc) { // Fills the table with the data
+ echo '' . $dxcc . ' | ';
+ }
+
+ echo '
+
+ ';
}
else {
diff --git a/application/views/awards/iota/index.php b/application/views/awards/iota/index.php
index 2eb46dc7..c3b63057 100644
--- a/application/views/awards/iota/index.php
+++ b/application/views/awards/iota/index.php
@@ -125,7 +125,38 @@
}
echo '';
}
- echo '';
+
+ echo '
+ Summary
+
+
+
+ | ';
+
+ foreach($bands as $band) {
+ echo '' . $band . ' | ';
+ }
+ echo '
';
+
+ echo '
+
+
+
+ Total worked | ';
+
+ foreach ($iota_summary['worked'] as $dxcc) { // Fills the table with the data
+ echo '' . $dxcc . ' | ';
+ }
+
+ echo '
+ Total confirmed | ';
+ foreach ($iota_summary['confirmed'] as $dxcc) { // Fills the table with the data
+ echo '' . $dxcc . ' | ';
+ }
+
+ echo '
+
+ ';
}
else {
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php
index b88d22d6..d72d89cc 100644
--- a/application/views/interface_assets/footer.php
+++ b/application/views/interface_assets/footer.php
@@ -1809,6 +1809,38 @@ $(document).ready(function(){
+ uri->segment(1) == "mode") { ?>
+
+
+
uri->segment(1) == "accumulated") { ?>