$defaults['parent_id'] = 0;
}
if (isset($survey_data['survey_type']) && $survey_data['survey_type'] == 1 || $_GET['action'] == 'add') {
    $form->addElement('checkbox', 'one_question_per_page', null, get_lang('OneQuestionPerPage'));
    $form->addElement('checkbox', 'shuffle', null, get_lang('ActivateShuffle'));
}
$input_name_list = null;
if (isset($_GET['action']) && $_GET['action'] == 'edit' && !empty($survey_id)) {
    if ($survey_data['anonymous'] == 0) {
        $form->addElement('checkbox', 'show_form_profile', null, get_lang('ShowFormProfile'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
        if ($survey_data['show_form_profile'] == 1) {
            $form->addElement('html', '<div id="options_field" style="display:block">');
        } else {
            $form->addElement('html', '<div id="options_field" style="display:none">');
        }
        $field_list = SurveyUtil::make_field_list();
        if (is_array($field_list)) {
            // TODO hide and show the list in a fancy DIV
            foreach ($field_list as $key => &$field) {
                if ($field['visibility'] == 1) {
                    $form->addElement('checkbox', 'profile_' . $key, ' ', '&nbsp;&nbsp;' . $field['name']);
                    $input_name_list .= 'profile_' . $key . ',';
                }
            }
            // Necessary to know the fields
            $form->addElement('hidden', 'input_name_list', $input_name_list);
            // Set defaults form fields
            if ($survey_data['form_fields']) {
                $form_fields = explode('@', $survey_data['form_fields']);
                foreach ($form_fields as &$field) {
                    $field_value = explode(':', $field);