DocWriter

Extends \Writer

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

Methods

__construct

__construct() 

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(\Survey $oSurvey, mixed $sLanguageCode, \FormattingOptions $oOptions) 
inherited

Arguments

$oSurvey

\Survey

$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) 
inherited 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

close

close() 

translate

translate($key, $sLanguageCode) 
inherited

Arguments

$key

$sLanguageCode

Return map of questions groups

setGroupMap(\Survey $survey, \FormattingOptions $oOptions) : array
inherited

Arguments

$survey

\Survey

$oOptions

\FormattingOptions

Response

array

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(\Survey $oSurvey, \FormattingOptions $oOptions, string $fieldName) : string
inherited

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

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

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

Force headingTextLength to null (old behaviour)

deprecated

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

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

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question text part without any subquestion

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question code according to options

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the question text according to options

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

Response

string

Return the answer text according to options

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

$sValue

string

Response

string

Return the answer text according to options

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

Arguments

$oSurvey

\Survey

$oOptions

\FormattingOptions

$fieldName

string

$sValue

string

Response

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
inherited

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

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(\Survey $oSurvey, string $sLanguageCode, \FormattingOptions $oOptions, boolean $bOutputHeaders = true) 
inherited 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

\Survey

$sLanguageCode

string

$oOptions

\FormattingOptions

$bOutputHeaders

boolean

Set if header should be given back

stripTagsFull

stripTagsFull($string) 
inherited

Arguments

$string

Mimic old functionnality, leave it if some plugin use it No core plugin seems to use it, and function name seem broken (?)

getCodeHeading(\SurveyObj $oSurvey, \FormattingOptions $oOptions, $fieldName) 
inherited
deprecated

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

Mimic old functionnality, leave it if some plugin use it No core plugin seems to use it, and function name seem broken (?)

getCodeFieldSubHeading(\SurveyObj $oSurvey, \FormattingOptions $oOptions, $fieldName) 
inherited
deprecated

Arguments

$oSurvey

\SurveyObj

$oOptions

\FormattingOptions

$fieldName

Properties

output

output : 

separator

separator : 

isBeginning

isBeginning : 

The open filehandle

file : 

sLanguageCode

sLanguageCode : 
inherited

translator

translator : 
inherited

filename

filename : 
inherited

webfilename

webfilename : 
inherited