Writer

Implements\IWriter

Contains functions and properties that are common to all writers.

All extending classes must implement the internalWrite(...) method and have access to functionality as described below:

TODO Write more docs here

package

Default

Methods

Returns an abbreviated heading for the survey's question that matches Force headingTextLength to be set, set to 15 if is not set (old behaviour)

getAbbreviatedHeading(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the subquestion part, if not empty : add a space before it.

getFullFieldSubHeading(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Returns a full heading for the question that matches the $fieldName.

getFullHeading(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Force headingTextLength to null (old behaviour)

deprecated

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question text part without any subquestion

getFullQuestionHeading(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question code according to options

getHeadingCode(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question text according to options

getHeadingText(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the answer text according to options

getLongAnswer(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName,string $sValue): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

$sValue

string

Response

string

Return the answer text according to options

getShortAnswer(\SurveyObj $oSurvey,\FormattingOptions $oOptions,string $fieldName,string $sValue): string

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

string

$sValue

string

Response

string

An initialization method that implementing classes can override to gain access to any information about the survey, language, or formatting options they may need for setup.

init(\SurveyObj $oSurvey,mixed $sLanguageCode,\FormattingOptions $oOptions)

Arguments

$oSurvey

\SurveyObj

$sLanguageCode

mixed

$oOptions

\FormattingOptions

This method will be called once for every row of data that needs to be output.

outputRecord(array $headers,array $values,\FormattingOptions $oOptions)
abstract

Implementations must use the data from these method calls to construct proper output for their output type and the given FormattingOptions.

Arguments

$headers

array

$values

array

$oOptions

\FormattingOptions

Return map of questions groups

setGroupMap(\SurveyObj $survey,\FormattingOptions $oOptions): array

Arguments

$survey

\SurveyObj

$oOptions

\FormattingOptions

Response

array

stripTagsFull

stripTagsFull( $string)

Arguments

$string

Performs a transformation of the response value based on the value, the type of field the value is a response for, and the FormattingOptions.

transformResponseValue(string $value,string $fieldType,\FormattingOptions $oOptions,string $column = null): string

All transforms should be processed during the execution of this function!

The final step in the transform is to apply a stripTagsFull on the $value. This occurs for ALL values whether or not any other transform is applied.

Arguments

$value

string

$fieldType

string

$oOptions

\FormattingOptions

$column

string

The name of the column

Response

string

translate

translate( $key, $sLanguageCode)

Arguments

$key

$sLanguageCode

This method is made final to prevent extending code from circumventing the initialization process that must take place prior to any of the translation infrastructure to work.

write(\SurveyObj $oSurvey,string $sLanguageCode,\FormattingOptions $oOptions,boolean $bOutputHeaders = true)
final

The inialization process is dependent upon the survey being passed into the write function and so must be performed when the method is called and not prior to (such as in a constructor).

All extending classes must implement the internalWrite function which is the code that is called after all initialization is completed.

Arguments

$oSurvey

\SurveyObj

$sLanguageCode

string

$oOptions

\FormattingOptions

$bOutputHeaders

boolean

Set if header should be given back

Properties

sLanguageCode

sLanguageCode :

Type(s)

translator

translator :\Translator
var

Type(s)

\Translator

filename

filename :

Type(s)

webfilename

webfilename :

Type(s)