| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/backend-accounting.sk/app/modules/dpfob/code/ |
Upload File : |
<?php
namespace modules\dpfob\code;
use App;
use app\classes\Translator;
use app\classes\PDODatabase;
use app\constants\Config;
use TCPDF;
use modules\dpfob\code\DPFOB as Item;
use modules\dpfob\code\DPFOBHelper as Helper;
/**
* Description of RecordBookGenerator
*
* @author maros
*/
class TrustDeedGenerator {
const PAGE_WIDTH = 210;
const PAGE_HEIGHT = 297;
const STAMP_WIDTH = 27;
private $app;
private $db;
private $t;
private $helper;
private $today;
/** @var Training */
private $item;
public function __construct(Item $item, $today) {
$this->app = App::getInstance();
$this->db = PDODatabase::getInstance();
$this->t = Translator::getInstance();
$this->helper = new Helper();
$this->item = $item;
$this->today = $today;
}
public function generateTrustDeed($clientSignature = false, $output = false) {
$pdf = $this->getNewPdfGeneratorTemplate($this->t->_get('Splnomocnenie'));
$this->printTrustDeed($pdf, $clientSignature);
return $this->exportPdf($pdf, $output);
}
private function printTrustDeed(PdfGeneratorTemplate &$pdf, $clientSignature = false) {
require __DIR__ . '/templates/trustDeedGenerator/printTrustDeed.php';
}
/**
* @return PdfGeneratorTemplate;
*/
private function getNewPdfGeneratorTemplate($title) {
$pdf = new PdfGeneratorTemplate("P", PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor($this->app->getConfig(Config::PAGE_NAME));
$pdf->SetTitle($title);
$pdf->SetSubject($title);
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(0, 0, 0);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->SetPrintHeader(true);
$pdf->SetPrintFooter(true);
$pdf->SetAutoPageBreak(false);
$pdf->SetFont('dejavusans');
return $pdf;
}
public function exportPdf(TCPDF $pdf, $path) {
if ($path === false) {
ob_clean();
$pdf->Output(transliterateString("Sample PDF") . ".pdf");
exit;
} else {
$absPath = DOCUMENT_ROOT . substr($path, 1);
$pdf->Output($absPath, "F");
return $absPath;
}
}
}