diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 32bb4177..5c7d0d82 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -30,7 +30,12 @@ class Awards extends CI_Controller { $this->load->model('dok'); $this->load->model('bands'); - $data['doks'] = $this->dok->show_stats(); + if($this->input->method() === 'post') { + $postdata['doks'] = $this->input->post('doks'); + } else { + $postdata['doks'] = 'both'; + } + $data['doks'] = $this->dok->show_stats($postdata); $data['worked_bands'] = $this->bands->get_worked_bands_dok(); // Used in the view for band select diff --git a/application/models/Api_model.php b/application/models/Api_model.php index 747e1d47..93b8776e 100644 --- a/application/models/Api_model.php +++ b/application/models/Api_model.php @@ -415,7 +415,7 @@ class API_Model extends CI_Model { 'COL_CONTEST_ID' => array('Name' => 'ContestID', 'Description' => '', 'Type' => ''), 'COL_COUNTRY' => array('Name' => 'Country', 'Description' => '', 'Type' => ''), 'COL_CQZ' => array('Name' => 'CQZone', 'Description' => '', 'Type' => ''), - 'COL_DARC_DOK' => array('Name' => 'Dok', 'Description' => '', 'Type' => ''), + 'COL_DARC_DOK' => array('Name' => 'DOK', 'Description' => '', 'Type' => ''), 'COL_DISTANCE' => array('Name' => 'Distance', 'Description' => '', 'Type' => ''), 'COL_DXCC' => array('Name' => 'DXCC', 'Description' => '', 'Type' => ''), 'COL_EMAIL' => array('Name' => 'EMail', 'Description' => '', 'Type' => ''), diff --git a/application/models/Dok.php b/application/models/Dok.php index 3ebef32f..50a4a265 100644 --- a/application/models/Dok.php +++ b/application/models/Dok.php @@ -2,7 +2,7 @@ class DOK extends CI_Model { - function show_stats() { + function show_stats($postdata) { $CI =& get_instance(); $CI->load->model('logbooks_model'); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -14,12 +14,16 @@ class DOK extends CI_Model { $this->load->model('bands'); $location_list = "'".implode("','",$logbooks_locations_array)."'"; + $sql = "select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230"; + if ($postdata['doks'] == 'dok') { + $sql .= " AND REGEXP_LIKE (COL_DARC_DOK, '^[A-Z][0-9]{2}$')"; + } else if ($postdata['doks'] == 'sdok') { + $sql .= " AND NOT REGEXP_LIKE (COL_DARC_DOK, '^[A-Z][0-9]{2}$')"; + } + $sql .= " group by COL_DARC_DOK, COL_MODE, COL_BAND"; + $sql .= " order by COL_DARC_DOK asc"; - $data = $this->db->query( - "select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt - from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 - group by COL_DARC_DOK, COL_MODE, COL_BAND" - ); + $data = $this->db->query($sql); $results = array(); $last_dok = ""; diff --git a/application/views/awards/dok/index.php b/application/views/awards/dok/index.php index 6db1c9ef..aed9a0aa 100644 --- a/application/views/awards/dok/index.php +++ b/application/views/awards/dok/index.php @@ -2,6 +2,33 @@

+
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+
DOKs ()$slot\n"; + echo " \n"; } ?> @@ -24,9 +51,9 @@ foreach($val as $band=>$count){ if (in_array($band, $worked_bands)) { if ($count == 0){ - print(""); + print(""); }else{ - printf("", str_replace("&", "%26", $dok), $band, $count); + printf("", str_replace("&", "%26", $dok), $band, $count); } } } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 2b9da29f..b70ee4c6 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1313,7 +1313,7 @@ $(document).ready(function(){ $.ajax({ url: baseURL + 'index.php/awards/dok_details_ajax', type: 'post', - data: {'Dok': dok, + data: {'DOK': dok, 'Band': band }, success: function(html) {
$slot
  %d%d