Hello again.
I have nearly finished my attaching-a-custom-PDF-to-email program, but two last issues have appeared on my way.
First problem: I've already learned to create the custom PDF with placeholders in its title and upload it into a specific folder on my hosting, but it turns out that "email form plugin" only attaches already existing PDFs. Could you help me there, please?
Second problem: I need the PHP code I've used in order to explain it to you:
I don't know if I'm using $foo correctly, especially here, where I want to display the device name:
I have a repeat group connected to a group with all my devices, and the form is associated to the repeat group. The HTML message of "email form plugin" doesn't seem to have problems with this, because the conflictive placeholder ({mytable_7_repeat___devices}) works perfectly there. But PHP code (which also should work with placeholders as well as the HTML message) of "PHP form plugin" only displays what I think it's the device ID. I can't use PHP neither in the HTML message nor in between ' ', even though I have Sourcerer (I know this last thing isn't related with Fabrik, but it's very bothering and I would appreciate a little help).
If you need more information, please do not hesitate to tell me.
I have nearly finished my attaching-a-custom-PDF-to-email program, but two last issues have appeared on my way.
First problem: I've already learned to create the custom PDF with placeholders in its title and upload it into a specific folder on my hosting, but it turns out that "email form plugin" only attaches already existing PDFs. Could you help me there, please?
Second problem: I need the PHP code I've used in order to explain it to you:
PHP:
<?php
require_once('libraries/tcpdf/tcpdf.php');
$foo = $formModel->getElementData('mytable_7_repeat___devices', false, '', 1);
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetAuthor('Sandhar');
$pdf->SetTitle('Autorización de equipo/s: {source}<?php echo '$foo'; ?>{/source}');
$pdf->SetSubject('Autorización');
$pdf->SetHeaderData(PDF_HEADER_TITLE.' {source}<?php echo '$foo'; ?>{/source}', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0,64,0), array(0,64,128));
$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(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setFontSubsetting(true);
$pdf->SetFont('helvetica', '', 12, '', true);
$pdf->AddPage();
$html = <<<EOD
<p style="text-align: center;"><span style="font-size: 18pt;"><strong>Autorización para Uso de Soportes</strong></span></p>
<p style="text-align: center;"><span style="font-size: 18pt;"><strong>Fuera de las Instalaciones de la Empresa</strong></span></p>
<p style="text-align: right;"> Sandhar a Fecha: {mysql_date}</p>
<p> </p>
<p> </p>
<p><span style="text-decoration: underline;"><strong>Name</strong></span>: {mytable___name}</p>
<p><span style="text-decoration: underline;"><strong>Surname</strong></span>: {mytable___surname}</p>
<p><span style="text-decoration: underline;"><strong>Devices</strong></span>: {source}<?php echo '$foo'; ?>{/source} </p>
<p> </p>
<p style="text-align: center;"> </p>
<hr />
<p> </p>
EOD;
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$filename = 'authorization_{mytable___name}{mytable___surname}.pdf';
$partialpath = $_SERVER['DOCUMENT_ROOT'];
$finalfolder = 'authorizations';
$iswritabledocumentpath = $partialpath . '/' . $finalfolder . '/' . $filename;
$isnotwritabledocumentpath = $partialpath . '/' . $filename;
if (is_writable($partialpath . '/' . $finalfolder))
{
$pdf->Output($iswritabledocumentpath, 'F');
}
else
{
$pdf->Output($isnotwritabledocumentpath, 'F');
}
?>
PHP:
echo '$foo';
If you need more information, please do not hesitate to tell me.