} if (isset($_GET['action']) && $_GET['action'] == 'empty') { $mysession = api_get_session_id(); if ($mysession != 0) { if (!((api_is_course_coach() || api_is_platform_admin()) && api_is_element_in_the_session(TOOL_SURVEY, $_GET['survey_id']))) { // The coach can't empty a survey not belonging to his session api_not_allowed(); exit; } } else { if (!(api_is_course_admin() || api_is_platform_admin())) { api_not_allowed(); exit; } } $return = survey_manager::empty_survey(intval($_GET['survey_id'])); if ($return) { Display::display_confirmation_message(get_lang('SurveyEmptied'), false); } else { Display::display_error_message(get_lang('ErrorOccurred'), false); } } // Action handling: performing the same action on multiple surveys if (isset($_POST['action']) && $_POST['action']) { if (is_array($_POST['id'])) { foreach ($_POST['id'] as $key => &$value) { // getting the information of the survey (used for when the survey is shared) $survey_data = survey_manager::get_survey($value); // if the survey is shared => also delete the shared content if (is_numeric($survey_data['survey_share'])) { survey_manager::delete_survey($survey_data['survey_share'], true);