getQuestionAttributes($ia[0]); $query = "SELECT other FROM {{questions}} WHERE qid=".$ia[0]." AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' "; $result = Yii::app()->db->createCommand($query)->query(); foreach ($result->readAll() as $row) { $other = $row['other']; } //question attribute random order set? if ($aQuestionAttributes['random_order']==1) { $ansquery = "SELECT * FROM {{answers}} WHERE qid=$ia[0] AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and scale_id=0 ORDER BY ".dbRandom(); } //question attribute alphasort set? elseif ($aQuestionAttributes['alphasort']==1) { $ansquery = "SELECT * FROM {{answers}} WHERE qid=$ia[0] AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and scale_id=0 ORDER BY answer"; } //no question attributes -> order by sortorder else { $ansquery = "SELECT * FROM {{answers}} WHERE qid=$ia[0] AND language='".$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']."' and scale_id=0 ORDER BY sortorder, answer"; } $ansresult = dbExecuteAssoc($ansquery)->readAll(); //Checked $anscount = count($ansresult); if (trim($aQuestionAttributes['display_columns'])!='') { $dcols = $aQuestionAttributes['display_columns']; } else { $dcols= 1; } if (trim($aQuestionAttributes['other_replace_text'][$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']])!='') { $othertext=$aQuestionAttributes['other_replace_text'][$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']]; } else { $othertext=gT('Other:'); } if (isset($other) && $other=='Y') {$anscount++;} //Count up for the Other answer 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"); $iBootCols = round(12/$dcols); $ansByCol = round($anscount/$dcols); $ansByCol = ($ansByCol > 0)?$ansByCol:1; //$answer = 'IKI: '.$iBootCols.' '.$ansByCol.' '.$wrapper['whole-start']; $answer = '
'; $answer .= '
AAAAAAAAAAAAAA'; //Time Limit Code if (trim($aQuestionAttributes['time_limit'])!='') { $answer .= return_timer_script($aQuestionAttributes, $ia); } //End Time Limit Code // Get array_filter stuff $rowcounter = 0; $colcounter = 1; $trbc=''; foreach ($ansresult as $key=>$ansrow) { $myfname = $ia[1].$ansrow['code']; $check_ans = ''; if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == $ansrow['code']) { $check_ans = CHECKED; } list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, '', $myfname, "div","form-group answer-item radio-item"); /* if(substr($wrapper['item-start'],0,4) == "\t'.$ansrow['answer'].''; $answer .= ' '; $answer .= $wrapper['item-end']; $answer .= '
'; ++$rowcounter; //if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols'] || (count($ansresult)-$key)==$wrapper['cols']-$colcounter) if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { if($colcounter == $wrapper['cols'] ) { //$answer .= 'là '.$wrapper['col-devide-last']; $answer .= '
'; } else { //$answer .= 'et là '.$wrapper['col-devide']; $answer .= ' '; $answer .= '
'; } $rowcounter = 0; ++$colcounter; } } if (isset($other) && $other=='Y') { $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']); $sSeparator = $sSeparator['separator']; if ($aQuestionAttributes['other_numbers_only']==1) { $oth_checkconditionFunction = 'fixnum_checkconditions'; } else { $oth_checkconditionFunction = 'checkconditions'; } if ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == '-oth-') { $check_ans = CHECKED; } else { $check_ans = ''; } $thisfieldname=$ia[1].'other'; if (isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$thisfieldname])) { $dispVal = $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$thisfieldname]; if ($aQuestionAttributes['other_numbers_only']==1) { $dispVal = str_replace('.',$sSeparator,$dispVal); } $answer_other = ' value="'.htmlspecialchars($dispVal,ENT_QUOTES).'"'; } else { $answer_other = ' value=""'; } 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"); $answer .= "\t$hiddenfield\n"; $answer .= '
'; $answer .= ' '; $answer .= ' '; $answer .= ' '; $answer .= $wrapper['item-end']; $answer .= '
'; $inputnames[]=$thisfieldname; ++$rowcounter; if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { if($colcounter == $wrapper['cols'] ) { $answer .= '
'; } else { $answer .= ' '; $answer .= '
'; } $rowcounter = 0; ++$colcounter; } } if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) { if ((!isset($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]]) || $_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == '') || ($_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]] == ' ' )) { $check_ans = CHECKED; //Check the "no answer" radio button if there is no answer in session. } else { $check_ans = ''; } $answer .= '
'; $answer .= ' '; $answer .= ' '; $answer .= $wrapper['item-end']; $answer .= '
'; // --> END NEW FEATURE - SAVE ++$rowcounter; //if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols']) if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) { if($colcounter == $wrapper['cols'] ) { //$answer .= $wrapper['col-devide-last']; $answer .= '
'; } else { //$answer .= $wrapper['col-devide']; $answer .= ' '; $answer .= '
'; } $rowcounter = 0; ++$colcounter; } } //END OF ITEMS //$answer .= $wrapper['whole-end'].' $answer .= ' getConfig('surveyID')][$ia[1]]."\" />\n"; $answer .= '
'; $inputnames[]=$ia[1]; return array($answer, $inputnames); } }