kopia lustrzana https://github.com/magicbug/Cloudlog
[QSL Labels] Now prints specified number of QSOs on label
rodzic
bb22812a89
commit
d56f4474dc
|
@ -117,8 +117,7 @@ class Labels extends CI_Controller {
|
||||||
'width' => $label->width,
|
'width' => $label->width,
|
||||||
'height' => $label->height,
|
'height' => $label->height,
|
||||||
'font-size' => $label->font_size
|
'font-size' => $label->font_size
|
||||||
)
|
));
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// Standard format
|
// Standard format
|
||||||
$pdf = new PDF_Label('3422');
|
$pdf = new PDF_Label('3422');
|
||||||
|
@ -128,12 +127,23 @@ class Labels extends CI_Controller {
|
||||||
redirect('labels');
|
redirect('labels');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
|
|
||||||
if ($result->num_rows() > 0) {
|
if ($result->num_rows() > 0) {
|
||||||
// output data of each row
|
if ($numberofqsos == 1) {
|
||||||
foreach($result->result() as $qso) {
|
$this->makeOneQsoLabel($result->result(), $pdf);
|
||||||
|
} else {
|
||||||
|
$this->makeMultiQsoLabel($result->result(), $pdf, $label->qsos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->session->set_flashdata('message', '0 QSOs found for print!');
|
||||||
|
redirect('labels');
|
||||||
|
}
|
||||||
|
$pdf->Output();
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeOneQsoLabel($qsos, $pdf) {
|
||||||
|
foreach($qsos as $qso) {
|
||||||
$time = strtotime($qso->COL_TIME_ON);
|
$time = strtotime($qso->COL_TIME_ON);
|
||||||
$myFormatForView = date("d/m/Y H:i", $time);
|
$myFormatForView = date("d/m/Y H:i", $time);
|
||||||
if($qso->COL_SAT_NAME != "") {
|
if($qso->COL_SAT_NAME != "") {
|
||||||
|
@ -144,11 +154,67 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
$pdf->Add_Label($text);
|
$pdf->Add_Label($text);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
echo "0 results";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->Output();
|
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos) {
|
||||||
|
$text = '';
|
||||||
|
$current_callsign = '';
|
||||||
|
$qso_data = [];
|
||||||
|
foreach($qsos as $qso) {
|
||||||
|
if ($qso->COL_CALL !== $current_callsign) {
|
||||||
|
if (!empty($qso_data)) {
|
||||||
|
$this->makeLabel($pdf, $current_callsign, $qso_data, $numberofqsos);
|
||||||
|
$qso_data = [];
|
||||||
|
}
|
||||||
|
$current_callsign = $qso->COL_CALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
$qso_data[] = [
|
||||||
|
'time' => $qso->COL_TIME_ON,
|
||||||
|
'band' => $qso->COL_BAND,
|
||||||
|
'mode' => $qso->COL_MODE,
|
||||||
|
'rst' => $qso->COL_RST_SENT,
|
||||||
|
'mygrid' => $qso->station_gridsquare,
|
||||||
|
'sat' => $qso->COL_SAT_NAME,
|
||||||
|
'sat_mode' => $qso->COL_SAT_MODE,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (!empty($qso_data)) {
|
||||||
|
$this->makeLabel($pdf, $current_callsign, $qso_data, $numberofqsos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeLabel($pdf, $current_callsign, $qso_data, $numberofqsos) {
|
||||||
|
$text = 'To: ' . $current_callsign . "\n\n";
|
||||||
|
$count = 0;
|
||||||
|
$qsotext = '';
|
||||||
|
foreach ($qso_data as $key => $qso) {
|
||||||
|
$time = strtotime($qso['time']);
|
||||||
|
$myFormatForView = date("d/m/Y H:i", $time);
|
||||||
|
|
||||||
|
if($qso['sat'] != "") {
|
||||||
|
$qsotext .= sprintf("%s %s %s %s\n", $myFormatForView, 'on '.$qso['band'].' 2x'.$qso['mode'].' RST '.$qso['rst'].'', 'Satellite: '.$qso['sat'].' Mode: '.strtoupper($qso['sat_mode']).' ', '');
|
||||||
|
} else {
|
||||||
|
$qsotext .= sprintf("%s %s\n", $myFormatForView, 'on '.$qso['band'].' 2x'.$qso['mode'].' RST '.$qso['rst']);
|
||||||
|
}
|
||||||
|
$count++;
|
||||||
|
|
||||||
|
if ($count == $numberofqsos) {
|
||||||
|
$text .= $qsotext;
|
||||||
|
$text .= "\n" . 'Thanks for QSOs.';
|
||||||
|
$pdf->Add_Label($text);
|
||||||
|
$text = 'To: ' . $current_callsign . "\n\n";
|
||||||
|
$count = 0;
|
||||||
|
$qsotext = '';
|
||||||
|
}
|
||||||
|
unset($qso_data[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($qsotext != '') {
|
||||||
|
$text .= $qsotext;
|
||||||
|
$text .= "\n" . 'Thanks for QSOs.';
|
||||||
|
$pdf->Add_Label($text);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
echo '<td>' . $qso->station_gridsquare . '</td>';
|
echo '<td>' . $qso->station_gridsquare . '</td>';
|
||||||
echo '<td>' . $qso->count . '</td>';
|
echo '<td>' . $qso->count . '</td>';
|
||||||
echo '<td><a href="'. site_url('qslprint') . '" class="btn btn-outline-info btn-sm"><i class="fas fa-search"></i></a></td>';
|
echo '<td><a href="'. site_url('qslprint') . '" class="btn btn-outline-info btn-sm"><i class="fas fa-search"></i></a></td>';
|
||||||
echo '<td><a href="labels/print/'. $qso->station_id.'" class="btn btn-outline-success btn-sm"><i class="fas fa-print"></i></a></td>';
|
echo '<td><a href="'. site_url('labels/print/' . $qso->station_id) . '" class="btn btn-outline-success btn-sm"><i class="fas fa-print"></i></a></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
} ?>
|
} ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Ładowanie…
Reference in New Issue