Skip to content

Commit

Permalink
Worked on the language question.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2181 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Dec 9, 2006
1 parent cb30ed2 commit bc11ec8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
31 changes: 15 additions & 16 deletions qanda.php
Expand Up @@ -288,12 +288,12 @@ function retrieveAnswers($ia, $notanswered=null, $notvalidated=null)
}
break;

case "I": //FILE CSV ONE
$values=do_list_CSV($ia);
case "I": //Language Question
$values=do_language($ia);
if (count($values[1]) > 1)
{
$qtitle .= "<br />\n</b><i><font size='1'>"
. _("Choose only one of the following")."</font></i><b>";
. _("Choose your language")."</font></i><b>";
}
break;
case "P": //MULTIPLE OPTIONS WITH COMMENTS checkbox + text
Expand Down Expand Up @@ -553,28 +553,27 @@ function do_date($ia)
}


function do_list_CSV($ia)
function do_language($ia)
{
global $dbprefix;
$ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid=$ia[0] AND language='".$_SESSION['s_lang']."' ORDER BY sortorder, answer";
$ansresult = db_execute_assoc($ansquery) or die("Couldn't get answers<br />$ansquery<br />".htmlspecialchars($connect->ErrorMsg()));
$anscount = $ansresult->RecordCount();
while ($ansrow = $ansresult->FetchRow())
global $dbprefix, $surveyid;
$answerlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$answerlangs [] = GetBaseLanguageFromSurveyID($surveyid);
$answer = "\n\t\t\t\t\t<select name='$ia[1]' id='$ia[1]' onChange='checkconditions(this.value, this.name, this.type);modfield(this.name);modlanguage(this.name)'>\n";
if (!$_SESSION[$ia[1]]) {$answer .= "\t\t\t\t\t\t<option value='' selected>"._("Please choose")."..</option>\n";}
foreach ($answerlangs as $ansrow)
{
$answer .= "\t\t\t\t\t\t<option value='{$ansrow['code']}'";
if ($_SESSION[$ia[1]] == $ansrow['code'])
$answer .= "\t\t\t\t\t\t<option value='{$ansrow}'";
if ($_SESSION[$ia[1]] == $ansrow)
{
$answer .= " selected";
}
elseif ($ansrow['default_value'] == "Y") {$answer .= " selected"; $defexists = "Y";}
$answer .= ">{$ansrow['answer']}</option>\n";
$answer .= ">".getLanguageNameFromCode($ansrow, true)."</option>\n";
}
if (!$_SESSION[$ia[1]]) {$answer = "\t\t\t\t\t\t<option value='' selected>"._("Please choose")."..</option>\n".$answer;}
$answer .= "\t\t\t\t\t</select>\n";
// --> START NEW FEATURE - SAVE
$answer = "\n\t\t\t\t\t<select name='$ia[1]' id='$ia[1]' onChange='checkconditions(this.value, this.name, this.type);modfield(this.name)'>\n".$answer;
// --> END NEW FEATURE - SAVE
$inputnames[]=$ia[1];
$answer .= "\n\t\t\t<input type='hidden' name='s_lang' id='s_lang' value='' />";

return array($answer, $inputnames);
}

Expand Down
9 changes: 8 additions & 1 deletion question.php
Expand Up @@ -121,7 +121,6 @@
$completed = "<br /><strong><font size='2' color='red'>"._("Did Not Save")."</font></strong><br /><br />\n\n";
$completed .= _("Your survey responses have not been recorded. This survey is not yet active.")."<br /><br />\n";
$completed .= "<a href='".$_SERVER['PHP_SELF']."?sid=$surveyid&amp;move=clearall'>"._("Clear Responses")."</a><br /><br />\n";
$completed .= "<font size='1'>$subquery</font>\n";
}
else
{
Expand Down Expand Up @@ -488,6 +487,14 @@
echo "\t\t\t\t}\n";
echo "\t\t\t}\n";
echo "\n";
echo "\t\tfunction modlanguage(name)\n";
echo "\t\t\t{\n";
echo "\t\t\t\ttemp=document.getElementById(name).value;\n";
echo "\t\t\t\tif (temp!='') {\n";
echo "\t\t\t\t\tdocument.getElementById('s_lang').value=temp;\n";
echo "\t\t\t\t}\n";
echo "\t\t\t} \n";
echo "\n";
echo "\t\tfunction inArray(needle, haystack)\n";
echo "\t\t\t{\n";
echo "\t\t\t\tfor (h in haystack) {\n";
Expand Down

0 comments on commit bc11ec8

Please sign in to comment.