|
@@ -1958,11 +1958,13 @@ class SurveyUtil
|
|
|
$table_survey = Database:: get_course_table(TABLE_SURVEY);
|
|
|
|
|
|
$course_id = api_get_course_int_id();
|
|
|
+ $survey_id = (int) $survey_id;
|
|
|
+ $user_id = Database::escape_string($user_id);
|
|
|
|
|
|
if (!empty($survey_id) && !empty($user_id)) {
|
|
|
// delete data from survey_answer by user_id and survey_id
|
|
|
$sql = "DELETE FROM $table_survey_answer
|
|
|
- WHERE c_id = $course_id AND survey_id = '".(int)$survey_id."' AND user = '".(int)$user_id."'";
|
|
|
+ WHERE c_id = $course_id AND survey_id = '".$survey_id."' AND user = '".$user_id."'";
|
|
|
Database::query($sql);
|
|
|
// update field answered from survey_invitation by user_id and survey_id
|
|
|
$sql = "UPDATE $table_survey_invitation SET answered = '0'
|
|
@@ -1972,15 +1974,16 @@ class SurveyUtil
|
|
|
SELECT code FROM $table_survey
|
|
|
WHERE
|
|
|
c_id = $course_id AND
|
|
|
- survey_id = '".(int)$survey_id."'
|
|
|
+ survey_id = '".$survey_id."'
|
|
|
) AND
|
|
|
- user = '".(int)$user_id."'";
|
|
|
+ user = '".$user_id."'";
|
|
|
$result = Database::query($sql);
|
|
|
}
|
|
|
|
|
|
if ($result !== false) {
|
|
|
$message = get_lang('SurveyUserAnswersHaveBeenRemovedSuccessfully').'<br />
|
|
|
- <a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.intval($survey_id).'">'.get_lang('GoBack').'</a>';
|
|
|
+ <a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$survey_id.'">'.
|
|
|
+ get_lang('GoBack').'</a>';
|
|
|
Display::display_confirmation_message($message, false);
|
|
|
}
|
|
|
}
|