Removing survey invitation data see #5847

skala
Julio Montoya 13 years ago
parent 6e1687a164
commit c649b13798
  1. 11
      main/inc/lib/usermanager.lib.php
  2. 18
      main/survey/survey.lib.php

@ -270,7 +270,7 @@ class UserManager
$table_user = Database :: get_main_table(TABLE_MAIN_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER);
$usergroup_rel_user = Database :: get_main_table(TABLE_USERGROUP_REL_USER); $usergroup_rel_user = Database :: get_main_table(TABLE_USERGROUP_REL_USER);
$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER); //$table_class_user = Database :: get_main_table(TABLE_MAIN_CLASS_USER);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); $table_admin = Database :: get_main_table(TABLE_MAIN_ADMIN);
$table_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); $table_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
@ -339,10 +339,9 @@ class UserManager
$sql = 'DELETE FROM '.$gradebook_results_table.' WHERE user_id = '.$user_id; $sql = 'DELETE FROM '.$gradebook_results_table.' WHERE user_id = '.$user_id;
Database::query($sql); Database::query($sql);
$user = Database::fetch_array($res);
$t_ufv = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES); $t_ufv = Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES);
$sqlv = "DELETE FROM $t_ufv WHERE user_id = $user_id"; $sqlv = "DELETE FROM $t_ufv WHERE user_id = $user_id";
$resv = Database::query($sqlv); Database::query($sqlv);
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
@ -367,9 +366,13 @@ class UserManager
//Delete user from friend lists //Delete user from friend lists
SocialManager::remove_user_rel_user($user_id, true); SocialManager::remove_user_rel_user($user_id, true);
} }
//Removing survey invitation
survey_manager::delete_all_survey_invitations_by_user($user_id);
// Delete students works // Delete students works
$sqlw = "DELETE FROM $table_work WHERE user_id = $user_id"; $sqlw = "DELETE FROM $table_work WHERE user_id = $user_id";
$resw = Database::query($sqlw); Database::query($sqlw);
unset($sqlw); unset($sqlw);
// Add event to system log // Add event to system log
$user_id_manager = api_get_user_id(); $user_id_manager = api_get_user_id();

@ -1,6 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Survey manager class
*
* @package chamilo.survey * @package chamilo.survey
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
* @author Julio Montoya Armas <gugli100@gmail.com>, Chamilo: Personality Test modification and rewriting large parts of the code * @author Julio Montoya Armas <gugli100@gmail.com>, Chamilo: Personality Test modification and rewriting large parts of the code
@ -21,12 +23,20 @@ $htmlHeadXtra[] = '<script>
setFocus(); setFocus();
}); });
</script>'; </script>';
/**
* Survey manager class
* @package chamilo.survey
*/
class survey_manager { class survey_manager {
public static function delete_all_survey_invitations_by_user($user_id) {
$user_id = intval($user_id);
if (empty($user_id)) {
return false;
}
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
$sql = "DELETE FROM $table_survey_invitation WHERE user = '$user_id'";
Database::query($sql);
}
public static function get_surveys($course_code, $session_id = 0) { public static function get_surveys($course_code, $session_id = 0) {
$table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey = Database :: get_course_table(TABLE_SURVEY);
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);

Loading…
Cancel
Save