LimeSurvey API - Master branch

HtmlWriter 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
$first  : mixed
$groupMap  : mixed
$handle  : mixed
The open filehandle
$options  : FormattingOptions
$sLanguageCode  : mixed
$stack  : mixed
Manages stack of open HTML tags that need closing.
$survey  : SurveyObj
$translator  : Translator

Methods

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.
closeTag()  : mixed
closeTags()  : mixed
openTag()  : mixed
out()  : mixed
outputRecord()  : mixed
This method will be called once for every row of data that needs to be output.
renderQuestion()  : mixed
Renders a question and recurses into subquestions.
stripTagsFull()  : mixed
tag()  : 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
writeHeader()  : mixed

Properties

$filename

public mixed $filename

$languageCode

public mixed $languageCode

$webfilename

public mixed $webfilename

$handle

The open filehandle

protected mixed $handle = \null

$sLanguageCode

protected mixed $sLanguageCode

$stack

Manages stack of open HTML tags that need closing.

protected mixed $stack = array()

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

openTag()

protected openTag(string $tag[, mixed $options = array() ]) : mixed
Parameters
$tag : string
$options : mixed = array()

out()

protected out(string $content) : mixed
Parameters
$content : string

outputRecord()

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

protected outputRecord(mixed $headers, mixed $values, FormattingOptions $oOptions) : mixed

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

Parameters
$headers : mixed
$values : mixed
$oOptions : FormattingOptions

renderQuestion()

Renders a question and recurses into subquestions.

protected renderQuestion(Question $question, string $value, mixed $header) : mixed
Parameters
$question : Question
$value : string
$header : mixed

stripTagsFull()

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

tag()

protected tag(string $tag[, mixed $options = array() ][, string $content = null ]) : mixed
Parameters
$tag : string
$options : mixed = array()
$content : string = null

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