From 5c8fd2ddfe46348c8838bb860e2b6ca5dc01c1ef Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 21 Sep 2011 14:30:01 +0100 Subject: [PATCH] Added ADIF export functions either whole log or by date. --- application/config/config.php | 3 ++ application/controllers/adif.php | 38 +++++++++++++++++ application/models/adif_data.php | 28 ++++++++++++ application/views/adif/data/exportall.php | 15 +++++++ application/views/adif/main.php | 52 +++++++++++++++++++++++ application/views/layout/header.php | 5 ++- 6 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 application/controllers/adif.php create mode 100644 application/models/adif_data.php create mode 100644 application/views/adif/data/exportall.php create mode 100644 application/views/adif/main.php diff --git a/application/config/config.php b/application/config/config.php index 3ebe8f9b..6738ad6c 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -26,6 +26,9 @@ $config['auth_level'][99] = "Administrator"; $config['beta'] = true; +$config['app_name'] = "Web Logger"; +$config['app_version'] = "0.1"; + /* |-------------------------------------------------------------------------- | Base Site URL diff --git a/application/controllers/adif.php b/application/controllers/adif.php new file mode 100644 index 00000000..bfad95ab --- /dev/null +++ b/application/controllers/adif.php @@ -0,0 +1,38 @@ +load->view('layout/header'); + $this->load->view('adif/main'); + $this->load->view('layout/footer'); + } + + // Export all QSO Data in ASC Order of Date. + public function exportall() + { + $this->load->model('adif_data'); + + $data['qsos'] = $this->adif_data->export_all(); + + $this->load->view('adif/data/exportall', $data); + } + + public function export_custom() { + $this->load->model('adif_data'); + + $data['qsos'] = $this->adif_data->export_custom($this->input->post('from'), $this->input->post('to')); + + $this->load->view('adif/data/exportall', $data); + + + } + + +} + +/* End of file welcome.php */ +/* Location: ./application/controllers/welcome.php */ \ No newline at end of file diff --git a/application/models/adif_data.php b/application/models/adif_data.php new file mode 100644 index 00000000..ed5b51c7 --- /dev/null +++ b/application/models/adif_data.php @@ -0,0 +1,28 @@ +db->limit(5); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + + function export_custom($from, $to) { + $this->db->where("COL_TIME_ON BETWEEN '".$from."' AND '".$to."'"); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } +} + +?> diff --git a/application/views/adif/data/exportall.php b/application/views/adif/data/exportall.php new file mode 100644 index 00000000..6d31d578 --- /dev/null +++ b/application/views/adif/data/exportall.php @@ -0,0 +1,15 @@ + +2.2 +config->item('app_name')."\n"; ?> +Version config->item('app_version')."\n"; ?> + + +result() as $qso) { //print_r($qso);?> + COL_CALL); ?>>COL_CALL; ?>COL_BAND); ?>>COL_BAND; ?>COL_MODE); ?>>COL_MODE; ?>COL_FREQ != "0") { ?>COL_FREQ); ?>>COL_FREQ; ?>COL_TIME_ON); $new_date = date('Ymd', $date_on); ?>>COL_TIME_ON); $new_on = date('Hi', $time_on); ?>>COL_TIME_OFF); $new_off = date('Hi', $time_off); ?>>COL_RST_RCVD); ?>>COL_RST_RCVD; ?>COL_RST_SENT); ?>>COL_RST_SENT; ?>COL_QSL_RCVD); ?>>COL_QSL_RCVD; ?>COL_QSL_SENT); ?>>COL_QSL_SENT; ?>COL_COUNTRY); ?>>COL_COUNTRY; ?>COL_GRIDSQUARE != "") { ?>COL_GRIDSQUARE); ?>>COL_GRIDSQUARE; ?>COL_SAT_NAME) { ?>COL_SAT_MODE); ?>>COL_SAT_MODE; ?>COL_SAT_NAME); ?>>COL_SAT_NAME; ?>COL_PROP_MODE) { ?>COL_PROP_MODE); ?>>COL_PROP_MODE; ?>COL_NAME) { ?>COL_NAME); ?>>COL_NAME; ?>COL_COMMENT) { ?>COL_COMMENT); ?>>COL_COMMENT; ?> + + \ No newline at end of file diff --git a/application/views/adif/main.php b/application/views/adif/main.php new file mode 100644 index 00000000..5f0dcebb --- /dev/null +++ b/application/views/adif/main.php @@ -0,0 +1,52 @@ +

ADIF Export

+
+ +

Exporting your log is simple you can either export the whole log or use the finer controls to set the date.

+ + + +

Export Options

+ +
+ + + + + + + + + + + + + + + +
Start Date
End Date
+
+ +
+ + \ No newline at end of file diff --git a/application/views/layout/header.php b/application/views/layout/header.php index 7cf02e03..5228daea 100644 --- a/application/views/layout/header.php +++ b/application/views/layout/header.php @@ -114,7 +114,7 @@ ul.notes_list {list-style-type: circle; padding-left: 20px; } p { line-height: 1.7; -margin: 10px 0; +margin: 0px 0; } .contest_wrap { margin: 0 auto; width: 95%; } @@ -151,7 +151,7 @@ border-radius: 10px;