diff --git a/application/controllers/dashboard.php b/application/controllers/dashboard.php
index c30e1ec5..3c79f08a 100644
--- a/application/controllers/dashboard.php
+++ b/application/controllers/dashboard.php
@@ -35,6 +35,11 @@ class Dashboard extends CI_Controller {
$data['total_fm'] = $this->logbook_model->total_fm();
$data['total_digi'] = $this->logbook_model->total_digi();
+ $data['total_countrys'] = $this->logbook_model->total_countrys();
+
+ $data['total_qsl_sent'] = $this->logbook_model->total_qsl_sent();
+ $data['total_qsl_recv'] = $this->logbook_model->total_qsl_recv();
+
$data['total_bands'] = $this->logbook_model->total_bands();
$data['last_five_qsos'] = $this->logbook_model->get_last_qsos('9');
@@ -45,6 +50,45 @@ class Dashboard extends CI_Controller {
$this->load->view('layout/footer');
}
+ function map() {
+ $this->load->model('logbook_model');
+
+ //echo date('Y-m-d')
+ $raw = strtotime('Monday last week');
+
+ $mon = date('Y-m-d', $raw);
+ $sun = date('Y-m-d', strtotime('Sunday this week'));
+
+ $qsos = $this->logbook_model->map_week_qsos($mon, $sun);
+
+ echo "{\"markers\": [";
+
+ foreach ($qsos->result() as $row) {
+ //print_r($row);
+ if($row->COL_GRIDSQUARE != null) {
+ $stn_loc = qra2latlong($row->COL_GRIDSQUARE);
+ echo "{\"point\":new GLatLng(".$stn_loc[0].",".$stn_loc[1]."), \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"},";
+ } else {
+ $query = $this->db->query('
+ SELECT *
+ FROM dxcc
+ WHERE prefix = SUBSTRING( \''.$row->COL_CALL.'\', 1, LENGTH( prefix ) )
+ ORDER BY LENGTH( prefix ) DESC
+ LIMIT 1
+ ');
+
+ foreach ($query->result() as $dxcc) {
+ echo "{\"point\":new GLatLng(".$dxcc->lat.",".$dxcc->long."), \"html\":\"Callsign: ".$row->COL_CALL."
Date/Time: ".$row->COL_TIME_ON."
Band: ".$row->COL_BAND."
Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"},";
+ }
+ }
+
+ }
+ echo "]";
+ echo "}";
+
+ }
+
+
function todays_map() {
$this->load->model('logbook_model');
@@ -78,6 +122,7 @@ class Dashboard extends CI_Controller {
echo "}";
}
+
}
function distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') {
diff --git a/application/models/logbook_model.php b/application/models/logbook_model.php
index 1218ac54..812628a8 100644
--- a/application/models/logbook_model.php
+++ b/application/models/logbook_model.php
@@ -199,10 +199,11 @@ class Logbook_model extends CI_Model {
}
}
- function get_this_weeks_qsos() {
- $morning = date('Y/m/d',time()+(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.'\'');
+ function map_week_qsos($start, $end) {
+
+ $this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
+ $this->db->order_by("COL_TIME_ON", "ASC");
+ $query = $this->db->get($this->config->item('table_name'));
return $query;
}
@@ -299,6 +300,36 @@ class Logbook_model extends CI_Model {
return $query;
}
+
+ function total_qsl_sent() {
+ $query = $this->db->query('SELECT DISTINCT (COL_QSL_SENT) AS band, count(COL_QSL_SENT) AS count FROM '.$this->config->item('table_name').' WHERE COL_QSL_SENT = "Y" GROUP BY band');
+
+ $row = $query->row();
+
+ if($row == null) {
+ return 0;
+ } else {
+ return $row->count;
+ }
+ }
+
+ function total_qsl_recv() {
+ $query = $this->db->query('SELECT DISTINCT (COL_QSL_RCVD) AS band, count(COL_QSL_RCVD) AS count FROM '.$this->config->item('table_name').' WHERE COL_QSL_RCVD = "Y" GROUP BY band');
+
+ $row = $query->row();
+
+ if($row == null) {
+ return 0;
+ } else {
+ return $row->count;
+ }
+ }
+
+ function total_countrys() {
+ $query = $this->db->query('SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'');
+
+ return $query->num_rows();
+ }
function api_search_query($query) {
$time_start = microtime(true);
diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php
index bb7d0da5..b67ae98c 100644
--- a/application/views/dashboard/index.php
+++ b/application/views/dashboard/index.php
@@ -49,7 +49,7 @@
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('modechart_div'));
- chart.draw(data, {width: 310, height: 240});
+ chart.draw(data, {width: 280, height: 240, title: 'Total QSOs by Mode'});
}
function drawBandChart() {
@@ -68,7 +68,7 @@
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementById('bandchart_div'));
- chart.draw(data, {width: 310, height: 240});
+ chart.draw(data, {width: 280, height: 240, title: 'Total QSOs by Band'});
}
@@ -79,50 +79,99 @@
Dashboard
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Date |
+ Time |
+ Call |
+ Mode |
+ Sent |
+ Recv |
+ Band |
+
+
+ result() as $row) { ?>
+ '; ?>
+ COL_TIME_ON); echo date('d/m/y', $timestamp); ?> |
+ COL_TIME_ON); echo date('H:i', $timestamp); ?> |
+ COL_PRIMARY_KEY; ?>">COL_CALL); ?> |
+ COL_MODE; ?> |
+ COL_RST_SENT; ?> |
+ COL_RST_RCVD; ?> |
+ COL_SAT_NAME != null) { ?>
+ SAT |
+
+ COL_BAND; ?> |
+
+
+
+
+
+
+
+
+
+
+
+ Total QSOs |
+ |
+
+
+ QSOs This Year |
+ |
+
+
+ QSOs This Month |
+ |
+
+
+ |
+ |
+
+
+ Countrys Worked |
+ |
+
+
+ |
+ |
+
+
+ QSL Cards Sent |
+ |
+
+
+ QSL Cards Received |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
-
Latest QSOs
-
-
-
- Date |
- Time |
- Call |
- Mode |
- Sent |
- Recv |
- Band |
-
-
- result() as $row) { ?>
- '; ?>
- COL_TIME_ON); echo date('d/m/y', $timestamp); ?> |
- COL_TIME_ON); echo date('H:i', $timestamp); ?> |
- COL_PRIMARY_KEY; ?>">COL_CALL); ?> |
- COL_MODE; ?> |
- COL_RST_SENT; ?> |
- COL_RST_RCVD; ?> |
- COL_SAT_NAME != null) { ?>
- SAT |
-
- COL_BAND; ?> |
-
-
-
-
-
-
-
-
Todays QSOs
-
-
-
-
-
+
\ No newline at end of file
diff --git a/application/views/layout/header.php b/application/views/layout/header.php
index 5228daea..04d76623 100644
--- a/application/views/layout/header.php
+++ b/application/views/layout/header.php
@@ -82,7 +82,7 @@ ul#user li { float: left; margin: 2px 2px 0 3px; height:43px; border-bottom: non
#message p { line-height: 1.7; margin: 0px 0; }
.clear { clear: both; }
h2 { margin: 0 auto; width: 780px; font-weight: bold; font-size: 23px; margin-top: 5px; margin-bottom: 10px; }
-h3 { font-weight: bold; font-size: 16px; margin: 5px; }
+h3 { font-weight: bold; font-size: 16px; margin: 5px; margin-left: 0px; }
table .titles { font-weight: bold; }
#tabs { margin: 5px; }
@@ -99,8 +99,6 @@ table .titles { font-weight: bold; }
#name { width: 145px; }
#comment { width: 89.5%; }
-.dash_left { float: left; width: 440px; }
-.dash_sidebar { float: right; width: 310px; }
.note { padding: 5px; }
.auth { padding: 5px; }
#notes_add { padding: 5px; }
@@ -138,9 +136,22 @@ border-radius: 10px;
.contest_qso_box table {
width: 695px;
}
+
+td.item {
+ padding-bottom: 5px;
+}
+
+.dashboard {
+ padding: 5px;
+}
+
+.dashboard_top { margin-top: 5px; }
+.dashboard_log { float: left; width: 440px; }
+.dashboard_breakdown { float: right; width: 310px; }
+.dashboard_bottom .chart { float: left; }
-