diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index 008ec762..cf0b966c 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -134,28 +134,30 @@ class Labels extends CI_Controller { $ids = xss_clean(json_decode($this->input->post('id'))); $offset = xss_clean($this->input->post('startat')); $grid = $this->input->post('grid') === "true" ? 1 : 0; + $via = $this->input->post('via') === "true" ? 1 : 0; $this->load->model('labels_model'); $result = $this->labels_model->export_printrequestedids($ids); - $this->prepareLabel($result, true, $offset, $grid); + $this->prepareLabel($result, true, $offset, $grid, $via); } public function print($station_id) { $clean_id = xss_clean($station_id); $offset = xss_clean($this->input->post('startat')); $grid = xss_clean($this->input->post('grid') ?? 0); + $via = xss_clean($this->input->post('via') ?? 0); $this->load->model('stations'); if ($this->stations->check_station_is_accessible($station_id)) { $this->load->model('labels_model'); $result = $this->labels_model->export_printrequested($clean_id); - $this->prepareLabel($result, false, $offset, $grid); + $this->prepareLabel($result, false, $offset, $grid, $via); } else { redirect('labels'); } } - function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false) { + function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false) { $this->load->model('labels_model'); $label = $this->labels_model->getDefaultLabel(); @@ -231,9 +233,9 @@ class Labels extends CI_Controller { if ($qsos->num_rows() > 0) { if ($label->qsos == 1) { - $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid); + $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via); } else { - $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid); + $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via); } } else { $this->session->set_flashdata('message', '0 QSOs found for print!'); @@ -242,7 +244,7 @@ class Labels extends CI_Controller { $pdf->Output(); } - function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid) { + function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via) { $text = ''; $current_callsign = ''; $current_sat = ''; @@ -259,7 +261,7 @@ class Labels extends CI_Controller { ( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) { // ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) { if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); $qso_data = []; } $current_callsign = $qso->COL_CALL; @@ -274,6 +276,7 @@ class Labels extends CI_Controller { 'mode' => $qso->COL_MODE, 'rst' => $qso->COL_RST_SENT, 'mygrid' => $qso->station_gridsquare, + 'via' => $qso->COL_QSL_VIA, 'sat' => $qso->COL_SAT_NAME, 'sat_mode' => $this->pretty_sat_mode($qso->COL_SAT_MODE ?? ''), 'sat_band_rx' => ($qso->COL_BAND_RX ?? ''), @@ -282,7 +285,7 @@ class Labels extends CI_Controller { ]; } if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via); } } // New begin @@ -290,7 +293,7 @@ class Labels extends CI_Controller { return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? '')); } - function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid) { + function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via) { $tableData = []; $count_qso = 0; @@ -310,7 +313,7 @@ class Labels extends CI_Controller { if($count_qso == $qso_per_label){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); $tableData = []; // reset the data $count_qso = 0; // reset the counter } @@ -318,16 +321,20 @@ class Labels extends CI_Controller { } // generate label for remaining QSOs if($count_qso > 0){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via); $preliminaryData = []; // reset the data } } - function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true){ + function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false){ $builder = new \AsciiTable\Builder(); $builder->addRows($tableData); $text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with "; - $text .= $current_callsign."\n"; + $text .= $current_callsign; + if (($via) && ($qso['via'] ?? '' != '')) { + $text.=' via '.substr($qso['via'],0,8); + } + $text .= "\n"; $text .= $builder->renderTable(); if($qso['sat'] != "") { if (($qso['sat_mode'] == '') && ($qso['sat_band_rx'] !== '')) { diff --git a/application/views/labels/startatform.php b/application/views/labels/startatform.php index a9de4d26..8bcf78ce 100644 --- a/application/views/labels/startatform.php +++ b/application/views/labels/startatform.php @@ -5,6 +5,12 @@ +
+ +
+ +
+