diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 59ff6dd8e..5e094523e 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -676,6 +676,8 @@ class Awards extends CI_Controller { $postdata['notworked'] = $this->security->xss_clean($this->input->post('notworked')); $postdata['band'] = $this->security->xss_clean($this->input->post('band')); $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['datefrom'] = $this->security->xss_clean($this->input->post('dateFrom')); + $postdata['dateto'] = $this->security->xss_clean($this->input->post('dateTo')); } else { // Setting default values at first load of page $postdata['qsl'] = 1; @@ -687,6 +689,8 @@ class Awards extends CI_Controller { $postdata['notworked'] = 1; $postdata['band'] = 'All'; $postdata['mode'] = 'All'; + $postdata['datefrom'] = null; + $postdata['dateto'] = null; } if ($logbooks_locations_array) { @@ -1612,6 +1616,8 @@ class Awards extends CI_Controller { $postdata['notworked'] = $this->input->post('notworked') == 0 ? NULL: 1; $postdata['band'] = $this->security->xss_clean($this->input->post('band')); $postdata['mode'] = $this->security->xss_clean($this->input->post('mode')); + $postdata['datefrom'] = $this->security->xss_clean($this->input->post('datefrom')); + $postdata['dateto'] = $this->security->xss_clean($this->input->post('dateto')); if ($logbooks_locations_array) { $location_list = "'".implode("','",$logbooks_locations_array)."'"; diff --git a/application/models/Cq.php b/application/models/Cq.php index 5007e2b91..c4f3ba038 100644 --- a/application/models/Cq.php +++ b/application/models/Cq.php @@ -82,6 +82,16 @@ class CQ extends CI_Model{ $bindings[]=$postdata['mode']; } + if ($postdata['datefrom'] != NULL) { + $sql .= " and date(col_time_on) >= ?"; + $bindings[]=$postdata['datefrom']; + } + + if ($postdata['dateto'] != NULL) { + $sql .= " and date(col_time_on) <= ?"; + $bindings[]=$postdata['dateto']; + } + $sql .= $this->genfunctions->addBandToQuery($band,$bindings); $sql .= " and not exists (select 1 from " . $this->config->item('table_name') . @@ -94,6 +104,16 @@ class CQ extends CI_Model{ $bindings[]=$postdata['mode']; } + if ($postdata['datefrom'] != NULL) { + $sql .= " and date(col_time_on) >= ?"; + $bindings[]=$postdata['datefrom']; + } + + if ($postdata['dateto'] != NULL) { + $sql .= " and date(col_time_on) <= ?"; + $bindings[]=$postdata['dateto']; + } + $sql .= $this->genfunctions->addBandToQuery($band,$bindings); $sql .= $this->genfunctions->addQslToQuery($postdata); @@ -120,6 +140,16 @@ class CQ extends CI_Model{ $bindings[]=$postdata['mode']; } + if ($postdata['datefrom'] != NULL) { + $sql .= " and date(col_time_on) >= ?"; + $bindings[]=$postdata['datefrom']; + } + + if ($postdata['dateto'] != NULL) { + $sql .= " and date(col_time_on) <= ?"; + $bindings[]=$postdata['dateto']; + } + $sql .= $this->genfunctions->addBandToQuery($band,$bindings); $sql .= $this->genfunctions->addQslToQuery($postdata); @@ -180,6 +210,16 @@ class CQ extends CI_Model{ $bindings[]=$postdata['mode']; } + if ($postdata['datefrom'] != NULL) { + $sql .= " and date(col_time_on) >= ?"; + $bindings[]=$postdata['datefrom']; + } + + if ($postdata['dateto'] != NULL) { + $sql .= " and date(col_time_on) <= ?"; + $bindings[]=$postdata['dateto']; + } + $query = $this->db->query($sql,$bindings); return $query->result(); @@ -215,6 +255,16 @@ class CQ extends CI_Model{ $bindings[]=$postdata['mode']; } + if ($postdata['datefrom'] != NULL) { + $sql .= " and date(col_time_on) >= ?"; + $bindings[]=$postdata['datefrom']; + } + + if ($postdata['dateto'] != NULL) { + $sql .= " and date(col_time_on) <= ?"; + $bindings[]=$postdata['dateto']; + } + $sql .= $this->genfunctions->addQslToQuery($postdata); $query = $this->db->query($sql,$bindings); diff --git a/application/views/awards/cq/index.php b/application/views/awards/cq/index.php index 4b37feab1..222a3b9b9 100644 --- a/application/views/awards/cq/index.php +++ b/application/views/awards/cq/index.php @@ -1,16 +1,25 @@ -
@@ -19,108 +28,138 @@

-
+
+
+