diff --git a/application/controllers/Qslprint.php b/application/controllers/Qslprint.php index fc2f2c00..3de67e65 100644 --- a/application/controllers/Qslprint.php +++ b/application/controllers/Qslprint.php @@ -149,6 +149,22 @@ class QSLPrint extends CI_Controller { $data['station_id'] = $station_id; $this->load->view('qslprint/qslprint', $data); } + + public function open_qso_list() { + $callsign = $this->input->post('callsign'); + $this->load->model('qslprint_model'); + + $data['qsos'] = $this->qslprint_model->open_qso_list($this->security->xss_clean($callsign)); + $this->load->view('qslprint/qsolist', $data); + } + + public function add_qso_to_print_queue() { + $id = $this->input->post('id'); + $this->load->model('qslprint_model'); + + $this->qslprint_model->add_qso_to_print_queue($this->security->xss_clean($id)); + } + } /* End of file Qslprint.php */ diff --git a/application/models/Qslprint_model.php b/application/models/Qslprint_model.php index 354e2460..b32ef8b5 100644 --- a/application/models/Qslprint_model.php +++ b/application/models/Qslprint_model.php @@ -63,6 +63,28 @@ class Qslprint_model extends CI_Model { return true; } + + function add_qso_to_print_queue($id) { + $data = array( + 'COL_QSL_SENT' => "R", + ); + + $this->db->where("COL_PRIMARY_KEY", $id); + $this->db->update($this->config->item('table_name'), $data); + + return true; + } + + function open_qso_list($callsign) { + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->where('COL_CALL like "%'.$callsign.'%"'); + $this->db->where('coalesce(COL_QSL_SENT, "") not in ("R", "Q")'); + $this->db->order_by("COL_TIME_ON", "ASC"); + $query = $this->db->get($this->config->item('table_name')); + + return $query; + } + } ?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 7eab74c4..c8195c33 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2041,13 +2041,58 @@ function deleteQsl(id) { type: 'post', data: {'id': id }, success: function(html) { - location.reload(); + $("#qslprint_"+id).remove(); } }); } }); } + function openQsoList(callsign) { + $.ajax({ + url: base_url + 'index.php/qslprint/open_qso_list', + type: 'post', + data: {'callsign': callsign}, + success: function(html) { + BootstrapDialog.show({ + title: 'QSO List', + size: BootstrapDialog.SIZE_WIDE, + cssClass: 'qso-dialog', + nl2br: false, + message: html, + buttons: [{ + label: 'Close', + action: function (dialogItself) { + dialogItself.close(); + } + }] + }); + } + }); + } + + function addQsoToPrintQueue(id) { + $.ajax({ + url: base_url + 'index.php/qslprint/add_qso_to_print_queue', + type: 'post', + data: {'id': id}, + success: function(html) { + var line = ''; + line += ''+$("#qsolist_"+id).find("td:eq(0)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(1)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(2)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(3)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(4)").text()+''; + line += ''+$("#qsolist_"+id).find("td:eq(5)").text()+''; + line += ''; + line += ''; + line += ''; + $('.table tr:last').after(line); + $("#qsolist_"+id).remove();'' + } + }); + } + $(".station_id").change(function(){ var station_id = $(".station_id").val(); $.ajax({ diff --git a/application/views/qslprint/index.php b/application/views/qslprint/index.php index 9e236c3a..dbbc9a98 100644 --- a/application/views/qslprint/index.php +++ b/application/views/qslprint/index.php @@ -42,6 +42,7 @@ ' . $this->lang->line('gen_hamradio_band') . ' ' . $this->lang->line('gen_hamradio_station') . ' + '; @@ -55,14 +56,15 @@ } foreach ($qsos->result() as $qsl) { - echo ''; + echo ''; echo '' . $qsl->COL_CALL . ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ''; echo '' . $qsl->station_callsign . ''; - echo ''; + echo ''; + echo ''; echo ''; } diff --git a/application/views/qslprint/qslprint.php b/application/views/qslprint/qslprint.php index ca215d6f..7c34a942 100644 --- a/application/views/qslprint/qslprint.php +++ b/application/views/qslprint/qslprint.php @@ -10,6 +10,7 @@ if ($qsos->result() != NULL) { ' . $this->lang->line('gen_hamradio_band') . ' ' . $this->lang->line('gen_hamradio_station') . ' + '; @@ -23,14 +24,15 @@ if ($qsos->result() != NULL) { } foreach ($qsos->result() as $qsl) { - echo ''; + echo ''; echo '' . $qsl->COL_CALL . ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ''; echo '' . $qsl->station_callsign . ''; - echo ''; + echo ''; + echo ''; echo ''; } diff --git a/application/views/qslprint/qsolist.php b/application/views/qslprint/qsolist.php new file mode 100644 index 00000000..bbf28c23 --- /dev/null +++ b/application/views/qslprint/qsolist.php @@ -0,0 +1,44 @@ +result() != NULL) { + echo ' + + + + + + + + + + + '; + + // Get Date format + if($this->session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + foreach ($qsos->result() as $qsl) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '
'.$this->lang->line('gen_hamradio_callsign').'' . $this->lang->line('general_word_date') . ''. $this->lang->line('general_word_time') .'' . $this->lang->line('gen_hamradio_mode') . '' . $this->lang->line('gen_hamradio_band') . '' . $this->lang->line('gen_hamradio_station') . '
' . $qsl->COL_CALL . ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '' . $qsl->station_callsign . '
'; + ?> + + ×No additional QSO\'s were found. That means they are probably already in the queue.'; +} +?>