1st version with orientation

这个提交包含在:
int2001 2023-08-02 10:20:38 +00:00
父节点 04c7db1920
当前提交 f2272e9fb5
找不到此签名对应的密钥
GPG 密钥 ID: DFB1C13CD2DB037B
共有 4 个文件被更改,包括 18 次插入22 次删除

查看文件

@ -196,7 +196,7 @@ class Labels extends CI_Controller {
}
define('FPDF_FONTPATH', './src/Label/font/');
$pdf->AddPage();
$pdf->AddPage($ptype->orientation);
if ($label->font == 'DejaVuSans') { // leave this here, for future Use
$pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true);
@ -208,9 +208,9 @@ class Labels extends CI_Controller {
if ($qsos->num_rows() > 0) {
if ($label->qsos == 1) {
$this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset);
$this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation);
} else {
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset);
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation);
}
} else {
$this->session->set_flashdata('message', '0 QSOs found for print!');
@ -219,7 +219,7 @@ class Labels extends CI_Controller {
$pdf->Output();
}
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset) {
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation) {
$text = '';
$current_callsign = '';
$current_sat = '';
@ -228,7 +228,7 @@ class Labels extends CI_Controller {
$qso_data = [];
if ($offset !== 1) {
for ($i = 1; $i < $offset; $i++) {
$pdf->Add_Label('');
$pdf->Add_Label('',$orientation);
}
}
foreach($qsos as $qso) {
@ -236,7 +236,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);
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation);
$qso_data = [];
}
$current_callsign = $qso->COL_CALL;
@ -258,7 +258,7 @@ class Labels extends CI_Controller {
];
}
if (!empty($qso_data)) {
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos);
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation);
}
}
// New begin
@ -266,7 +266,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) {
function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation) {
$tableData = [];
$count_qso = 0;
@ -286,7 +286,7 @@ class Labels extends CI_Controller {
if($count_qso == $qso_per_label){
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso);
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation);
$tableData = []; // reset the data
$count_qso = 0; // reset the counter
}
@ -294,12 +294,12 @@ class Labels extends CI_Controller {
}
// generate label for remaining QSOs
if($count_qso > 0){
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso);
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation);
$preliminaryData = []; // reset the data
}
}
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso){
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation){
$builder = new \AsciiTable\Builder();
$builder->addRows($tableData);
$text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with ";
@ -317,7 +317,7 @@ class Labels extends CI_Controller {
}
$text .= "\nThanks for the QSO".($numofqsos>1 ? 's' : '');
$text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL";
$pdf->Add_Label($text);
$pdf->Add_Label($text,$orientation);
}
// New End

查看文件

@ -35,6 +35,12 @@ class Migration_create_label_paper_types_table extends CI_Migration {
'null' => TRUE,
),
'orientation' => array(
'type' => 'VARCHAR',
'constraint' => '1',
'null' => TRUE,
),
'height' => array(
'type' => 'DECIMAL',
'constraint' => '6,3',

查看文件

@ -28,11 +28,6 @@
<label class="col-sm-2 col-form-label" for="paperType">Paper Type</label>
<div class="col-sm-4">
<select name="paper_type" class="form-control" id="paperType">
<option value="a3">A3</option>
<option value="a5">A5</option>
<option value="a4">A4</option>
<option value="letter">Letter</option>
<option value="legal">Legal</option>
<?php
foreach($papertypes as $paper){
echo '<option value=' . $paper->paper_name . '>' . ucwords(strtolower(($paper->paper_name))) . '</option>';

查看文件

@ -28,11 +28,6 @@
<label class="col-sm-2 col-form-label" for="paperType">Paper Type</label>
<div class="col-sm-4">
<select name="paper_type" class="form-control" id="paperType">
<option value="a3" <?php if($label->paper_type == "a3") { echo "selected=\"selected\""; } ?>>A3</option>
<option value="a4" <?php if($label->paper_type == "a4") { echo "selected=\"selected\""; } ?>>A4</option>
<option value="a5" <?php if($label->paper_type == "a5") { echo "selected=\"selected\""; } ?>>A5</option>
<option value="letter" <?php if($label->paper_type == "letter") { echo "selected=\"selected\""; } ?>>Letter</option>
<option value="legal" <?php if($label->paper_type == "legal") { echo "selected=\"selected\""; } ?>>Legal</option>
<?php
foreach($papertypes as $paper){
echo '<option value="' . $paper->paper_name . '"';