diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index 4242fe7dda..7c68594ef9 100644 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -125,12 +125,6 @@ $survey_data['survey_id'] = $survey_invitation['survey_id']; // storing the answers if ($_POST) { - /* - echo '
'; - print_r($_POST); - echo ''; - */ - // getting all the types of the question (because of the special treatment of the score question type $sql = "SELECT * FROM $table_survey_question WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'"; $result = api_sql_query($sql, __FILE__, __LINE__); @@ -154,7 +148,7 @@ if ($_POST) // when it is a scoring question then the key of the array is the option_id and the value is the value if (is_array($value)) { - remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id); + SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id); foreach ($value as $answer_key => $answer_value) { if ($types[$survey_question_id] == 'score') @@ -167,7 +161,7 @@ if ($_POST) $option_id = $answer_value; $option_value = ''; } - store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value, $survey_data); + SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value, $survey_data); } } // all the other question types (open question, multiple choice, percentage, ...) @@ -192,9 +186,9 @@ if ($_POST) $survey_question_answer = $value; - remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id); - store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data); - //store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data); + SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id); + SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data); + //SurveyUtil::store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data); } } } @@ -337,75 +331,4 @@ echo ''; // Footer Display :: display_footer(); - - -/** - * This function stores an answer of a user on a question of a survey - * - * @param mixed $user the user id or email of the person who fills the survey - * @param integer $survey_id the survey id - * @param integer $question_id the question id - * @param integer $option_id the option id - * - * @author Patrick Cool