diff --git a/admin/printablesurvey.php b/admin/printablesurvey.php
index c4ab0e05185..04d481e6a57 100644
--- a/admin/printablesurvey.php
+++ b/admin/printablesurvey.php
@@ -138,6 +138,7 @@ function try_debug($line)
{
$surveyname = "";
}
+
$survey_output = array(
'SITENAME' => $sitename
,'SURVEYNAME' => $surveyname
@@ -434,9 +435,9 @@ function star_replace($input)
$x=0;
$distinctquery="SELECT cqid, method, cfieldname, value
FROM ".db_table_name("conditions")."
- WHERE ".db_table_name("conditions").".qid={$deqrow['qid']}
- AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']}
- group by cqid, method
+ WHERE ".db_table_name("conditions").".qid={$deqrow['qid']}
+ AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']}
+ group by cqid, method, cfieldname, value
ORDER BY cqid";
$distinctresult=db_execute_assoc($distinctquery);
//Loop through each condition for a particular scenario.
@@ -643,7 +644,7 @@ function star_replace($input)
} // while
break;
} // switch
-
+
// Now let's complete the answer text with the answer_section
$answer_section="";
switch($conrow['type'])
@@ -755,20 +756,20 @@ function star_replace($input)
++$total_questions;
-
+
//TIBO map question qid to their q number
$mapquestionsNumbers[$deqrow['qid']]=$total_questions;
//END OF GETTING CONDITIONS
$qid = $deqrow['qid'];
$fieldname = "$surveyid"."X"."$gid"."X"."$qid";
-
+
if(isset($showsgqacode) && $showsgqacode == true)
{
$deqrow['question'] = $deqrow['question']."
".$clang->gT("ID:")." $fieldname
".
- $clang->gT("Question code:")." ".$deqrow['title'];
+ $clang->gT("Question code:")." ".$deqrow['title'];
}
-
+
$question = array(
'QUESTION_NUMBER' => $total_questions // content of the question code field
,'QUESTION_CODE' => $deqrow['title']
@@ -784,7 +785,7 @@ function star_replace($input)
,'QUESTIONHELP' => '' // content of the question help field.
,'ANSWER' => '' // contains formatted HTML answer
);
-
+
if ($deqrow['mandatory'] == 'Y')
{
@@ -804,7 +805,7 @@ function star_replace($input)
{
$hh = $deqrow['help'];
$question['QUESTIONHELP'] = $hh;
-
+
if(isset($_POST['printableexport'])){$pdf->helptextintopdf($hh);}
}
@@ -814,7 +815,7 @@ function star_replace($input)
$question['QUESTION_CLASS'] .=' breakbefore ';
}
-
+
if (isset($qidattributes['maximum_chars']) && $qidattributes['maximum_chars']!='') {
$question['QUESTION_CLASS'] ="max-chars-{$qidattributes['maximum_chars']} ".$question['QUESTION_CLASS'];
}
@@ -1020,7 +1021,7 @@ function star_replace($input)
$question['ANSWER'] .= $wrapper['item-start'].input_type_image('checkbox',$mearow['question'])."\n\t\t".$mearow['question'].addsgqacode(" (".$fieldname.$mearow['title'].") ").$wrapper['item-end'];
if(isset($_POST['printableexport'])){$pdf->intopdf(" o ".$mearow['answer']);}
// $upto++;
-
+
++$rowcounter;
if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols'])
{
@@ -1127,7 +1128,7 @@ function star_replace($input)
if (isset($qidattributes['slider_layout']) && $qidattributes['slider_layout']==1)
{
$mearow['question']=explode(':',$mearow['question']);
- $mearow['question']=$mearow['question'][0];
+ $mearow['question']=$mearow['question'][0];
}
$question['ANSWER'] .= "\t
\n"; $fquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND scale_id=1 AND language='{$surveyprintlang}' ORDER BY question_order"; - $fresult = db_execute_assoc($fquery); - + $fresult = db_execute_assoc($fquery); + $fcount = $fresult->RecordCount(); $fwidth = "120"; $i=0; $pdfoutput = array(); $pdfoutput[0][0]=' '; - + //array to temporary store X axis question codes $xaxisarray = array(); while ($frow = $fresult->FetchRow()) @@ -1448,9 +1449,9 @@ function star_replace($input) $question['ANSWER'] .= "\t\t\t | {$frow['question']} | \n"; $i++; $pdfoutput[0][$i]=$frow['question']; - + //add current question code - $xaxisarray[$i] = $frow['title']; + $xaxisarray[$i] = $frow['title']; } $question['ANSWER'] .= "\t\t{$frow['question']} | \n"; $i++; $pdfoutput[0][$i]=$frow['question']; - + //add current question code $xaxisarray[$i] = $frow['title']; } @@ -1613,17 +1614,17 @@ function star_replace($input) $question['ANSWER'] .= "\t\t
---|---|---|
$answertext | \n"; - + $pdfoutput[$counter][0]=$answertext; for ($i=1; $i<=$fcount; $i++) { @@ -1644,7 +1645,7 @@ function star_replace($input) $counter++; $answertext=$mearow['question']; - + //semantic differential question type? if (strpos($mearow['question'],'|')) { @@ -1696,18 +1697,18 @@ function star_replace($input) $fcount1 = $fresult1->RecordCount(); $fwidth = "120"; $l2=0; - + //array to temporary store second scale question codes - $scale2array = array(); + $scale2array = array(); while ($frow1 = $fresult1->FetchRow()) { $printablesurveyoutput2 .="\t\t\t{$frow1['answer']} | \n"; $pdfoutput[1][$l2]=$frow['answer']; - + //add current question code $scale2array[$l2] = $frow1['code']; - - $l2++; + + $l2++; } // build header if needed if ($leftheader != '' || $rightheader !='') @@ -1760,7 +1761,7 @@ function star_replace($input) $question['ANSWER'] .= "\t\t\t$answertext | \n"; } $question['ANSWER'] .= "\t\t