From 41198449026abfdd5897b72916d36ab8c9c4adcc Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 8 Oct 2003 07:35:53 +0000 Subject: [PATCH] Now scales users are in backup too. See bug 824. Closing it in some hours. --- backup/backuplib.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index 6d07a6043f..9098127a2b 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -39,7 +39,7 @@ $count_users = 0; - //Calculate needed users (calling every xxxx_get_participants function) + //Calculate needed users (calling every xxxx_get_participants function + scales users) $needed_users = backup_get_needed_users($course); //Calculate enrolled users (students + teachers) @@ -115,7 +115,8 @@ } //Returns every needed user (participant) in a course - //It uses the xxxx_get_participants() function. + //It uses the xxxx_get_participants() function + //plus users needed to backup scales. //WARNING: It returns only NEEDED users, not every // every student and teacher in the course, so it //must be merged with backup_get_enrrolled_users !! @@ -151,6 +152,21 @@ } } } + + //Now, add scales users (from site and course scales) + //Get users + $scaleusers = get_records_sql("SELECT DISTINCT userid,userid + FROM {$CFG->prefix}scale + WHERE courseid = '0' or courseid = '$courseid'"); + //Add scale users to results + if ($scaleusers) { + foreach ($scaleusers as $scaleuser) { + //If userid != 0 + if ($scaleuser->userid != 0) { + $result[$scaleuser->userid]->id = $scaleuser->userid; + } + } + } return $result; -- 2.39.5