This class allows for exporting a PIFA form as XML. The exported file
contains the structure of the form and its fields. Optionally the export file
may contain the forms gathered data from its data table.
Example usage:
plugin_include('form_assistant', 'classes/class.pifa.exporter.php');
$exp = new PifaExporter(new PifaForm($idform));
$xml = $exp->export(false);
Util::logDump($xml);
Methods summary
public
|
#
__construct( PifaForm $pifaForm )
Create an instance. Creates PIFA form and XML writer member instances.
Create an instance. Creates PIFA form and XML writer member instances.
Parameters
|
public
string
|
#
export( boolean $addData )
Create and return export XML of PIFA form and its fields. Optionally includes
gathered form data.
Create and return export XML of PIFA form and its fields. Optionally includes
gathered form data.
Parameters
- $addData
boolean $addData if form data should be included in export
Returns
string created XML
|
private
|
#
_addForm( DOMElement $parent, PifaForm $pifaForm )
Adds a "form" element containing one "field" elements for each defined PIFA
field.
Adds a "form" element containing one "field" elements for each defined PIFA
field.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaForm
PifaForm
$pifaForm to create XML for
|
private
|
#
_addField( DOMElement $parent, PifaField $pifaField )
Adds a "field" element optionally containing "label", "help", "error",
"rule", "classes" and "options" elements.
Adds a "field" element optionally containing "label", "help", "error",
"rule", "classes" and "options" elements.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addLabel( DOMElement $parent, PifaField $pifaField )
Adds an optional "label" element.
Adds an optional "label" element.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addHelp( DOMElement $parent, PifaField $pifaField )
Adds an optional "help" element. As the help text is free text it will be
stored as CDATA.
Adds an optional "help" element. As the help text is free text it will be
stored as CDATA.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addError( DOMElement $parent, PifaField $pifaField )
Adds an optional "error" element. As the error message is free text it will
be stored as CDATA.
Adds an optional "error" element. As the error message is free text it will
be stored as CDATA.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addRule( DOMElement $parent, PifaField $pifaField )
Adds an optional "rule" element. As the rule is a regular expression it will
be stored as CDATA.
Adds an optional "rule" element. As the rule is a regular expression it will
be stored as CDATA.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addClasses( DOMElement $parent, PifaField $pifaField )
Adds an optional "classes" element containing one "class" element for each
defined class.
Adds an optional "classes" element containing one "class" element for each
defined class.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addOptions( DOMElement $parent, PifaField $pifaField )
Adds an optional "options" element containing one "option" element for each
defined option.
Adds an optional "options" element containing one "option" element for each
defined option.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaField
PifaField
$pifaField to create XML for
|
private
|
#
_addData( DOMElement $parent, PifaForm $pifaForm )
Adds an optional "data" element containing one "row" element for each record
in the forms data table (gathered data). If the for has either no fields or its
data table has no records, no "data" element will be added.
Adds an optional "data" element containing one "row" element for each record
in the forms data table (gathered data). If the for has either no fields or its
data table has no records, no "data" element will be added.
Parameters
- $parent
DOMElement $parent to add element to
- $pifaForm
PifaForm
$pifaForm to create XML for
|
private
|
#
_getFieldTypeName( integer $fieldTypeId )
Map a numeric PIFA field ID to a name that may be used as translatable token
(i18n).
Map a numeric PIFA field ID to a name that may be used as translatable token
(i18n).
Parameters
- $fieldTypeId
integer $fieldTypeId to map
|