/**
     * Generic part of any survey question: the question field
     * @param array $surveyData
     * @param array $formData
     *
     * @return FormValidator
     */
    public function createForm($surveyData, $formData)
    {
        $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
        $questionId = isset($_GET['question_id']) ? intval($_GET['question_id']) : null;
        $surveyId = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : null;
        $toolName = Display::return_icon(SurveyManager::icon_question(Security::remove_XSS($_GET['type'])), get_lang(ucfirst(Security::remove_XSS($_GET['type']))), array('align' => 'middle', 'height' => '22px')) . ' ';
        if ($action == 'add') {
            $toolName .= get_lang('AddQuestion');
        }
        if ($action == 'edit') {
            $toolName .= get_lang('EditQuestion');
        }
        if ($_GET['type'] == 'yesno') {
            $toolName .= ': ' . get_lang('YesNo');
        } else {
            if ($_GET['type'] == 'multiplechoice') {
                $toolName .= ': ' . get_lang('UniqueSelect');
            } else {
                $toolName .= ': ' . get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
            }
        }
        $sharedQuestionId = isset($formData['shared_question_id']) ? $formData['shared_question_id'] : null;
        $url = api_get_self() . '?action=' . $action . '&type=' . Security::remove_XSS($_GET['type']) . '&survey_id=' . $surveyId . '&question_id=' . $questionId . '&' . api_get_cidreq();
        $form = new FormValidator('question_form', 'post', $url);
        $form->addHeader($toolName);
        $form->addHidden('survey_id', $surveyId);
        $form->addHidden('question_id', $questionId);
        $form->addHidden('shared_question_id', Security::remove_XSS($sharedQuestionId));
        $form->addHidden('type', Security::remove_XSS($_GET['type']));
        $config = array('ToolbarSet' => 'SurveyQuestion', 'Width' => '100%', 'Height' => '120');
        $form->addHtmlEditor('question', get_lang('Question'), true, false, $config);
        // When survey type = 1??
        if ($surveyData['survey_type'] == 1) {
            $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
            $sql = 'SELECT id,name FROM ' . $table_survey_question_group . '
                    WHERE survey_id = ' . (int) $_GET['survey_id'] . '
                    ORDER BY name';
            $rs = Database::query($sql);
            $glist = null;
            while ($row = Database::fetch_array($rs, 'NUM')) {
                $glist .= '<option value="' . $row[0] . '" >' . $row[1] . '</option>';
            }
            $grouplist = $grouplist1 = $grouplist2 = $glist;
            if (!empty($formData['assigned'])) {
                $grouplist = str_replace('<option value="' . $formData['assigned'] . '"', '<option value="' . $formData['assigned'] . '" selected', $glist);
            }
            if (!empty($formData['assigned1'])) {
                $grouplist1 = str_replace('<option value="' . $formData['assigned1'] . '"', '<option value="' . $formData['assigned1'] . '" selected', $glist);
            }
            if (!empty($formData['assigned2'])) {
                $grouplist2 = str_replace('<option value="' . $formData['assigned2'] . '"', '<option value="' . $formData['assigned2'] . '" selected', $glist);
            }
            $this->html .= '	<tr><td colspan="">
			<fieldset style="border:1px solid black"><legend>' . get_lang('Condition') . '</legend>

			<b>' . get_lang('Primary') . '</b><br />
			' . '<input type="radio" name="choose" value="1" ' . ($formData['choose'] == 1 ? 'checked' : '') . '><select name="assigned">' . $grouplist . '</select><br />';
            $this->html .= '
			<b>' . get_lang('Secondary') . '</b><br />
			' . '<input type="radio" name="choose" value="2" ' . ($formData['choose'] == 2 ? 'checked' : '') . '><select name="assigned1">' . $grouplist1 . '</select> ' . '<select name="assigned2">' . $grouplist2 . '</select>' . '</fieldset><br />';
            //$form->addRadio('choose', get_lang('Primary'));
            //$form->addRadio('choose', get_lang('Secondary'));
        }
        $this->setForm($form);
        return $form;
    }