kopia lustrzana https://github.com/magicbug/Cloudlog
Print activator references on QSO labels
rodzic
01ba223c27
commit
cb85ad2144
|
@ -135,10 +135,11 @@ class Labels extends CI_Controller {
|
||||||
$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;
|
$via = $this->input->post('via') === "true" ? 1 : 0;
|
||||||
|
$awards = $this->input->post('awards') === "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, $via);
|
$this->prepareLabel($result, true, $offset, $grid, $via, $awards);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function print($station_id) {
|
public function print($station_id) {
|
||||||
|
@ -146,18 +147,19 @@ class Labels extends CI_Controller {
|
||||||
$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);
|
$via = xss_clean($this->input->post('via') ?? 0);
|
||||||
|
$awards = xss_clean($this->input->post('awards') ?? 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, $via);
|
$this->prepareLabel($result, false, $offset, $grid, $via, $awards);
|
||||||
} else {
|
} else {
|
||||||
redirect('labels');
|
redirect('labels');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false) {
|
function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false, $awards = false) {
|
||||||
$this->load->model('labels_model');
|
$this->load->model('labels_model');
|
||||||
$label = $this->labels_model->getDefaultLabel();
|
$label = $this->labels_model->getDefaultLabel();
|
||||||
|
|
||||||
|
@ -232,11 +234,7 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($qsos->num_rows() > 0) {
|
if ($qsos->num_rows() > 0) {
|
||||||
if ($label->qsos == 1) {
|
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via, $awards);
|
||||||
$this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via);
|
|
||||||
} else {
|
|
||||||
$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!');
|
||||||
redirect('labels');
|
redirect('labels');
|
||||||
|
@ -244,7 +242,7 @@ class Labels extends CI_Controller {
|
||||||
$pdf->Output();
|
$pdf->Output();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via) {
|
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via, $awards) {
|
||||||
$text = '';
|
$text = '';
|
||||||
$current_callsign = '';
|
$current_callsign = '';
|
||||||
$current_sat = '';
|
$current_sat = '';
|
||||||
|
@ -261,7 +259,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, $via);
|
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $awards);
|
||||||
$qso_data = [];
|
$qso_data = [];
|
||||||
}
|
}
|
||||||
$current_callsign = $qso->COL_CALL;
|
$current_callsign = $qso->COL_CALL;
|
||||||
|
@ -281,19 +279,46 @@ class Labels extends CI_Controller {
|
||||||
'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 ?? ''),
|
||||||
'qsl_recvd' => $qso->COL_QSL_RCVD,
|
'qsl_recvd' => $qso->COL_QSL_RCVD,
|
||||||
'mycall' => $qso->COL_STATION_CALLSIGN
|
'mycall' => $qso->COL_STATION_CALLSIGN,
|
||||||
|
'awards' => $this->stationAwardsList($qso)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (!empty($qso_data)) {
|
if (!empty($qso_data)) {
|
||||||
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via);
|
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $awards);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stationAwardsList($station_profile) {
|
||||||
|
$awards = "";
|
||||||
|
if (trim($station_profile->station_iota) !== '') {
|
||||||
|
$awards .= "IOTA:" . $station_profile->station_iota . " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($station_profile->station_sota) !== '') {
|
||||||
|
$awards .= "SOTA:" . $station_profile->station_sota . " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($station_profile->station_wwff) !== '') {
|
||||||
|
$awards .= "WWFF:" . $station_profile->station_wwff . " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($station_profile->station_pota) !== '') {
|
||||||
|
$awards .= "POTA:" . $station_profile->station_pota . " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($station_profile->station_sig) !== '' && trim($station_profile->station_sig_info) !== '') {
|
||||||
|
$awards .= $station_profile->station_sig . ":" . $station_profile->station_sig_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $awards;
|
||||||
|
}
|
||||||
|
|
||||||
// New begin
|
// New begin
|
||||||
function pretty_sat_mode($sat_mode) {
|
function pretty_sat_mode($sat_mode) {
|
||||||
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, $via) {
|
function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via, $awards) {
|
||||||
|
|
||||||
$tableData = [];
|
$tableData = [];
|
||||||
$count_qso = 0;
|
$count_qso = 0;
|
||||||
|
@ -313,7 +338,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, $via);
|
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $awards);
|
||||||
$tableData = []; // reset the data
|
$tableData = []; // reset the data
|
||||||
$count_qso = 0; // reset the counter
|
$count_qso = 0; // reset the counter
|
||||||
}
|
}
|
||||||
|
@ -321,12 +346,12 @@ 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, $via);
|
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $awards);
|
||||||
$preliminaryData = []; // reset the data
|
$preliminaryData = []; // reset the data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false){
|
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false, $awards=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 ";
|
||||||
|
@ -347,6 +372,7 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
$text.="\n";
|
$text.="\n";
|
||||||
if ($grid) { $text .= "My call: ".$qso['mycall']." Grid: ".$qso['mygrid']."\n"; }
|
if ($grid) { $text .= "My call: ".$qso['mycall']." Grid: ".$qso['mygrid']."\n"; }
|
||||||
|
if ($awards) { $text .= $qso['awards']."\n"; }
|
||||||
$text .= "Thanks for the QSO".($numofqsos>1 ? 's' : '');
|
$text .= "Thanks for the QSO".($numofqsos>1 ? 's' : '');
|
||||||
$text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL";
|
$text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL";
|
||||||
$pdf->Add_Label($text,$orientation);
|
$pdf->Add_Label($text,$orientation);
|
||||||
|
|
|
@ -11,6 +11,12 @@
|
||||||
<input class="form-check-input" type="checkbox" name="via" id="via">
|
<input class="form-check-input" type="checkbox" name="via" id="via">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3 row">
|
||||||
|
<label class="my-1 me-2 col-md-4" for="via">Include awards?</label>
|
||||||
|
<div class="form-check-inline">
|
||||||
|
<input class="form-check-input" type="checkbox" name="awards" id="awards">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label class="my-1 me-2 col-md-4" for="startat">Start printing at?</label>
|
<label class="my-1 me-2 col-md-4" for="startat">Start printing at?</label>
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
|
|
Ładowanie…
Reference in New Issue