kdiamond
Member
Hugh- You helped me with this earlier, and it worked perfectly- the only kicker now is I decided my the client product list needed it's own list and group. Forms wise it works great. Now the question is how do I collect the fabrik variables for a repeating group? Here is the current PHP script that call phpdocx:
It can:
acts on the PHP button
can handle and create multiple documents for each record
notice the explode- that was to parse the fabrik multi-select field- this is where the big change needs to happen.
As well - the lists need an extra kcik with the replace List variable - so that is why you see the prods pre and prods post - I manipulated them in two steps.
Any suggestions for the repeating group?
It can:
acts on the PHP button
can handle and create multiple documents for each record
notice the explode- that was to parse the fabrik multi-select field- this is where the big change needs to happen.
As well - the lists need an extra kcik with the replace List variable - so that is why you see the prods pre and prods post - I manipulated them in two steps.
Any suggestions for the repeating group?
PHP:
<?php
require_once '/var/www/html/libraries/phpdocx/classes/CreateDocx.inc';
$app = JFactory::getApplication();
$ids = $app->input->get('ids', array(), 'array');
//Map phpdocx variable to fabrik variable here
foreach ($ids AS $myid)
{
$row = $model->getRow($myid);
$jobname = $row->pet_event_reports___event_name;
$name = $row->pet_event_reports___BA_name;
$client = $row->pet_event_reports___billing_client;
$prodspre = $row->pet_event_reports___products_sampled;
$photo = $row->pet_event_reports___Photo_raw;
$photo2 = $row->pet_event_reports___Photo2_raw;
//this explodes the fbarik multi array
//$prodspost = explode("//..*..//", $prodspre);
//call the template
$docx = new CreateDocxFromTemplate('/var/www/html/libraries/phpdocx/templates/event_report.docx');
//Map event_report.doxc variable to phpdocx variables here
$variables = array('JOBNAME' => $jobname,
'NAME' => $name,
'CLIENT' => $client);
//$prodlist = array('PRODS' => $prodspost);
$docx->replacePlaceholderImage('Media1',"/var/www/html$photo");
$docx->replacePlaceholderImage('DISPLAY',"/var/www/html$photo2");
$docx->replaceVariableByText($variables);
$options = array('parseLineBreaks' => true);
$docx->replaceListVariable('PRODS',$prodspost,$options);
$docx->createDocx("/var/www/html/tmp/$jobname");
}