FreeMED. FormTemplate

Use XML templates to fill out information on PDF forms.

Summary
Use XML templates to fill out information on PDF forms.
Get data element value associated with the currently loaded data set.
Get list of custom controls from a template.
Get XML template DOM tree, with caching.
Load a form_results entry into the current set.
Load patient information into an XML form template.
Push data out to final XML data, composited
Produce output XML from template element.
Process data elements to produce appropriate data
Render a template to a PDF file from a composited XML data string.

Functions

FormTemplate

function FormTemplate ($template)

Parameters

$templateRelative name of XML template file.  This file should exist in freemedroot/data/form/templates/ as a file with the extension ‘.xml’, so ‘test’ would resolve to ‘test.xml’.

FetchDataElement

function FetchDataElement ($key)

Get data element value associated with the currently loaded data set.

Parameters

$keyData element key

Returns

Value.  Will return empty string if no data set is loaded.

GetControls

function GetControls ( )

Get list of custom controls from a template.

Returns

Multidimensional array containing controls description.  Keys are the variable name.

GetInformation

function GetInformation ( )

GetXMLTemplate

function GetXMLTemplate ( )

Get XML template DOM tree, with caching.

Returns

eZXML object representing XML DOM tree for the loaded template.

LoadData

function LoadData ($id)

Load a form_results entry into the current set.

Parameters

$idRow ID of form_results table entry

LoadPatient

function LoadPatient ($patient_id)

Load patient information into an XML form template.

Parameters

$patient_idRow ID of patient table row

OutputData

function OutputData ( )

Push data out to final XML data, composited

Returns

XML string

ProcessElement

function ProcessElement ($attr,
$data)

Produce output XML from template element.

Parameters

$attrArray of attribute values for element
$dataArray of data values from data element

Returns

XML formatted elements.

ProcessData

function ProcessData ($data)

Process data elements to produce appropriate data

Parameters

$dataData array

Returns

String

RenderToPDF

function RenderToPDF ($data,  
$output =  false)

Render a template to a PDF file from a composited XML data string.

Parameters

$dataComposited XML data string
$output(optional) Boolean, output to browser.  Default is false, return as file name.

Returns

Optionally returns filename.

function FormTemplate ($template)
function FetchDataElement ($key)
Get data element value associated with the currently loaded data set.
function GetControls ( )
Get list of custom controls from a template.
function GetInformation ( )
function GetXMLTemplate ( )
Get XML template DOM tree, with caching.
function LoadData ($id)
Load a form_results entry into the current set.
function LoadPatient ($patient_id)
Load patient information into an XML form template.
function OutputData ( )
Push data out to final XML data, composited
function ProcessElement ($attr,
$data)
Produce output XML from template element.
function ProcessData ($data)
Process data elements to produce appropriate data
function RenderToPDF ($data,  
$output =  false)
Render a template to a PDF file from a composited XML data string.