LimeSurvey API - Master branch

DocWriter extends Writer
in package

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

Table of Contents

Properties

$filename  : mixed
$languageCode  : mixed
$webfilename  : mixed
$sLanguageCode  : mixed
$translator  : Translator
$file  : mixed
The open filehandle
$isBeginning  : mixed
$output  : mixed
$separator  : mixed

Methods

__construct()  : mixed
close()  : mixed
getAbbreviatedHeading()  : string
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)
getFullFieldSubHeading()  : string
Return the subquestion part, if not empty : add a space before it.
getFullHeading()  : string
Returns a full heading for the question that matches the $fieldName.
getFullQuestionHeading()  : string
Return the question text part without any subquestion
getHeadingCode()  : string
Return the question code according to options
getHeadingText()  : string
Return the question text according to options
getLongAnswer()  : string
Return the answer text according to options
getShortAnswer()  : string
Return the answer text according to options
init()  : mixed
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.
setGroupMap()  : array<string|int, mixed>
Return map of questions groups
write()  : mixed
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.
outputRecord()  : mixed
This method will be called once for every row of data that needs to be output.
stripTagsFull()  : mixed
transformResponseValue()  : 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.
translate()  : mixed

Properties

$filename

public mixed $filename

$languageCode

public mixed $languageCode

$webfilename

public mixed $webfilename

$sLanguageCode

protected mixed $sLanguageCode

$file

The open filehandle

private mixed $file = \null

Methods

getAbbreviatedHeading()

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)

public getAbbreviatedHeading(SurveyObj $oSurvey, FormattingOptions $oOptions, string $fieldName) : string
Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
Return values
string

getFullFieldSubHeading()

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

public getFullFieldSubHeading(SurveyObj $oSurvey, FormattingOptions $oOptions, string $fieldName) : string
Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
Return values
string

getFullHeading()

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

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

Force headingTextLength to null (old behaviour)

Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
Tags
deprecated
Return values
string

getFullQuestionHeading()

Return the question text part without any subquestion

public getFullQuestionHeading(SurveyObj $oSurvey, FormattingOptions $oOptions, string $fieldName) : string
Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
Return values
string

getLongAnswer()

Return the answer text according to options

public getLongAnswer(SurveyObj $oSurvey, FormattingOptions $oOptions, string $fieldName, string $sValue) : string
Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
$sValue : string
Return values
string

getShortAnswer()

Return the answer text according to options

public getShortAnswer(SurveyObj $oSurvey, FormattingOptions $oOptions, string $fieldName, string $sValue) : string
Parameters
$oSurvey : SurveyObj
$oOptions : FormattingOptions
$fieldName : string
$sValue : string
Return values
string

init()

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.

public init(SurveyObj $survey, mixed $sLanguageCode, FormattingOptions $oOptions) : mixed
Parameters
$survey : SurveyObj
$sLanguageCode : mixed
$oOptions : FormattingOptions

write()

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.

public final write(SurveyObj $oSurvey, string $sLanguageCode, FormattingOptions $oOptions[, bool $bOutputHeaders = true ]) : mixed

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.

Parameters
$oSurvey : SurveyObj
$sLanguageCode : string
$oOptions : FormattingOptions
$bOutputHeaders : bool = true

Set if header should be given back

outputRecord()

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

protected outputRecord(array<string|int, mixed> $headers, array<string|int, mixed> $values, FormattingOptions $oOptions) : mixed
Parameters
$headers : array<string|int, mixed>
$values : array<string|int, mixed>
$oOptions : FormattingOptions

stripTagsFull()

protected stripTagsFull(string $string) : mixed
Parameters
$string : string

transformResponseValue()

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

protected 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.

Parameters
$value : string
$fieldType : string
$oOptions : FormattingOptions
$column : string = null

The name of the column

Return values
string

translate()

protected translate(mixed $key, mixed $sLanguageCode) : mixed
Parameters
$key : mixed
$sLanguageCode : mixed

        
On this page

Search results