PHP grabbing group variables with repeat

Status
Not open for further replies.

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?

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");
}
 
So far I have this:
$prodspre = $row->pet_event_reports___product; Shows nothing (odd since when doing an excel export this is the field with multiple products listed)

changing element to the group:

$prodspre = $row->pet_event_report products___product; Shows only the first repeat record

Trying to grab the second value:

$prodspre1 = $row->pet_event_report products___product[0]; Shows '0' without ticks.

trying to do a var_dump($formModel->formData);exit; (copied from debug wiki- maybe not accurate here) just shows 'null'

Thanks for any help with this or doing a var_dump in 3.3.1
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top