'middle', 'height' => '22px'] ).' '; if ($action == 'add') { $toolName .= get_lang('AddQuestion').': '; } elseif ($action == 'edit') { $toolName .= get_lang('EditQuestion').': '; } switch ($_GET['type']) { case 'yesno': $toolName .= get_lang('YesNo'); break; case 'multiplechoice': $toolName .= get_lang('UniqueSelect'); break; case 'multipleresponse': $toolName .= get_lang('MultipleResponse'); break; default: $toolName .= get_lang(api_ucfirst($type)); } $sharedQuestionId = isset($formData['shared_question_id']) ? $formData['shared_question_id'] : null; $url = api_get_self().'?action='.$action.'&type='.$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', $type); $config = [ 'ToolbarSet' => 'SurveyQuestion', 'Width' => '100%', 'Height' => '120', ]; $form->addHtmlEditor( 'question', get_lang('Question'), true, false, $config ); if (api_get_configuration_value('allow_required_survey_questions') && in_array($_GET['type'], ['yesno', 'multiplechoice'])) { $form->addCheckBox('is_required', get_lang('IsMandatory'), get_lang('Yes')); } // 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 .= ''; } $grouplist = $grouplist1 = $grouplist2 = $glist; if (!empty($formData['assigned'])) { $grouplist = str_replace( '