Removed font from settings. Fixt it to DejaVuSans

这个提交包含在:
int2001 2023-07-28 07:51:52 +00:00
父节点 71d861f8b7
当前提交 4bb448d369
找不到此签名对应的密钥
GPG 密钥 ID: DFB1C13CD2DB037B
共有 3 个文件被更改,包括 33 次插入126 次删除

查看文件

@ -8,7 +8,7 @@ use Cloudlog\Label\font\unifont\ttfonts;
if ( ! defined('BASEPATH')) exit('No direct script access allowed'); if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Labels extends CI_Controller { class Labels extends CI_Controller {
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Controller: Labels | Controller: Labels
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -16,7 +16,7 @@ class Labels extends CI_Controller {
| This Controller handles all things Labels, creating, editing and printing | This Controller handles all things Labels, creating, editing and printing
| |
| |
*/ */
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
@ -35,7 +35,7 @@ class Labels extends CI_Controller {
| Nothing fancy just shows the main display of how many labels are waiting | Nothing fancy just shows the main display of how many labels are waiting
| to be printed per station profile. | to be printed per station profile.
| |
*/ */
public function index() { public function index() {
$data['page_title'] = "QSL Card Labels"; $data['page_title'] = "QSL Card Labels";
@ -53,7 +53,7 @@ class Labels extends CI_Controller {
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('labels/index'); $this->load->view('labels/index');
$this->load->view('interface_assets/footer', $footerData); $this->load->view('interface_assets/footer', $footerData);
} }
/* /*
@ -63,9 +63,9 @@ class Labels extends CI_Controller {
| |
| Shows the form used to create a label type. | Shows the form used to create a label type.
| |
*/ */
public function create() { public function create() {
$data['page_title'] = "Create Label Type"; $data['page_title'] = "Create Label Type";
$this->load->library('form_validation'); $this->load->library('form_validation');
@ -82,10 +82,10 @@ class Labels extends CI_Controller {
{ {
$this->load->model('labels_model'); $this->load->model('labels_model');
$this->labels_model->addLabel(); $this->labels_model->addLabel();
redirect('labels'); redirect('labels');
} }
} }
public function printids() { public function printids() {
@ -104,11 +104,13 @@ class Labels extends CI_Controller {
$this->prepareLabel($result); $this->prepareLabel($result);
} }
function prepareLabel($qsos, $jscall = false) { function prepareLabel($qsos, $jscall = false) {
$this->load->model('labels_model'); $this->load->model('labels_model');
$label = $this->labels_model->getDefaultLabel(); $label = $this->labels_model->getDefaultLabel();
$label->font='DejaVuSans'; // Fix font to DejaVuSans
try { try {
if ($label) { if ($label) {
$pdf = new PDF_Label(array( $pdf = new PDF_Label(array(
@ -145,20 +147,20 @@ class Labels extends CI_Controller {
} }
} }
define('FPDF_FONTPATH', './src/Label/font/'); define('FPDF_FONTPATH', './src/Label/font/');
$pdf->AddPage(); $pdf->AddPage();
if ($label->font == 'DejaVuSans') { if ($label->font == 'DejaVuSans') { // leave this here, for future Use
$pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true); $pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true);
$pdf->SetFont($label->font); $pdf->SetFont($label->font);
} else { } else {
$pdf->AddFont($label->font); $pdf->AddFont($label->font);
$pdf->SetFont($label->font); $pdf->SetFont($label->font);
} }
if ($qsos->num_rows() > 0) { if ($qsos->num_rows() > 0) {
if ($label->qsos == 1) { if ($label->qsos == 1) {
$this->makeOneQsoLabel($qsos->result(), $pdf); $this->makeMultiQsoLabel($qsos->result(), $pdf,1);
} else { } else {
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos); $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos);
} }
@ -169,20 +171,6 @@ class Labels extends CI_Controller {
$pdf->Output(); $pdf->Output();
} }
function makeOneQsoLabel($qsos, $pdf) {
foreach($qsos as $qso) {
$time = strtotime($qso->COL_TIME_ON);
$myFormatForView = date("d/m/Y H:i", $time);
if($qso->COL_SAT_NAME != "") {
$text = sprintf("%s\n\n%s %s\n%s %s \n\n%s", 'To: '.$qso->COL_CALL, $myFormatForView, 'on '.$qso->COL_BAND.' 2x'.$qso->COL_MODE.' RST '.$qso->COL_RST_SENT.'', 'Satellite: '.$qso->COL_SAT_NAME.' Mode: '.strtoupper($qso->COL_SAT_MODE).' ', '', 'Thanks for QSO.');
} else {
$text = sprintf("%s\n\n%s %s\n%s %s \n\n%s", 'To: '.$qso->COL_CALL, $myFormatForView, 'on '.$qso->COL_BAND.' 2x'.$qso->COL_MODE.' RST '.$qso->COL_RST_SENT.'', '', '', 'Thanks for QSO.');
}
$pdf->Add_Label($text);
}
}
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos) { function makeMultiQsoLabel($qsos, $pdf, $numberofqsos) {
$text = ''; $text = '';
$current_callsign = ''; $current_callsign = '';
@ -210,7 +198,7 @@ class Labels extends CI_Controller {
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos); $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos);
} }
} }
// New begin // New begin
function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label) { function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label) {
$tableData = []; $tableData = [];
@ -241,56 +229,22 @@ class Labels extends CI_Controller {
} }
} }
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso){ function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso){
$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; $text .= $current_callsign;
$text .= "\n"; $text .= "\n";
$text .= $builder->renderTable(); $text .= $builder->renderTable();
if($qso['sat'] != "") { if($qso['sat'] != "") {
$text .= "\n".'Satellite: '.$qso['sat'].' Mode: '.strtoupper($qso['sat_mode']); $text .= "\n".'Satellite: '.$qso['sat'].' Mode: '.strtoupper($qso['sat_mode']);
}
$text .= "\nThanks for the QSO".($numofqsos>1 ? 's' : '');
$pdf->Add_Label($text);
}
// New End
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]);
} }
$text .= "\nThanks for the QSO".($numofqsos>1 ? 's' : '');
if ($qsotext != '') { $pdf->Add_Label($text);
$text .= $qsotext;
$text .= "\n" . 'Thanks for QSOs.';
$pdf->Add_Label($text);
}
} }
// New End
public function edit($id) { public function edit($id) {
$this->load->model('labels_model'); $this->load->model('labels_model');

查看文件

@ -111,29 +111,6 @@
</div> </div>
</div> </div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="font">Font</label>
<div class="col-sm-4">
<select name="font" class="form-control" id="font">
<option value="courier">Courier</option>
<option value="courierb">Courierb</option>
<option value="courierbi">Courierbi</option>
<option value="courieri">Courieri</option>
<option value="DejaVuSans">DejaVuSans</option>
<option value="helvetica">Helvetica</option>
<option value="helveticab">Helveticab</option>
<option value="helveticabi">Helveticabi</option>
<option value="helveticai">Helveticai</option>
<option value="symbol">Symbol</option>
<option value="times">Times</option>
<option value="timesb">Timesb</option>
<option value="timesb">Timesb</option>
<option value="timesbi">Timesbi</option>
<option value="zapfdingbats">Zapfdingbats</option>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Label Type</button> <button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Label Type</button>
</div> </div>
</div> </div>
@ -141,4 +118,4 @@
</form> </form>
</div> </div>
<br> <br>

查看文件

@ -110,30 +110,6 @@
<input name="label_qsos" type="number" min="1" max="40" step="1" class="form-control" id="label_qsos" aria-describedby="font_sizeHelp" value="<?php if(isset($label->qsos)) { echo $label->qsos; } ?>"> <input name="label_qsos" type="number" min="1" max="40" step="1" class="form-control" id="label_qsos" aria-describedby="font_sizeHelp" value="<?php if(isset($label->qsos)) { echo $label->qsos; } ?>">
</div> </div>
</div> </div>
<div class="form-group row">
<label class="col-sm-2 col-form-label" for="font">Font</label>
<div class="col-sm-4">
<select name="font" class="form-control" id="font">
<option value="courier" <?php if($label->font == "courier") { echo "selected=\"selected\""; } ?>>Courier</option>
<option value="courierb" <?php if($label->font == "courierb") { echo "selected=\"selected\""; } ?>>Courierb</option>
<option value="courierbi" <?php if($label->font == "courierbi") { echo "selected=\"selected\""; } ?>>Courierbi</option>
<option value="courieri" <?php if($label->font == "courieri") { echo "selected=\"selected\""; } ?>>Courieri</option>
<option value="DejaVuSans" <?php if($label->font == "DejaVuSans") { echo "selected=\"selected\""; } ?>>DejaVuSans</option>
<option value="helvetica" <?php if($label->font == "helvetica") { echo "selected=\"selected\""; } ?>>Helvetica</option>
<option value="helveticab" <?php if($label->font == "helveticab") { echo "selected=\"selected\""; } ?>>Helveticab</option>
<option value="helveticabi" <?php if($label->font == "helveticabi") { echo "selected=\"selected\""; } ?>>Helveticabi</option>
<option value="helveticai" <?php if($label->font == "helveticai") { echo "selected=\"selected\""; } ?>>Helveticai</option>
<option value="symbol" <?php if($label->font == "symbol") { echo "selected=\"selected\""; } ?>>Symbol</option>
<option value="times" <?php if($label->font == "times") { echo "selected=\"selected\""; } ?>>Times</option>
<option value="timesb" <?php if($label->font == "timesb") { echo "selected=\"selected\""; } ?>>Timesb</option>
<option value="timesb" <?php if($label->font == "timesb") { echo "selected=\"selected\""; } ?>>Timesb</option>
<option value="timesbi" <?php if($label->font == "timesbi") { echo "selected=\"selected\""; } ?>>Timesbi</option>
<option value="zapfdingbats" <?php if($label->font == "zapfdingbats") { echo "selected=\"selected\""; } ?>>Zapfdingbats</option>
</select>
</div>
</div>
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Label Type</button> <button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Label Type</button>
</div> </div>
</div> </div>
@ -141,4 +117,4 @@
</form> </form>
</div> </div>
<br> <br>