Skip to content

Commit

Permalink
Fixed issue #05731: Randomization group name seems to block "Test thi…
Browse files Browse the repository at this point in the history
…s survey"

Dev Now works for multiple languages.  If shift language mid-survey, the original randomization order will be retained.
  • Loading branch information
TMSWhite committed Mar 22, 2012
1 parent 4e4c1ce commit 859cc40
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions common_functions.php
Expand Up @@ -2843,6 +2843,55 @@ function createFieldMap($surveyid, $style='full', $force_refresh=false, $questio
if (isset($fieldmap)) {
if ($questionid == false)
{
// If the fieldmap was randomized, the master will contain the proper order. Copy that fieldmap with the new language settings.
if (isset($_SESSION['fieldmap-' . $surveyid . '-randMaster']))
{
$masterFieldmap = $_SESSION['fieldmap-' . $surveyid . '-randMaster'];
$mfieldmap = $_SESSION[$masterFieldmap];

foreach ($mfieldmap as $fieldname => $mf)
{
if (isset($fieldmap[$fieldname]))
{
$f = $fieldmap[$fieldname];
if (isset($f['question']))
{
$mf['question'] = $f['question'];
}
if (isset($f['subquestion']))
{
$mf['subquestion'] = $f['subquestion'];
}
if (isset($f['subquestion1']))
{
$mf['subquestion1'] = $f['subquestion1'];
}
if (isset($f['subquestion2']))
{
$mf['subquestion2'] = $f['subquestion2'];
}
if (isset($f['group_name']))
{
$mf['group_name'] = $f['group_name'];
}
if (isset($f['answerList']))
{
$mf['answerList'] = $f['answerList'];
}
if (isset($f['defaultvalue']))
{
$mf['defaultvalue'] = $f['defaultvalue'];
}
if (isset($f['help']))
{
$mf['help'] = $f['help'];
}
}
$mfieldmap[$fieldname] = $mf;
}
$fieldmap = $mfieldmap;
}

$_SESSION['fieldmap-' . $surveyid . $clang->langcode]=$fieldmap;
}

Expand Down
1 change: 1 addition & 0 deletions index.php
Expand Up @@ -2205,6 +2205,7 @@ function buildsurveysession($previewGroup=false)
$fieldmap=$copyFieldMap2;

$_SESSION['fieldmap-' . $surveyid . $_SESSION['s_lang']] = $fieldmap;
$_SESSION['fieldmap-' . $surveyid . '-randMaster'] = 'fieldmap-' . $surveyid . $_SESSION['s_lang'];
}
//die(print_r($fieldmap));

Expand Down

2 comments on commit 859cc40

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to be ported to Yii

@TMSWhite
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Please sign in to comment.