Permalink
Browse files

Updated codebase added notes, new dashboard, search features

  • Loading branch information...
1 parent b18cd1b commit ec190cc61e09c1c2f8aedd6fc949ada999e9e59b @magicbug committed Jun 17, 2011
Showing with 4,282 additions and 72 deletions.
  1. +1 −1 application/config/autoload.php
  2. +8 −1 application/config/config.php
  3. +2 −2 application/config/database.php
  4. +131 −1 application/controllers/dashboard.php
  5. +96 −0 application/controllers/notes.php
  6. +110 −3 application/controllers/qso.php
  7. +26 −0 application/controllers/search.php
  8. +40 −0 application/models/dxcc.php
  9. +134 −2 application/models/logbook_model.php
  10. +202 −1 application/views/dashboard/index.php
  11. +1 −1 application/views/layout/footer.php
  12. +70 −18 application/views/layout/header.php
  13. +70 −0 application/views/notes/add.php
  14. +72 −0 application/views/notes/edit.php
  15. +22 −0 application/views/notes/main.php
  16. +12 −0 application/views/notes/view.php
  17. +75 −0 application/views/qso/edit.php
  18. +174 −37 application/views/qso/index.php
  19. +22 −0 application/views/search/main.php
  20. +14 −5 application/views/view_log/index.php
  21. BIN css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png
  22. BIN css/flick/images/ui-bg_flat_0_eeeeee_40x100.png
  23. BIN css/flick/images/ui-bg_flat_55_ffffff_40x100.png
  24. BIN css/flick/images/ui-bg_flat_75_ffffff_40x100.png
  25. BIN css/flick/images/ui-bg_glass_65_ffffff_1x400.png
  26. BIN css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png
  27. BIN css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png
  28. BIN css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png
  29. BIN css/flick/images/ui-icons_0073ea_256x240.png
  30. BIN css/flick/images/ui-icons_454545_256x240.png
  31. BIN css/flick/images/ui-icons_666666_256x240.png
  32. BIN css/flick/images/ui-icons_ff0084_256x240.png
  33. BIN css/flick/images/ui-icons_ffffff_256x240.png
  34. +578 −0 css/flick/jquery-ui-1.8.12.custom.css
  35. BIN css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
  36. BIN css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
  37. BIN css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
  38. BIN css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png
  39. BIN css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png
  40. BIN css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png
  41. BIN css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png
  42. BIN css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
  43. BIN css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
  44. BIN css/ui-lightness/images/ui-icons_222222_256x240.png
  45. BIN css/ui-lightness/images/ui-icons_228ef1_256x240.png
  46. BIN css/ui-lightness/images/ui-icons_ef8c08_256x240.png
  47. BIN css/ui-lightness/images/ui-icons_ffd27a_256x240.png
  48. BIN css/ui-lightness/images/ui-icons_ffffff_256x240.png
  49. +578 −0 css/ui-lightness/jquery-ui-1.8.12.custom.css
  50. BIN images/body.png
  51. BIN images/grey_bg.png
  52. BIN images/jaysalvat.png
  53. BIN images/markitup.png
  54. +27 −0 images/style.css
  55. +16 −0 js/jquery-1.5.1.min.js
  56. +783 −0 js/jquery-ui-1.8.12.custom.min.js
  57. +574 −0 markitup/jquery.markitup.js
  58. BIN markitup/sets/default/images/bold.png
  59. BIN markitup/sets/default/images/clean.png
  60. BIN markitup/sets/default/images/image.png
  61. BIN markitup/sets/default/images/italic.png
  62. BIN markitup/sets/default/images/link.png
  63. BIN markitup/sets/default/images/picture.png
  64. BIN markitup/sets/default/images/preview.png
  65. BIN markitup/sets/default/images/stroke.png
  66. +27 −0 markitup/sets/default/set.js
  67. +27 −0 markitup/sets/default/style.css
  68. BIN markitup/sets/html/images/bold.png
  69. BIN markitup/sets/html/images/clean.png
  70. BIN markitup/sets/html/images/h1.png
  71. BIN markitup/sets/html/images/h2.png
  72. BIN markitup/sets/html/images/h3.png
  73. BIN markitup/sets/html/images/h4.png
  74. BIN markitup/sets/html/images/h5.png
  75. BIN markitup/sets/html/images/h6.png
  76. BIN markitup/sets/html/images/image.png
  77. BIN markitup/sets/html/images/italic.png
  78. BIN markitup/sets/html/images/link.png
  79. BIN markitup/sets/html/images/list-bullet.png
  80. BIN markitup/sets/html/images/list-item.png
  81. BIN markitup/sets/html/images/list-numeric.png
  82. BIN markitup/sets/html/images/paragraph.png
  83. BIN markitup/sets/html/images/picture.png
  84. BIN markitup/sets/html/images/preview.png
  85. BIN markitup/sets/html/images/stroke.png
  86. +11 −0 markitup/sets/html/readme.txt
  87. +39 −0 markitup/sets/html/set.js
  88. +59 −0 markitup/sets/html/style.css
  89. BIN markitup/skins/markitup/images/bg-container.png
  90. BIN markitup/skins/markitup/images/bg-editor-bbcode.png
  91. BIN markitup/skins/markitup/images/bg-editor-dotclear.png
  92. BIN markitup/skins/markitup/images/bg-editor-html.png
  93. BIN markitup/skins/markitup/images/bg-editor-json.png
  94. BIN markitup/skins/markitup/images/bg-editor-markdown.png
  95. BIN markitup/skins/markitup/images/bg-editor-textile.png
  96. BIN markitup/skins/markitup/images/bg-editor-wiki.png
  97. BIN markitup/skins/markitup/images/bg-editor-xml.png
  98. BIN markitup/skins/markitup/images/bg-editor.png
  99. BIN markitup/skins/markitup/images/handle.png
  100. BIN markitup/skins/markitup/images/menu.png
  101. BIN markitup/skins/markitup/images/submenu.png
  102. +147 −0 markitup/skins/markitup/style.css
  103. BIN markitup/skins/simple/images/handle.png
  104. BIN markitup/skins/simple/images/menu.png
  105. BIN markitup/skins/simple/images/submenu.png
  106. +118 −0 markitup/skins/simple/style.css
  107. +5 −0 markitup/templates/preview.css
  108. +11 −0 markitup/templates/preview.html
@@ -52,7 +52,7 @@
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/
-$autoload['libraries'] = array('database');
+$autoload['libraries'] = array('database', 'session');
/*
@@ -1,5 +1,12 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/* Logbook options */
+
+$config['table_name'] = "table_hrd_contacts_v01";
+$config['locator'] = "IO91JS";
+$config['display_freq'] = false; // hide and display freq input on Add QSO
+$config['google_maps_api'] = "ABQIAAAA74tY2H5PTGpzLdnwXQmLXxTAaiXfF7TN3brq2P-N4wxlXpK9XRR0YWnumNpDAv2MVqJhk4dDpznb9A";
+
/*
|--------------------------------------------------------------------------
| Base Site URL
@@ -224,7 +231,7 @@
| MUST set an encryption key. See the user guide for info.
|
*/
-$config['encryption_key'] = '';
+$config['encryption_key'] = 'flossie1234555541';
/*
|--------------------------------------------------------------------------
@@ -42,9 +42,9 @@
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
-$db['default']['username'] = '';
+$db['default']['username'] = 'root';
$db['default']['password'] = '';
-$db['default']['database'] = '';
+$db['default']['database'] = '2e0sql_log';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
@@ -2,10 +2,140 @@
class Dashboard extends CI_Controller {
+ /*
+ TODO
+ - DXCLuster Spots
+ - Breakdown of QSOs per band/mode
+ - Countries worked
+ */
+
public function index()
{
+
+ // Database connections
+ $this->load->model('logbook_model');
+
+ // Store info
+ $data['todays_qsos'] = $this->logbook_model->todays_qsos();
+ $data['total_qsos'] = $this->logbook_model->total_qsos();
+ $data['month_qsos'] = $this->logbook_model->month_qsos();
+ $data['year_qsos'] = $this->logbook_model->year_qsos();
+
+ $data['total_ssb'] = $this->logbook_model->total_ssb();
+ $data['total_cw'] = $this->logbook_model->total_cw();
+ $data['total_fm'] = $this->logbook_model->total_fm();
+ $data['total_digi'] = $this->logbook_model->total_digi();
+
+ $data['total_bands'] = $this->logbook_model->total_bands();
+
+ $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('9');
+
+
$this->load->view('layout/header');
- $this->load->view('dashboard/index');
+ $this->load->view('dashboard/index', $data);
$this->load->view('layout/footer');
}
+
+ function todays_map() {
+
+ $this->load->model('logbook_model');
+ $qsos = $this->logbook_model->get_todays_qsos('');
+
+
+ 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."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />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."<br />Date/Time: ".$row->COL_TIME_ON."<br />Band: ".$row->COL_BAND."<br />Mode: ".$row->COL_MODE."\",\"label\":\"".$row->COL_CALL."\"},";
+ }
+ }
+
+ }
+ echo "]";
+ echo "}";
+
+ }
+}
+
+function distance($lat1, $lon1, $lat2, $lon2, $unit = 'M') {
+ $theta = $lon1 - $lon2;
+ $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) *
+cos(deg2rad($theta));
+ $dist = acos($dist);
+ $dist = rad2deg($dist);
+ $dist = $dist * 60 * 1.1515;
+
+ if ($unit == "K") {
+ $dist *= 1.609344;
+ } else if ($unit == "N") {
+ $dist *= 0.8684;
+ }
+
+ return round($dist, 1);
+}
+
+function bearing($lat1, $lon1, $lat2, $lon2) {
+ if (round($lon1, 1) == round($lon2, 1)) {
+ if ($lat1 < $lat2) {
+ $bearing = 0;
+ } else {
+ $bearing = 180;
+ }
+ } else {
+ $dist = distance($lat1, $lon1, $lat2, $lon2, 'N');
+ $arad = acos((sin(deg2rad($lat2)) - sin(deg2rad($lat1)) * cos(deg2rad($dist / 60))) / (sin(deg2rad($dist
+/ 60)) * cos(deg2rad($lat1))));
+ $bearing = $arad * 180 / pi();
+ if (sin(deg2rad($lon2 - $lon1)) < 0) {
+ $bearing = 360 - $bearing;
+ }
+ }
+
+ $dirs = array("N","E","S","W");
+
+ $rounded = round($bearing / 22.5) % 16;
+ if (($rounded % 4) == 0) {
+ $dir = $dirs[$rounded / 4];
+ } else {
+ $dir = $dirs[2 * floor(((floor($rounded / 4) + 1) % 4) / 2)];
+ $dir .= $dirs[1 + 2 * floor($rounded / 8)];
+ #if ($rounded % 2 == 1)
+ # $dir = $dirs[round_to_int($rounded/4) % 4] . "-" . $dir;
+ }
+
+ #return $dir;
+ return round($bearing, 0)."&#186; ".$dir." ".$dist." miles";
+}
+
+function qra2latlong($strQRA)
+
+{
+ $strQRA = strtoupper($strQRA);
+ if (strlen($strQRA) == 4) $strQRA .= "MM";
+ if (!preg_match('/^[A-Z]{2}[0-9]{2}[A-Z]{2}$/',$strQRA)) return false;
+ list($a,$b,$c,$d,$e,$f) = str_split($strQRA,1);
+ $a = ord($a) - ord('A');
+ $b = ord($b) - ord('A');
+ $c = ord($c) - ord('0');
+ $d = ord($d) - ord('0');
+ $e = ord($e) - ord('A');
+ $f = ord($f) - ord('A');
+ $nLong = ($a*20) + ($c*2) + (($e+0.5)/12) - 180;
+ $nLat = ($b*10) + $d + (($f+0.5)/24) - 90;
+ $arLatLong = array($nLat,$nLong);
+ return($arLatLong);
+
}
@@ -0,0 +1,96 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+class Notes extends CI_Controller {
+
+ /* Displays all notes in a list */
+ public function index()
+ {
+
+ $data['notes'] = $this->db->get('notes');
+
+ $this->load->view('layout/header');
+ $this->load->view('notes/main', $data);
+ $this->load->view('layout/footer');
+ }
+
+ /* Provides function for adding notes to the system. */
+ function add() {
+
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('title', 'Note Title', 'required');
+ $this->form_validation->set_rules('content', 'Content', 'required');
+
+
+ if ($this->form_validation->run() == FALSE)
+ {
+ $this->load->view('layout/header');
+ $this->load->view('notes/add');
+ $this->load->view('layout/footer');
+ }
+ else
+ {
+ $data = array(
+ 'cat' => $this->input->post('category'),
+ 'title' => $this->input->post('title'),
+ 'note' => $this->input->post('content')
+ );
+
+ $this->db->insert('notes', $data);
+
+ redirect('notes');
+ }
+ }
+
+ /* View Notes */
+ function view($id) {
+ // Get Note
+ $this->db->where('id', $id);
+ $data['note'] = $this->db->get('notes');
+
+ // Display
+ $this->load->view('layout/header');
+ $this->load->view('notes/view',$data);
+ $this->load->view('layout/footer');
+ }
+
+ /* Edit Notes */
+ function edit($id) {
+
+ $data['id'] = $id;
+ $this->db->where('id', $id);
+ $data['note'] = $this->db->get('notes');
+
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('title', 'Note Title', 'required');
+ $this->form_validation->set_rules('content', 'Content', 'required');
+
+
+ if ($this->form_validation->run() == FALSE)
+ {
+ $this->load->view('layout/header');
+ $this->load->view('notes/edit', $data);
+ $this->load->view('layout/footer');
+ }
+ else
+ {
+ $data = array(
+ 'cat' => $this->input->post('category'),
+ 'title' => $this->input->post('title'),
+ 'note' => $this->input->post('content')
+ );
+
+ $this->db->where('id', $this->input->post('id'));
+ $this->db->update('notes', $data);
+
+ redirect('notes');
+ }
+ }
+
+ /* Delete Note */
+ function delete($id) {
+ $this->db->delete('notes', array('id' => $id));
+ redirect('notes');
+ }
+}
Oops, something went wrong.

0 comments on commit ec190cc

Please sign in to comment.