Skip to content

Commit

Permalink
Fixed issue #16833: new config setting for date format and question c…
Browse files Browse the repository at this point in the history
…ode updates (#1684)

For questions with subquestion, the question code is shown without the subquestion part.
For date questions, the length of the placeholders is set accoding to the format of the question
Question Title Column width can be set from config-defaults
  • Loading branch information
gabrieljenik committed Mar 5, 2021
1 parent 92cf20f commit 1318758
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions application/config/config-defaults.php
Expand Up @@ -430,6 +430,9 @@
// QueXML: If set to true, the Data/Time answers will be formated with the survey's date format
$config['quexmlkeepsurveydateformat'] = false;

// QueXML: Width of the question title column in MM
$config['quexmlquestiontitlewidth'] = 14;

$config['minlengthshortimplode'] = 20; // Min length required to use short_implode instead of standard implode
$config['maxstringlengthshortimplode'] = 100; // short_implode: Max length of returned string

Expand Down
3 changes: 3 additions & 0 deletions application/helpers/export_helper.php
Expand Up @@ -1453,6 +1453,9 @@ function quexml_reformat_date(DOMElement $element, $qid, $iSurveyID)

// Change the value in the DOM element
$element->setAttribute("defaultValue", $value);

// Change length
$element->getElementsByTagName("free")->item(0)->getElementsByTagName("length")->item(0)->nodeValue = strlen($value);
}


Expand Down
12 changes: 11 additions & 1 deletion application/libraries/admin/quexmlpdf.php
Expand Up @@ -799,6 +799,16 @@ public function setLanguage($language)
*/
protected $cornerLines = true;

/**
* Initialize from config
*
*/
public function __construct()
{
$this->questionTitleWidth = Yii::app()->getConfig('quexmlquestiontitlewidth', $this->questionTitleWidth);
parent::__construct();
}

/**
* Return the length of the longest word
*
Expand Down Expand Up @@ -1967,7 +1977,7 @@ public function createqueXML($quexml)
}

if (Yii::app()->getConfig('quexmlusequestiontitleasid') == true) {
$qtmp['title'] = ((string) $qu->response->attributes()->varName).$this->questionTitleSuffix;
$qtmp['title'] = explode('_', (string) $qu->response->attributes()->varName)[0].$this->questionTitleSuffix;
} else {
$qtmp['title'] = $sl.$qcount.$this->questionTitleSuffix;
}
Expand Down

0 comments on commit 1318758

Please sign in to comment.