Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug #632: Exporting to MS Word - fields and answers not matched up
and other small issues

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2517 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Mar 7, 2007
1 parent 8a5c93e commit 9c22191
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 37 deletions.
7 changes: 5 additions & 2 deletions admin/admin.php
Expand Up @@ -227,6 +227,8 @@
if (isset($addsummary )) {$adminoutput.= $addsummary;}
if (isset($answersummary )) {$adminoutput.= $answersummary;}
if (isset($cssummary )) {$adminoutput.= $cssummary;}



if (isset($editgroup)) {$adminoutput.= $editgroup;}
if (isset($editquestion)) {$adminoutput.= $editquestion;}
Expand All @@ -238,11 +240,12 @@
if (isset($orderquestions)) {$adminoutput.= $orderquestions;}
if (isset($surveysecurity)) {$adminoutput.= $surveysecurity;}
if (isset($newsurvey)) {$adminoutput.= $newsurvey;}
if (isset($newgroup)) {$adminoutput.= $newgroup;}
if (isset($newquestion)) {$adminoutput.= $newquestion;}
if (isset($newgroupoutput)) {$adminoutput.= $newgroupoutput;}
if (isset($newquestionoutput)) {$adminoutput.= $newquestionoutput;}
if (isset($newanswer)) {$adminoutput.= $newanswer;}
if (isset($editanswer)) {$adminoutput.= $editanswer;}
if (isset($assessmentsoutput)) {$adminoutput.= $assessmentsoutput;}

if (isset($importsurvey)) {$adminoutput.= $importsurvey;}
if (isset($importgroup)) {$adminoutput.= $importgroup;}
if (isset($importquestion)) {$adminoutput.= $importquestion;}
Expand Down
2 changes: 1 addition & 1 deletion admin/classes/PEAR/Spreadsheet_Excel_Writer/Writer.php
Expand Up @@ -31,7 +31,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

require_once 'PEAR.php';

require_once 'Spreadsheet/Excel/Writer/Workbook.php';

/**
Expand Down
2 changes: 1 addition & 1 deletion admin/exportresults.php
Expand Up @@ -742,7 +742,7 @@
break;
default:
$fielddata=arraySearchByKey($fieldinfo, $fieldmap, "fieldname", 1);
$ftitle=$fielddata['title'].":";
if (isset($fielddata['title'])) {$ftitle=$fielddata['title'].":";} else {$ftitle='';}
} // switch
}
}
Expand Down
60 changes: 30 additions & 30 deletions admin/html.php
Expand Up @@ -44,7 +44,7 @@

if($result->RecordCount() > 0) {
$listsurveys= "<br /><table align='center' bgcolor='#DDDDDD' style='border: 1px solid #555555' "
. "cellpadding='1' cellspacing='0' width='600'>
. "cellpadding='1' cellspacing='0' width='800'>
<tr bgcolor='#BBBBBB'>
<td height=\"22\"><strong>".$clang->gT("Survey")."</strong></td>
<td><strong>".$clang->gT("Date Created")."</strong></td>
Expand Down Expand Up @@ -77,7 +77,7 @@
$datecreated=$rows['datecreated'] ;

$listsurveys.="<tr>
<td><a href='".$scriptname."?sid=".$rows['sid']."'>".$rows['short_title']."</a></td>".
<td><a href='".$scriptname."?sid=".$rows['sid']."'>".$rows['surveyls_title']."</a></td>".
"<td>".$datecreated."</td>".
"<td>".$visibility."</td>" .
"<td>".$status."</td>".
Expand All @@ -90,7 +90,7 @@
}else{
$listsurveys .= "<td>&nbsp;</td>";
}
$listsurvey .= "</tr>" ;
$listsurveys .= "</tr>" ;
}
if($_SESSION['USER_RIGHT_CREATE_SURVEY'])
{
Expand Down Expand Up @@ -2083,7 +2083,7 @@

if($sumrows5['define_questions'])
{
$newquestion = "\t<form action='$scriptname' name='addnewquestion1' method='post'>\n"
$newquestionoutput = "\t<form action='$scriptname' name='addnewquestion1' method='post'>\n"
. "<table width='100%' border='0'>\n\n"
. "\t<tr>\n"
. "\t\t<td colspan='2' bgcolor='black' align='center'>"
Expand All @@ -2110,31 +2110,31 @@
. "\t\t</select></td>\n"
. "\t</tr>\n";

$newquestion .= "\t<tr id='Validation'>\n"
$newquestionoutput .= "\t<tr id='Validation'>\n"
. "\t\t<td align='right'><strong>".$clang->gT("Validation:")."</strong></td>\n"
. "\t\t<td>\n"
. "\t\t<input type='text' name='preg' size=50 />\n"
. "\t\t</td>\n"
. "\t</tr>\n";

$newquestion .= "\t<tr id='LabelSets' style='display: none'>\n"
$newquestionoutput .= "\t<tr id='LabelSets' style='display: none'>\n"
. "\t\t<td align='right'><strong>".$clang->gT("Label Set:")."</strong></td>\n"
. "\t\t<td>\n"
. "\t\t<select name='lid' >\n";
$labelsets=getlabelsets();
if (count($labelsets)>0)
{
$newquestion .= "\t\t\t<option value=''>".$clang->gT("Please Choose...")."</option>\n";
$newquestionoutput .= "\t\t\t<option value=''>".$clang->gT("Please Choose...")."</option>\n";
foreach ($labelsets as $lb)
{
$newquestion .= "\t\t\t<option value='{$lb[0]}'>{$lb[1]}</option>\n";
$newquestionoutput .= "\t\t\t<option value='{$lb[0]}'>{$lb[1]}</option>\n";
}
}
$newquestion .= "\t\t</select>\n"
$newquestionoutput .= "\t\t</select>\n"
. "\t\t</td>\n"
. "\t</tr>\n";

$newquestion .= "\t<tr id='OtherSelection' style='display: none'>\n"
$newquestionoutput .= "\t<tr id='OtherSelection' style='display: none'>\n"
. "\t\t<td align='right'><strong>".$clang->gT("Other:")."</strong></td>\n"
. "\t\t<td>\n"
. "\t\t\t<label for='OY'>".$clang->gT("Yes")."</label>"
Expand All @@ -2144,7 +2144,7 @@
. "\t\t</td>\n"
. "\t</tr>\n";

$newquestion .= "\t<tr id='MandatorySelection'>\n"
$newquestionoutput .= "\t<tr id='MandatorySelection'>\n"
. "\t\t<td align='right'><strong>".$clang->gT("Mandatory:")."</strong></td>\n"
. "\t\t<td>\n"
. "\t\t\t<label for='MY'>".$clang->gT("Yes")."</label>"
Expand All @@ -2157,18 +2157,18 @@
//Question attributes
$qattributes=questionAttributes();

$newquestion .= "\t<tr id='QTattributes'>
$newquestionoutput .= "\t<tr id='QTattributes'>
<td align='right'><strong>".$clang->gT("Question Attributes:")."</strong></td>
<td><select id='QTlist' name='attribute_name' >
</select>
<input type='text' id='QTtext' name='attribute_value' /></td></tr>\n";
$newquestion .= "\t<tr>\n"
$newquestionoutput .= "\t<tr>\n"
. "\t\t<td colspan='2' align='center'>";

if (isset($eqrow)) {$newquestion .= questionjavascript($eqrow['type'], $qattributes);}
else {$newquestion .= questionjavascript('', $qattributes);}
if (isset($eqrow)) {$newquestionoutput .= questionjavascript($eqrow['type'], $qattributes);}
else {$newquestionoutput .= questionjavascript('', $qattributes);}

$newquestion .= "<input type='submit' value='"
$newquestionoutput .= "<input type='submit' value='"
. $clang->gT("Add Question")."' />\n"
. "\t\n"
. "\t<input type='hidden' name='action' value='insertnewquestion' />\n"
Expand Down Expand Up @@ -2687,19 +2687,19 @@
$grplangs[] = $baselang;
$grplangs = array_reverse($grplangs);

$newgroup = "<tr><td><form action='$scriptname' name='addnewgroupfrom' method='post'>"
$newgroupoutput = "<tr><td><form action='$scriptname' name='addnewgroupfrom' method='post'>"
."<table width='100%' border='0'><tr>\n"
."\t<td colspan='2' bgcolor='black' align='center'>\n\t\t<strong><font color='white'>".$clang->gT("Add Group")."</font></strong></td>"
."</tr></table>\n";


$newgroup .="<table width='100%' border='0'>\n\t<tr><td>\n"
$newgroupoutput .="<table width='100%' border='0'>\n\t<tr><td>\n"
. '<div class="tab-pane" id="tab-pane-1">';
foreach ($grplangs as $grouplang)
{
$newgroup .= '<div class="tab-page"> <h2 class="tab">'.GetLanguageNameFromCode($grouplang);
if ($grouplang==$baselang) {$newgroup .= '('.$clang->gT("Base Language").')';}
$newgroup .= "</h2>"
$newgroupoutput .= '<div class="tab-page"> <h2 class="tab">'.GetLanguageNameFromCode($grouplang);
if ($grouplang==$baselang) {$newgroupoutput .= '('.$clang->gT("Base Language").')';}
$newgroupoutput .= "</h2>"
. "<table width='100%' border='0'>"
. "\t\t<tr><td align='right'><strong>".$clang->gT("Title").":</strong></td>\n"
. "\t\t<td><input type='text' size='50' name='group_name_$grouplang' /><font color='red' face='verdana' size='1'> ".$clang->gT("Required")."</font></td></tr>\n"
Expand All @@ -2708,7 +2708,7 @@
. "</table></div>";
}

$newgroup.= "</div>"
$newgroupoutput.= "</div>"
. "\t<input type='hidden' name='action' value='insertnewgroup' />\n"
. "\t<input type='hidden' name='sid' value='$surveyid' /></td></tr>"
. "\t<tr><td colspan='2' align='center'><input type='submit' value='".$clang->gT("Add Group")."' />\n"
Expand Down Expand Up @@ -4009,23 +4009,23 @@ function replacenewline ($texttoreplace)

function questionjavascript($type, $qattributes)
{
$newquestion = "<script type='text/javascript'>\n"
$newquestionoutput = "<script type='text/javascript'>\n"
. "<!--\n"
."if (navigator.userAgent.indexOf(\"Gecko\") != -1)\n"
."window.addEventListener(\"load\", init_gecko_select_hack, false);\n";
$jc=0;
$newquestion .= "\t\t\tvar qtypes = new Array();\n";
$newquestion .= "\t\t\tvar qnames = new Array();\n\n";
$newquestionoutput .= "\t\t\tvar qtypes = new Array();\n";
$newquestionoutput .= "\t\t\tvar qnames = new Array();\n\n";
foreach ($qattributes as $key=>$val)
{
foreach ($val as $vl)
{
$newquestion .= "\t\t\tqtypes[$jc]='".$key."';\n";
$newquestion .= "\t\t\tqnames[$jc]='".$vl['name']."';\n";
$newquestionoutput .= "\t\t\tqtypes[$jc]='".$key."';\n";
$newquestionoutput .= "\t\t\tqnames[$jc]='".$vl['name']."';\n";
$jc++;
}
}
$newquestion .= "\t\t\t function buildQTlist(type)
$newquestionoutput .= "\t\t\t function buildQTlist(type)
{
document.getElementById('QTattributes').style.display='none';
for (var i=document.getElementById('QTlist').options.length-1; i>=0; i--)
Expand All @@ -4041,7 +4041,7 @@ function questionjavascript($type, $qattributes)
}
}
}";
$newquestion .="\nfunction OtherSelection(QuestionType)\n"
$newquestionoutput .="\nfunction OtherSelection(QuestionType)\n"
. "\t{\n"
. "if (QuestionType == '') {QuestionType=document.getElementById('question_type').value;}\n"
. "\tif (QuestionType == 'M' || QuestionType == 'P' || QuestionType == 'L' || QuestionType == '!')\n"
Expand Down Expand Up @@ -4077,7 +4077,7 @@ function questionjavascript($type, $qattributes)
. "-->\n"
. "</script>\n";

return $newquestion;
return $newquestionoutput;
}


Expand Down
6 changes: 3 additions & 3 deletions docs/demosurveys/Language_Question_Test.csv
Expand Up @@ -25,9 +25,9 @@
"49","31565","11","I","code_en","qeustion_en","","questionhelp_en","N","N","0","0","en"
"49","31565","11","I","code_en","qeustion_hr","","questionhelp_cr","N","N","0","0","hr"
"49","31565","11","I","code_en","qeustion_nl","","questionhelp_nl","N","N","0","0","nl"
"50","31565","11","M","code","question_en","preg","questionhelp_en","N","N","0","1","en"
"50","31565","11","M","code","question_hr","preg","questionhelp_hr","N","N","0","1","hr"
"50","31565","11","M","code","question_nl","preg","questionhelp_nl","N","N","0","1","nl"
"50","31565","11","M","code","question_en","","questionhelp_en","N","N","0","1","en"
"50","31565","11","M","code","question_hr","","questionhelp_hr","N","N","0","1","hr"
"50","31565","11","M","code","question_nl","","questionhelp_nl","N","N","0","1","nl"

#
# ANSWERS TABLE
Expand Down

0 comments on commit 9c22191

Please sign in to comment.