53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
if (! $_REQUEST ['record'] || $_REQUEST ['record'] == '')
|
||
|
|
die ( 'Brak rekordu' );
|
||
|
|
else
|
||
|
|
$record = $_REQUEST ['record'];
|
||
|
|
|
||
|
|
include_once ("modules/EcmAgreements/PDFTemplate/helper.php");
|
||
|
|
|
||
|
|
$focus = new EcmAgreement ();
|
||
|
|
$focus->retrieve ( $record );
|
||
|
|
|
||
|
|
$user = new User ();
|
||
|
|
$user->retrieve ( $focus->assigned_user_id );
|
||
|
|
$labels = return_module_language($focus->ecmlanguage, 'EcmAgreements');
|
||
|
|
include_once ("include/MPDF57/mpdf.php");
|
||
|
|
$p = new mPDF ( '', 'A4', null, 'Times New Roman', 18, 18, 20, 25, 5, 5 );
|
||
|
|
$mpdf->mirrorMargins = 1;
|
||
|
|
|
||
|
|
$db = $GLOBALS ['db'];
|
||
|
|
// document pdf
|
||
|
|
// document already exist?
|
||
|
|
/*
|
||
|
|
$res = $db->query ( "SELECT footer, content FROM ecmagreement_pdf WHERE id='$record'" );
|
||
|
|
if ($res->num_rows == 0) {
|
||
|
|
*/
|
||
|
|
// create and save document
|
||
|
|
// $positions = formatPDFPositions ( $focus->getPositionList ( true ), $focus );
|
||
|
|
// get header
|
||
|
|
$header = '';
|
||
|
|
include_once ("modules/EcmAgreements/PDFTemplate/header.php");
|
||
|
|
$content = '';
|
||
|
|
include_once ("modules/EcmAgreements/PDFTemplate/agreement_content.php");
|
||
|
|
include_once ("modules/EcmAgreements/PDFTemplate/weksel.php");
|
||
|
|
global $current_user,$app_list_strings;
|
||
|
|
/*
|
||
|
|
$db->query ( "INSERT INTO ecmagreement_pdf VALUES ('$record','$current_user->id', NOW(),'" . urlencode ( $header ) . "', '" . urlencode( $content ) . "')" );
|
||
|
|
} else {
|
||
|
|
$row = $db->fetchByAssoc ( $res );
|
||
|
|
$header = urldecode ( $row ['footer'] ); // punk rock!
|
||
|
|
$content = urldecode ( $row ['content'] );
|
||
|
|
}*/
|
||
|
|
//var_dump($positions);
|
||
|
|
|
||
|
|
$p->WriteHTML ( $content );
|
||
|
|
$p->AddPage();
|
||
|
|
// weksel
|
||
|
|
$p->WriteHTML ( $w );
|
||
|
|
//echo $content;
|
||
|
|
// draw PDF
|
||
|
|
|
||
|
|
$p->Output ();
|
||
|
|
|