diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index 755c8246..0d924477 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -257,6 +257,23 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer'); } + /* + Handles showing worked POTAs + Comment field - POTA:# + */ + public function pota() { + + // Grab all worked pota stations + $this->load->model('pota'); + $data['pota_all'] = $this->pota->get_all(); + + // Render page + $data['page_title'] = "Awards - POTA"; + $this->load->view('interface_assets/header', $data); + $this->load->view('awards/pota/index'); + $this->load->view('interface_assets/footer'); + } + public function cq() { $CI =& get_instance(); $CI->load->model('logbooks_model'); diff --git a/application/migrations/102_add_pota_columns.php b/application/migrations/102_add_pota_columns.php index 204857da..1bb206a4 100644 --- a/application/migrations/102_add_pota_columns.php +++ b/application/migrations/102_add_pota_columns.php @@ -37,6 +37,17 @@ class Migration_add_pota_columns extends CI_Migration { ); $this->dbforge->add_column('station_profile', $fields); } + if (!$this->db->field_exists('pota', 'bandxuser')) { + $fields = array( + 'pota' => array( + 'type' => 'INT', + 'constraint' => 20, + 'unsigned' => TRUE, + ), + ); + $this->dbforge->add_column('bandxuser', $fields); + $this->db->query("update bandxuser set pota = 1"); + } } public function down() @@ -50,5 +61,8 @@ class Migration_add_pota_columns extends CI_Migration { if ($this->db->field_exists('station_pota', 'station_profile')) { $this->dbforge->drop_column('station_profile', 'station_pota'); } + if ($this->db->field_exists('pota', 'bandxuser')) { + $this->dbforge->drop_column('bandxuser', 'pota'); + } } } diff --git a/application/models/Bands.php b/application/models/Bands.php index a31582e5..73696862 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -247,6 +247,7 @@ class Bands extends CI_Model { 'dok' => $band['dok'] == "true" ? '1' : '0', 'dxcc' => $band['dxcc'] == "true" ? '1' : '0', 'iota' => $band['iota'] == "true" ? '1' : '0', + 'pota' => $band['pota'] == "true" ? '1' : '0', 'sig' => $band['sig'] == "true" ? '1' : '0', 'sota' => $band['sota'] == "true" ? '1' : '0', 'uscounties' => $band['uscounties'] == "true" ? '1' : '0', @@ -279,8 +280,8 @@ class Bands extends CI_Model { $this->db->insert('bands', $data); } - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) - select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); + $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) + select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); } function getband($id) { @@ -305,4 +306,4 @@ class Bands extends CI_Model { } } -?> \ No newline at end of file +?> diff --git a/application/models/Pota.php b/application/models/Pota.php new file mode 100644 index 00000000..117a8c42 --- /dev/null +++ b/application/models/Pota.php @@ -0,0 +1,27 @@ +load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + if (!$logbooks_locations_array) { + return null; + } + + $this->load->model('bands'); + + $bandslots = $this->bands->get_worked_bands('pota'); + + $this->db->where_in("station_id", $logbooks_locations_array); + $this->db->where_in("col_band", $bandslots); + $this->db->order_by("COL_POTA_REF", "ASC"); + $this->db->where('COL_POTA_REF !=', ''); + + return $this->db->get($this->config->item('table_name')); + } +} + +?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 2292ed0b..2d2cb88f 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -152,7 +152,7 @@ class User_Model extends CI_Model { // Add user and insert bandsettings for user $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); + $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); return OK; } else { return EUSERNAMEEXISTS; diff --git a/application/views/awards/pota/index.php b/application/views/awards/pota/index.php new file mode 100644 index 00000000..65d4abe8 --- /dev/null +++ b/application/views/awards/pota/index.php @@ -0,0 +1,44 @@ +
+ +

+ + + + + + + + + + + + + + + num_rows() > 0) { + foreach ($pota_all->result() as $row) { + ?> + + + + + + + + + + + +
ReferenceDate/TimeCallsignBandRST SentRST Received
+ COL_POTA_REF; ?> + COL_TIME_ON); echo date('d/m/y', $timestamp); ?> - COL_TIME_ON); echo date('H:i', $timestamp); ?>COL_CALL; ?>COL_BAND; ?>COL_RST_SENT; ?>COL_RST_RCVD; ?>
+ ×Nothing found!
'; + }?> + diff --git a/application/views/bands/index.php b/application/views/bands/index.php index ad01691e..51ec567f 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -32,6 +32,7 @@ DOK DXCC IOTA + POTA SIG SOTA US Counties @@ -55,6 +56,7 @@ dok == 1) {echo 'checked';}?>> dxcc == 1) {echo 'checked';}?>> iota == 1) {echo 'checked';}?>> + pota == 1) {echo 'checked';}?>> sig == 1) {echo 'checked';}?>> sota == 1) {echo 'checked';}?>> uscounties == 1) {echo 'checked';}?>> diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 7f55ea71..0918e572 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -116,6 +116,8 @@ DXCC IOTA + + POTA SIG diff --git a/assets/js/sections/bands.js b/assets/js/sections/bands.js index 806fa529..dbcd9273 100644 --- a/assets/js/sections/bands.js +++ b/assets/js/sections/bands.js @@ -186,6 +186,7 @@ function saveBand(id) { 'dok': $(".dok_"+id+" input[type='checkbox']").is(":checked"), 'dxcc': $(".dxcc_"+id+" input[type='checkbox']").is(":checked"), 'iota': $(".iota_"+id+" input[type='checkbox']").is(":checked"), + 'pota': $(".pota_"+id+" input[type='checkbox']").is(":checked"), 'sig': $(".sig_"+id+" input[type='checkbox']").is(":checked"), 'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"), 'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"), @@ -196,4 +197,4 @@ function saveBand(id) { success: function (html) { } }); -} \ No newline at end of file +}