show the To Radio in the upper right corner

This commit is contained in:
HB9HIL
2024-09-04 01:37:55 +02:00
parent f3d6744b12
commit a4e289656e
2 changed files with 18 additions and 8 deletions

View File

@@ -345,14 +345,17 @@ class Labels extends CI_Controller {
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false, $reference = false){
$builder = new \AsciiTable\Builder();
$builder->addRows($tableData);
$text = "To Radio: ";
$text .= $current_callsign;
$toradio = "To Radio: ";
$toradio .= $current_callsign;
if (($via) && ($qso['via'] ?? '' != '')) {
$text.=' via '.substr($qso['via'],0,8);
$toradio.=' via '.substr($qso['via'],0,8);
}
$text .= "\n";
$text .= "Confirming QSO".($numofqsos>1 ? 's' : '')."\n";
$text .= $builder->renderTable();
$builder->setTitle($toradio);
$additionalText = "Confirming QSO".($numofqsos>1 ? 's' : '');
$builder->setAdditionalText($additionalText);
$text = $builder->renderTable();
if($qso['sat'] != "") {
if (($qso['sat_mode'] == '') && ($qso['sat_band_rx'] !== '')) {
$text .= "\n".'Satellite: '.$qso['sat'].' Band RX: '.$qso['sat_band_rx'];

View File

@@ -77,6 +77,8 @@ class Builder
*/
private $title;
private $additionalText;
public function __construct()
{
$this->table = new Table();
@@ -126,6 +128,11 @@ class Builder
$this->title = $title;
}
public function setAdditionalText(string $additionalText)
{
$this->additionalText = $additionalText;
}
/**
* Add multiple rows
*
@@ -198,11 +205,11 @@ class Builder
if ($this->title === null) {
$titleString = '';
} else {
$titlePadding = intdiv(max(0, mb_strwidth($borderTop) - mb_strwidth($this->title)), 2);
$titlePadding = max(0, mb_strwidth($borderTop) - mb_strwidth($this->title));
$titleString = str_repeat(' ', $titlePadding) . $this->title . PHP_EOL;
}
$tableAsString = $titleString . $borderTop . PHP_EOL . $header . PHP_EOL . $borderMiddle . PHP_EOL . $body . $borderBottom;
$tableAsString = $titleString . $this->additionalText . "\n" . $borderTop . PHP_EOL . $header . PHP_EOL . $borderMiddle . PHP_EOL . $body . $borderBottom;
return $tableAsString;
}