Merge branch 'MDL-43697-master' of https://github.com/praxisdigital/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2021-02-22 23:09:53 +01:00
commit c79778bf9f

View File

@ -835,7 +835,9 @@ class backup_badges_structure_step extends backup_structure_step {
}
protected function define_structure() {
global $CFG;
require_once($CFG->libdir . '/badgeslib.php');
// Define each element separated.
$badges = new backup_nested_element('badges');
@ -886,7 +888,15 @@ class backup_badges_structure_step extends backup_structure_step {
// Define sources.
$badge->set_source_table('badge', array('courseid' => backup::VAR_COURSEID));
$parametersql = '
SELECT *
FROM {badge}
WHERE courseid = :courseid
AND status != ' . BADGE_STATUS_ARCHIVED;
$parameterparams = [
'courseid' => backup::VAR_COURSEID
];
$badge->set_source_sql($parametersql, $parameterparams);
$criterion->set_source_table('badge_criteria', array('badgeid' => backup::VAR_PARENTID));
$endorsement->set_source_table('badge_endorsement', array('badgeid' => backup::VAR_PARENTID));