From 3b13a8bc748165be9b663459a354ab038d855a8c Mon Sep 17 00:00:00 2001 From: LouisGac Date: Wed, 9 Dec 2015 12:27:25 +0100 Subject: [PATCH] Fixed issue #10092: do_list_radio wasn't bootstraped --- application/helpers/qanda_helper.php | 103 ++++++++++++++++++--------- 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/application/helpers/qanda_helper.php b/application/helpers/qanda_helper.php index 1da54794712..ba4ea053b04 100644 --- a/application/helpers/qanda_helper.php +++ b/application/helpers/qanda_helper.php @@ -1613,7 +1613,8 @@ function do_list_radio($ia) $ansresult = dbExecuteAssoc($ansquery)->readAll(); //Checked $anscount = count($ansresult); - if (trim($aQuestionAttributes['display_columns'])!='') { + if (trim($aQuestionAttributes['display_columns'])!='') + { $dcols = $aQuestionAttributes['display_columns']; } else @@ -1634,7 +1635,13 @@ function do_list_radio($ia) if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) {$anscount++;} //Count up if "No answer" is showing $wrapper = setupColumns($dcols , $anscount,"answers-list radio-list","answer-item radio-item"); - $answer = $wrapper['whole-start']; + + $iBootCols = round(12/$dcols); + $ansByCol = round($anscount/$dcols); $ansByCol = ($ansByCol > 0)?$ansByCol:1; + + //$answer = 'IKI: '.$iBootCols.' '.$ansByCol.' '.$wrapper['whole-start']; + $answer = '
'; + $answer .= '
'; //Time Limit Code if (trim($aQuestionAttributes['time_limit'])!='') @@ -1657,31 +1664,37 @@ function do_list_radio($ia) { $check_ans = CHECKED; } - - list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, $trbc, $myfname, "li","answer-item radio-item"); - if(substr($wrapper['item-start'],0,4) == "\t - - '.$wrapper['item-end']; + + $answer .= '
'; + $answer .= ' '; + $answer .= ' '; + $answer .= $wrapper['item-end']; + $answer .= '
'; ++$rowcounter; - if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols'] || (count($ansresult)-$key)==$wrapper['cols']-$colcounter) + //if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols'] || (count($ansresult)-$key)==$wrapper['cols']-$colcounter) + if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { - if($colcounter == $wrapper['cols'] - 1 ) + if($colcounter == $wrapper['cols'] ) { - $answer .= $wrapper['col-devide-last']; + //$answer .= 'là '.$wrapper['col-devide-last']; + $answer .= '
'; } else { - $answer .= $wrapper['col-devide']; + //$answer .= 'et là '.$wrapper['col-devide']; + $answer .= '
'; + $answer .= '
'; } $rowcounter = 0; ++$colcounter; @@ -1728,35 +1741,49 @@ function do_list_radio($ia) $answer_other = ' value=""'; } - list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, array("code"=>"other"), $thisfieldname, $trbc, $myfname, "li", "answer-item radio-item other-item other"); + list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, array("code"=>"other"), $thisfieldname, $trbc, $myfname, "div", "form-group answer-item radio-item other-item other"); +/* if(substr($wrapper['item-start-other'],0,4) == "\t'.$othertext.''; + $answer .= ' '; + $answer .= ' '; + $answer .= $wrapper['item-end']; + $answer .= '
'; + /* $answer .= "\t$hiddenfield\n"; - $answer .= ' - + $answer .= ' + '.$wrapper['item-end']; - +*/ $inputnames[]=$thisfieldname; ++$rowcounter; - if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols']) + //if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols']) + if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { - if($colcounter == $wrapper['cols'] - 1) + if($colcounter == $wrapper['cols'] ) { - $answer .= $wrapper['col-devide-last']; + //$answer .= $wrapper['col-devide-last']; + $answer .= ' '; } else { - $answer .= $wrapper['col-devide']; + //$answer .= $wrapper['col-devide']; + $answer .= ' '; + $answer .= '
'; } $rowcounter = 0; ++$colcounter; @@ -1774,21 +1801,30 @@ function do_list_radio($ia) $check_ans = ''; } - $answer .= $wrapper['item-start-noanswer'].' - - '.$wrapper['item-end']; +/// + + $answer .= '
'; + $answer .= ' '; + $answer .= ' '; + $answer .= $wrapper['item-end']; + $answer .= '
'; + // --> END NEW FEATURE - SAVE ++$rowcounter; - if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols']) + //if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols']) + if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { - if($colcounter == $wrapper['cols'] - 1) + if($colcounter == $wrapper['cols'] ) { - $answer .= $wrapper['col-devide-last']; + //$answer .= $wrapper['col-devide-last']; + $answer .= '
'; } else { - $answer .= $wrapper['col-devide']; + //$answer .= $wrapper['col-devide']; + $answer .= ' '; + $answer .= '
'; } $rowcounter = 0; ++$colcounter; @@ -1796,8 +1832,9 @@ function do_list_radio($ia) } //END OF ITEMS - $answer .= $wrapper['whole-end'].' - getConfig('surveyID')][$ia[1]]."\" />\n"; + //$answer .= $wrapper['whole-end'].' + $answer .= ' getConfig('surveyID')][$ia[1]]."\" />\n"; + $answer .= '
'; $inputnames[]=$ia[1]; return array($answer, $inputnames); @@ -2918,7 +2955,7 @@ function do_multipleshorttext($ia) $answer_main .= ''; - + } else {