Skip to content

Commit

Permalink
Fixed issue #7638: Crash when viewing printable version
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 5, 2013
1 parent 7bb00d2 commit eb7a2e6
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions application/controllers/admin/printablesurvey.php
Expand Up @@ -927,9 +927,9 @@ function index($surveyid, $lang = null)

$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer(s) here:");

$mearesult=Questions::model()->getAllRecords("parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}'", array('question_order'));

$longest_string = 0;
$mearesult=Questions::model()->getAllRecords("parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}'", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$longest_string = longestString($mearow['question'] , $longest_string );
Expand Down Expand Up @@ -990,7 +990,6 @@ function index($surveyid, $lang = null)
// ==================================================================
case "A": //ARRAY (5 POINT CHOICE)
$condition = "parent_qid = '{$deqrow['qid']}' AND language= '{$surveyprintlang}'";
$mearesult= Questions::model()->getAllRecords( $condition, array('question_order'));
$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand All @@ -1010,6 +1009,7 @@ function index($surveyid, $lang = null)

$j=0;
$rowclass = 'array1';
$mearesult= Questions::model()->getAllRecords( $condition, array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
Expand Down Expand Up @@ -1047,7 +1047,6 @@ function index($surveyid, $lang = null)

// ==================================================================
case "B": //ARRAY (10 POINT CHOICE)
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));

$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);
Expand All @@ -1060,6 +1059,7 @@ function index($surveyid, $lang = null)
$question['ANSWER'] .= "\t</thead>\n\n\t<tbody>\n";
$j=0;
$rowclass = 'array1';
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{

Expand All @@ -1078,7 +1078,6 @@ function index($surveyid, $lang = null)

// ==================================================================
case "C": //ARRAY (YES/UNCERTAIN/NO)
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));

$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);
Expand All @@ -1099,6 +1098,7 @@ function index($surveyid, $lang = null)

$rowclass = 'array1';

$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
Expand All @@ -1115,7 +1115,6 @@ function index($surveyid, $lang = null)
break;

case "E": //ARRAY (Increase/Same/Decrease)
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));
$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand All @@ -1134,6 +1133,7 @@ function index($surveyid, $lang = null)
$j=0;
$rowclass = 'array1';

$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
Expand Down Expand Up @@ -1182,7 +1182,6 @@ function index($surveyid, $lang = null)
} else {
$checkboxlayout=false;
}
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' and scale_id=0 AND language='{$surveyprintlang}' ", array('question_order'));

$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand All @@ -1207,6 +1206,7 @@ function index($surveyid, $lang = null)
$a=1; //Counter for pdfoutput
$rowclass = 'array1';

$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' and scale_id=0 AND language='{$surveyprintlang}' ", array('question_order'));
$result = $mearesult->readAll();
foreach ($result as $frow)
{
Expand Down Expand Up @@ -1247,7 +1247,7 @@ function index($surveyid, $lang = null)
case ";": //ARRAY (Multi Flexible) (text)
$headstyle="style='padding-left: 20px; padding-right: 7px'";
$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND scale_id=0 AND language='{$surveyprintlang}' ", array('question_order'));

$mearesult=$mearesult->readAll();

$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand All @@ -1271,7 +1271,7 @@ function index($surveyid, $lang = null)
$a=1;
$rowclass = 'array1';

foreach ($mearesult->readAll() as $mearow)
foreach ($mearesult as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
$rowclass = alternation($rowclass,'row');
Expand Down Expand Up @@ -1299,9 +1299,6 @@ function index($surveyid, $lang = null)

// ==================================================================
case "F": //ARRAY (Flexible Labels)

$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));

$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand Down Expand Up @@ -1343,6 +1340,7 @@ function index($surveyid, $lang = null)
$counter = 1;
$rowclass = 'array1';

$mearesult=Questions::model()->getAllRecords(" parent_qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
Expand Down Expand Up @@ -1396,10 +1394,6 @@ function index($surveyid, $lang = null)
$rightheader= $qidattributes['dualscale_headerB'][$surveyprintlang];

$headstyle = 'style="padding-left: 20px; padding-right: 7px"';
//$meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order";
//$mearesult = Yii::app()->db->createCommand($meaquery)->query();
$mearesult=Questions::model()->getAllRecords(" parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ", array('question_order'));

$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['QUESTION_TYPE_HELP'] .= self::_array_filter_help($qidattributes, $surveyprintlang, $surveyid);

Expand Down Expand Up @@ -1469,6 +1463,7 @@ function index($surveyid, $lang = null)

//counter for each subquestion
$sqcounter = 0;
$mearesult=Questions::model()->getAllRecords(" parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ", array('question_order'));
foreach ($mearesult->readAll() as $mearow)
{
$question['ANSWER'] .= "\t\t<tr class=\"$rowclass\">\n";
Expand Down Expand Up @@ -1511,7 +1506,6 @@ function index($surveyid, $lang = null)
$question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:");
$question['ANSWER'] .= "\n<table>\n\t<thead>\n\t\t<tr>\n\t\t\t<td>&nbsp;</td>\n";

$mearesult=Answers::model()->getAllRecords(" qid='{$deqrow['qid']}' AND scale_id=0 AND language='{$surveyprintlang}' ", array('sortorder','code'));
$fcount = count($fresult);
$fwidth = "120";
$i=0;
Expand All @@ -1524,7 +1518,7 @@ function index($surveyid, $lang = null)
$a=1;
$rowclass = 'array1';


$mearesult=Answers::model()->getAllRecords(" qid='{$deqrow['qid']}' AND scale_id=0 AND language='{$surveyprintlang}' ", array('sortorder','code'));
foreach ($mearesult->readAll() as $mearow)
{
//$_POST['type']=$type;
Expand Down

0 comments on commit eb7a2e6

Please sign in to comment.