diff --git a/application/controllers/Distancerecords.php b/application/controllers/Distancerecords.php new file mode 100644 index 000000000..c97a667c9 --- /dev/null +++ b/application/controllers/Distancerecords.php @@ -0,0 +1,31 @@ +load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + } + + public function index() + { + + $this->load->model('distancerecords_model'); + + // Render Page + $data['page_title'] = __("Distance Records"); + $data['distances'] = $this->distancerecords_model->get_records(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('distancerecords/index'); + $this->load->view('interface_assets/footer'); + } + + public function distancerecords() { + } + +} diff --git a/application/models/Distancerecords_model.php b/application/models/Distancerecords_model.php new file mode 100644 index 000000000..29802033c --- /dev/null +++ b/application/models/Distancerecords_model.php @@ -0,0 +1,28 @@ +load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + $sql = 'SELECT t1.sat, t1.distance, t2.COL_TIME_ON time, t2.COL_CALL callsign, t2.COL_GRIDSQUARE grid FROM + ( + SELECT MAX(col_distance) distance, COL_SAT_NAME sat + FROM '.$this->config->item('table_name').' + WHERE station_id in ('.implode(', ', $logbooks_locations_array).') + AND COALESCE(COL_SAT_NAME, "") <> "" + GROUP BY col_sat_name + ) t1 + LEFT JOIN TABLE_HRD_CONTACTS_V01 t2 ON t1.sat = t2.COL_SAT_NAME AND t1.distance = t2.COL_DISTANCE ORDER BY t1.distance DESC; + '; + + return $this->db->query($sql); + } +} + +?> diff --git a/application/views/distancerecords/index.php b/application/views/distancerecords/index.php new file mode 100644 index 000000000..7b3cfd29f --- /dev/null +++ b/application/views/distancerecords/index.php @@ -0,0 +1,53 @@ +
+
+

+

+ session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/wavelog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + ?> + + + + + + + + + + + + + + + + num_rows() > 0) { + foreach ($distances->result() as $row) { + ?> + + + + + + + + + + + + +
sat; ?>distance)); ?> kmtime); echo date($custom_date_format, $timestamp); ?>time); echo date('H:i', $timestamp); ?>callsign; ?>grid; ?>
+ ' . __("Nothing found!") . '

'; + }?> + diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 9b533da60..1d75bbba1 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -143,6 +143,8 @@
  • +
  • +