Helper for OpenRosa forms

It supports a subset of OpenRosa forms and provides a bridge between GemsTracker models and the xml-formdefinition.

package Gems
subpackage OpenRosa
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.6

 Methods

Create an OpenRosaForm from an existing filename

__construct(string $file) 

Parameters

$file

string

the sanitized filename (absolute path)

formatImg()

formatImg($value, $new, $name, array $context = array()

Parameters

$value

$new

$name

$context

Returns what field (path) contains the attributes jr:preload="property" jr:preloadParams="deviceid" from the moden -> bind elements

getDeviceIdField() : string

Returns

string

Returns the formID from the instance element id attribute

getFormID() : string

Returns

string

Returns the formVersion from the instance element version attribute

getFormVersion() : string

Returns

string

getModel()

getModel() : \Gems_Model_JoinModel

Returns

\Gems_Model_JoinModel

Get the table name for the repeating group in a form

getRelatedTableName() : string

Returns

string

getTableName()

getTableName() 

Returns the form title from the h:title element

getTitle() : string

Returns

string

saveAnswer()

saveAnswer($file, $remove = true

Parameters

$file

$remove

Convert instance name to bindname

_getBindName(string $name) : string

Replaces underscores with slashes and adds the data element

Parameters

$name

string

Returns

string

Add the changed/created by fields and add primary key

_getFinalSql(string $tablePrefix) : string

Parameters

$tablePrefix

string

Returns

string

If needed process the answer

_processAnswer(string $key, $input, string $type) : array

Parameters

$key

string

$input

$type

string

Returns

array

createTable()

createTable() 

flattenAnswers()

flattenAnswers($xml, $parent = ''

Parameters

$xml

$parent

flattenBind()

flattenBind($xml) 

Parameters

$xml

Return flattend element

flattenBody(\SimpleXMLElement $xml, \type $context = ''

Parameters

$xml

\SimpleXMLElement

$context

\type

flattenInstance()

flattenInstance($xml, $parent = ''

Parameters

$xml

$parent

 Properties

 

$_xml

$_xml : \SimpleXmlElement

Default

 

$bind

$bind 

Default

 

$body

$body 

Default

 

$deviceIdField

$deviceIdField 

Default

 

$formID

$formID 

Default

 

$formVersion

$formVersion 

Default

 

$instance

$instance 

Default

 

$model

$model : \Gems_Model_JoinModel

Default

 

$title

$title 

Default