separator = "\t";
$this->output = '';
$this->isBeginning = true;
}
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$this->clang = new limesurvey_lang($sLanguageCode);
if ($oOptions->output=='display')
{
header("Content-Disposition: attachment; filename=results-survey".$survey->id.".doc");
header("Content-type: application/vnd.ms-word");
}
$sOutput = '
';
if ($oOptions->output=='display'){
echo $sOutput;
} elseif ($oOptions->output == 'file') {
$this->file = fopen($this->filename, 'w');
$this->output = $sOutput;
}
}
/**
* @param array $headers
* @param array $values
* @param FormattingOptions $oOptions
*/
protected function outputRecord($headers, $values, FormattingOptions $oOptions)
{
if ($oOptions->answerFormat == 'short')
{
//No headers at all, only output values.
$this->output .= implode($this->separator, $values).PHP_EOL;
}
elseif ($oOptions->answerFormat == 'long')
{
//Output each record, one per page, with a header preceding every value.
if ($this->isBeginning)
{
$this->isBeginning = false;
}
else
{
$this->output .= "
";
}
$this->output .= "
".$this->clang->gT("Survey response")." | |
---|---|
".$header." | ".$value." |