public function getSurveyQuestionSelect($surveyData, $currentQuestionCode, $targetQuestionCode) {
        $name = 'target[' . $targetQuestionCode . ']';
        if ($targetQuestionCode === null) {
            $name = 'notfound[]';
        }

        $select = \MUtil_Html::create()->select(['name' => $name]);
        $select->class = 'form-control';

        $empty = $this->util->getTranslated()->getEmptyDropdownArray();
        $select->option(reset($empty), ['value' => '']);

        foreach ($surveyData as $questionCode => $questionData) {
            $attributes = ['value' => $questionCode];
            if ($currentQuestionCode === $questionCode) {
                $attributes['selected'] = 'selected';
            }

            $select->option($questionData['question'], $attributes);
        }
        return $select;
    }
public function getSurveyQuestionSelect($surveyData, $currentQuestionCode, $targetQuestionCode) {
        $name = 'target[' . $targetQuestionCode . ']';
        if ($targetQuestionCode === null) {
            $name = 'notfound[]';
        }

        $select = \MUtil_Html::create()->select(['name' => $name]);
        $select->class = 'form-control';

        $empty = $this->util->getTranslated()->getEmptyDropdownArray();
        $select->option(reset($empty), ['value' => '']);

        foreach ($surveyData as $questionCode => $questionData) {
            $attributes = ['value' => $questionCode];
            if ($currentQuestionCode === $questionCode) {
                $attributes['selected'] = 'selected';
            }

            $select->option($questionData['question'], $attributes);
        }
        return $select;
    }
public function getSurveyQuestionSelect ( $ surveyData , $ currentQuestionCode , $ targetQuestionCode ) { $ name = 'target[' . $ targetQuestionCode . ']' ; if ( $ targetQuestionCode === null ) { $ name = 'notfound[]' ; } $ select = \ MUtil_Html :: create ( ) -> select ( [ 'name' => $ name ] ) ; $ select -> class = 'form-control' ; $ empty = $ this -> util -> getTranslated ( ) -> getEmptyDropdownArray ( ) ; $ select -> option ( reset ( $ empty ) , [ 'value' => '' ] ) ; foreach ( $ surveyData as $ questionCode => $ questionData ) { $ attributes = [ 'value' => $ questionCode ] ; if ( $ currentQuestionCode === $ questionCode ) { $ attributes [ 'selected' ] = 'selected' ; } $ select -> option ( $ questionData [ 'question' ] , $ attributes ) ; } return $ select ; }
Get the form select with all the questions in the survey and the current selected one

@param $surveyData array List of survey data
@param $currentQuestionCode string Current selected question code
@param $targetQuestionCode string the target question code used in the name field of the select
@return \MUtil_Html Select object
Get the form select with all the questions in the survey and the current selected one