From 7806789fd7767d8a720798eada5b11fc6cf70379 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Tue, 23 Aug 2011 17:12:47 +0100 Subject: [PATCH] Dashboard: Map now shows weeks qsos rather than a single day --- application/controllers/dashboard.php | 2 +- application/models/logbook_model.php | 9 +++++++++ application/views/dashboard/index.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/application/controllers/dashboard.php b/application/controllers/dashboard.php index c30e1ec5..427eccc3 100644 --- a/application/controllers/dashboard.php +++ b/application/controllers/dashboard.php @@ -49,7 +49,7 @@ class Dashboard extends CI_Controller { $this->load->model('logbook_model'); // TODO: Auth - $qsos = $this->logbook_model->get_todays_qsos(''); + $qsos = $this->logbook_model->get_this_weeks_qsos(''); echo "{\"markers\": ["; diff --git a/application/models/logbook_model.php b/application/models/logbook_model.php index 21707d12..f243d4d5 100644 --- a/application/models/logbook_model.php +++ b/application/models/logbook_model.php @@ -191,6 +191,15 @@ class Logbook_model extends CI_Model { } } + function get_this_weeks_qsos() { + $morning = date('Y/m/d',time()+(1 - date('w'))*24*3600); + $night = date('Y/m/d',time()+( 7 - date('w'))*24*3600); + $query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\''); + + return $query; + } + + function month_qsos() { $morning = date('Y-m-01 00:00:00'); diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index e1380c64..298dd235 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -115,7 +115,7 @@ -

Todays Mapped QSOs

+

This Weeks QSOs