Navigation Menu

Skip to content

Commit

Permalink
Fixed issue #8160: queXML export: ambigous variable names in text/num…
Browse files Browse the repository at this point in the history
…ber/dual matrix question

Dev: Variable names are now built as:
Dev: [questioncode]_[y-scale code]_[x-scale code].
Dev: Varnames are thus compatible with VV-export,
Dev: Stata-XML and so on and so forth, which facilitates
Dev: easy merging of data collected with quexf and LS
  • Loading branch information
mfaber committed Oct 13, 2013
1 parent f30fb17 commit bb98e8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/helpers/export_helper.php
Expand Up @@ -1039,7 +1039,7 @@ function quexml_create_multi(&$question,$qid,$varname,$scale_id = false,$free =
else
$response->appendChild(QueXMLCreateFree($free['f'],$free['len'],$Row['question']));

$response->setAttribute("varName",$varname . QueXMLCleanup($Row['title']));
$response->setAttribute("varName",QueXMLCleanup($Row['title']));

$question->appendChild($response);
}
Expand Down Expand Up @@ -1105,7 +1105,7 @@ function quexml_create_subQuestions(&$question,$qid,$varname,$use_answers = fals
$subQuestion = $dom->createElement("subQuestion");
$text = $dom->createElement("text",QueXMLCleanup($Row['question'],''));
$subQuestion->appendChild($text);
$subQuestion->setAttribute("varName",$varname . QueXMLCleanup($Row['title']));
$subQuestion->setAttribute("varName",$varname .'_'. QueXMLCleanup($Row['title']));
$question->appendChild($subQuestion);
}

Expand Down
11 changes: 11 additions & 0 deletions application/libraries/admin/quexmlpdf.php
Expand Up @@ -1695,6 +1695,17 @@ protected function createQuestion($question)

$bgtype = 3; //box group type temp set to 3 (text)

// question with > 1 responses and >1 subquestions --> matrix question --> need to come up with unique variable names
if (count($question['responses'])>1)
{
foreach ($subquestions as $index=>$sv)
{
$subquestions[$index]['varname']=$subquestions[$index]['varname'].'_'.$varname;
}
}
$debugoutput=$subquestions;
file_put_contents('/debugdata.txt', print_r($debugoutput, true), FILE_APPEND);

switch ($type)
{
case 'fixed':
Expand Down

0 comments on commit bb98e8a

Please sign in to comment.