1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-07 09:23:31 +02:00

Merge branch 'MDL-65787-master' of git://github.com/sarjona/moodle

This commit is contained in:
Jun Pataleta 2019-06-05 17:24:27 +08:00
commit 7068d7be88

@ -79,24 +79,25 @@ class collections extends moodleform {
$hasgroups = false;
if (!empty($groups)) {
foreach ($groups as $group) {
// Assertions or badges.
$count = 0;
// Handle attributes based on backpack's supported version.
if ($sitebackpack->apiversion == OPEN_BADGES_V2) {
// OpenBadges v2 data attributes.
if (empty($group->published)) {
// Only public collections.
continue;
}
}
if (!empty($group->assertions)) {
// Get the number of badges associated with this collection from the assertions array returned.
$count = count($group->assertions);
}
if (!empty($group->badges)) {
$count = count($group->badges);
}
if (!empty($group->groupId)) {
} else {
// OpenBadges v1 data attributes.
$group->entityId = $group->groupId;
// Get the number of badges associated with this collection. In that case, the number is returned directly.
$count = $group->badges;
}
if (!$hasgroups) {
$mform->addElement('static', 'selectgroup', '', get_string('selectgroup_start', 'badges'));
}