diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index ad3a39e7..40a1c91a 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -371,6 +371,19 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer'); } + public function was_details_ajax() { + $this->load->model('logbook_model'); + + $state = str_replace('"', "", $this->input->post("State")); + $band = str_replace('"', "", $this->input->post("Band")); + $data['results'] = $this->logbook_model->was_qso_details($state, $band); + + // Render Page + $data['page_title'] = "Log View - WAS"; + $data['filter'] = "state ".$state. " and ".$band; + $this->load->view('awards/was/details_ajax', $data); + } + public function iota () { $this->load->model('iota'); $data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 4a4084dc..1c6a192f 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -129,6 +129,37 @@ class QSO extends CI_Controller { $this->load->view('qso/edit_done'); } } + + function edit_ajax() { + + $this->load->model('logbook_model'); + $this->load->model('user_model'); + + $this->load->library('form_validation'); + + if(!$this->user_model->authorize(2)) { + $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + } + + $id = str_replace('"', "", $this->input->post("id")); + $query = $this->logbook_model->qso_info($id); + + $data['qso'] = $query->row(); + $data['dxcc'] = $this->logbook_model->fetchDxcc(); + $data['iota'] = $this->logbook_model->fetchIota(); + + $this->load->view('qso/edit_ajax', $data); + } + + function qso_save_ajax() { + $this->load->model('logbook_model'); + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { + $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); + } + + $this->logbook_model->edit(); + } function qsl_rcvd($id, $method) { $this->load->model('logbook_model'); @@ -143,6 +174,27 @@ class QSO extends CI_Controller { redirect('logbook'); } + + function qsl_rcvd_ajax() { + $id = str_replace('"', "", $this->input->post("id")); + $method = str_replace('"', "", $this->input->post("method")); + + $this->load->model('logbook_model'); + $this->load->model('user_model'); + + header('Content-Type: application/json'); + + if(!$this->user_model->authorize(2)) { + echo json_encode(array('message' => 'Error')); + + } + else { + // Update Logbook to Mark Paper Card Received + $this->logbook_model->paperqsl_update($id, $method); + + echo json_encode(array('message' => 'OK')); + } + } /* Delete QSO */ function delete($id) { @@ -161,6 +213,18 @@ class QSO extends CI_Controller { redirect($_SERVER['HTTP_REFERER']); } } + + /* Delete QSO */ + function delete_ajax() { + $id = str_replace('"', "", $this->input->post("id")); + + $this->load->model('logbook_model'); + + $this->logbook_model->delete($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } function band_to_freq($band, $mode) { diff --git a/application/models/Was.php b/application/models/Was.php index bb10b21d..bb9b5bbe 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -87,14 +87,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
'; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } diff --git a/application/views/awards/was/details_ajax.php b/application/views/awards/was/details_ajax.php new file mode 100644 index 00000000..59ba1c0e --- /dev/null +++ b/application/views/awards/was/details_ajax.php @@ -0,0 +1,3 @@ +