Added "Via" as option for labels
这个提交包含在:
父节点
5df64cb1e8
当前提交
613d17642c
共有 2 个文件被更改,包括 26 次插入 和 13 次删除
|
|
@ -134,28 +134,30 @@ class Labels extends CI_Controller {
|
||||||
$ids = xss_clean(json_decode($this->input->post('id')));
|
$ids = xss_clean(json_decode($this->input->post('id')));
|
||||||
$offset = xss_clean($this->input->post('startat'));
|
$offset = xss_clean($this->input->post('startat'));
|
||||||
$grid = $this->input->post('grid') === "true" ? 1 : 0;
|
$grid = $this->input->post('grid') === "true" ? 1 : 0;
|
||||||
|
$via = $this->input->post('via') === "true" ? 1 : 0;
|
||||||
$this->load->model('labels_model');
|
$this->load->model('labels_model');
|
||||||
$result = $this->labels_model->export_printrequestedids($ids);
|
$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) {
|
public function print($station_id) {
|
||||||
$clean_id = xss_clean($station_id);
|
$clean_id = xss_clean($station_id);
|
||||||
$offset = xss_clean($this->input->post('startat'));
|
$offset = xss_clean($this->input->post('startat'));
|
||||||
$grid = xss_clean($this->input->post('grid') ?? 0);
|
$grid = xss_clean($this->input->post('grid') ?? 0);
|
||||||
|
$via = xss_clean($this->input->post('via') ?? 0);
|
||||||
$this->load->model('stations');
|
$this->load->model('stations');
|
||||||
if ($this->stations->check_station_is_accessible($station_id)) {
|
if ($this->stations->check_station_is_accessible($station_id)) {
|
||||||
$this->load->model('labels_model');
|
$this->load->model('labels_model');
|
||||||
$result = $this->labels_model->export_printrequested($clean_id);
|
$result = $this->labels_model->export_printrequested($clean_id);
|
||||||
|
|
||||||
$this->prepareLabel($result, false, $offset, $grid);
|
$this->prepareLabel($result, false, $offset, $grid, $via);
|
||||||
} else {
|
} else {
|
||||||
redirect('labels');
|
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');
|
$this->load->model('labels_model');
|
||||||
$label = $this->labels_model->getDefaultLabel();
|
$label = $this->labels_model->getDefaultLabel();
|
||||||
|
|
||||||
|
|
@ -231,9 +233,9 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
if ($qsos->num_rows() > 0) {
|
if ($qsos->num_rows() > 0) {
|
||||||
if ($label->qsos == 1) {
|
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 {
|
} 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 {
|
} else {
|
||||||
$this->session->set_flashdata('message', '0 QSOs found for print!');
|
$this->session->set_flashdata('message', '0 QSOs found for print!');
|
||||||
|
|
@ -242,7 +244,7 @@ class Labels extends CI_Controller {
|
||||||
$pdf->Output();
|
$pdf->Output();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid) {
|
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via) {
|
||||||
$text = '';
|
$text = '';
|
||||||
$current_callsign = '';
|
$current_callsign = '';
|
||||||
$current_sat = '';
|
$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_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))) {
|
// ((($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)) {
|
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 = [];
|
$qso_data = [];
|
||||||
}
|
}
|
||||||
$current_callsign = $qso->COL_CALL;
|
$current_callsign = $qso->COL_CALL;
|
||||||
|
|
@ -274,6 +276,7 @@ class Labels extends CI_Controller {
|
||||||
'mode' => $qso->COL_MODE,
|
'mode' => $qso->COL_MODE,
|
||||||
'rst' => $qso->COL_RST_SENT,
|
'rst' => $qso->COL_RST_SENT,
|
||||||
'mygrid' => $qso->station_gridsquare,
|
'mygrid' => $qso->station_gridsquare,
|
||||||
|
'via' => $qso->COL_QSL_VIA,
|
||||||
'sat' => $qso->COL_SAT_NAME,
|
'sat' => $qso->COL_SAT_NAME,
|
||||||
'sat_mode' => $this->pretty_sat_mode($qso->COL_SAT_MODE ?? ''),
|
'sat_mode' => $this->pretty_sat_mode($qso->COL_SAT_MODE ?? ''),
|
||||||
'sat_band_rx' => ($qso->COL_BAND_RX ?? ''),
|
'sat_band_rx' => ($qso->COL_BAND_RX ?? ''),
|
||||||
|
|
@ -282,7 +285,7 @@ class Labels extends CI_Controller {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (!empty($qso_data)) {
|
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
|
// 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 ?? ''));
|
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 = [];
|
$tableData = [];
|
||||||
$count_qso = 0;
|
$count_qso = 0;
|
||||||
|
|
@ -310,7 +313,7 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
|
|
||||||
if($count_qso == $qso_per_label){
|
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
|
$tableData = []; // reset the data
|
||||||
$count_qso = 0; // reset the counter
|
$count_qso = 0; // reset the counter
|
||||||
}
|
}
|
||||||
|
|
@ -318,16 +321,20 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
// generate label for remaining QSOs
|
// generate label for remaining QSOs
|
||||||
if($count_qso > 0){
|
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
|
$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 = new \AsciiTable\Builder();
|
||||||
$builder->addRows($tableData);
|
$builder->addRows($tableData);
|
||||||
$text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with ";
|
$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();
|
$text .= $builder->renderTable();
|
||||||
if($qso['sat'] != "") {
|
if($qso['sat'] != "") {
|
||||||
if (($qso['sat_mode'] == '') && ($qso['sat_band_rx'] !== '')) {
|
if (($qso['sat_mode'] == '') && ($qso['sat_band_rx'] !== '')) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@
|
||||||
<input class="form-check-input" type="checkbox" name="grid" id="grid">
|
<input class="form-check-input" type="checkbox" name="grid" id="grid">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="my-1 mr-2 col-md-4" for="via">Include Via (if filled)?</label>
|
||||||
|
<div class="form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="via" id="via">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="my-1 mr-2 col-md-4" for="startat">Start printing at?</label>
|
<label class="my-1 mr-2 col-md-4" for="startat">Start printing at?</label>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用