/** * This function deletes a survey question and all its options * * @param integer $survey_id the id of the survey * @param integer $question_id the id of the question * @param integer $shared * * @todo also delete the answers to this question * * @author Patrick Cool <*****@*****.**>, Ghent University * @version March 2007 */ public static function delete_survey_question($survey_id, $question_id, $shared = false) { $course_id = api_get_course_int_id(); // Table definitions $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); if ($shared) { survey_manager::delete_shared_survey_question($survey_id, $question_id); } // Deleting the survey questions $sql = "DELETE FROM {$table_survey_question}\n\t\t WHERE\n\t\t c_id = {$course_id} AND\n\t\t survey_id='" . Database::escape_string($survey_id) . "' AND\n\t\t question_id='" . Database::escape_string($question_id) . "'"; Database::query($sql); // Deleting the options of the question of the survey survey_manager::delete_survey_question_option($survey_id, $question_id, $shared); }
/** * This function deletes a survey question and all its options * * @param integer $survey_id the id of the survey * @param integer $question_id the id of the question * @param integer $shared * * @todo also delete the answers to this question * * @author Patrick Cool <*****@*****.**>, Ghent University * @version March 2007 */ public static function delete_survey_question($survey_id, $question_id, $shared = false) { $course_id = api_get_course_int_id(); // Table definitions $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); if ($shared) { survey_manager::delete_shared_survey_question($survey_id, $question_id); } // Deleting the survey questions $sql = "DELETE FROM $table_survey_question WHERE c_id = $course_id AND survey_id='".intval($survey_id)."' AND question_id='".intval($question_id)."'"; Database::query($sql); // Deleting the options of the question of the survey survey_manager::delete_survey_question_option($survey_id, $question_id, $shared); }