mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-67451 badges: use the site OB version as default
This commit is contained in:
parent
800563e415
commit
d03d11095f
@ -36,7 +36,8 @@ if (empty($CFG->enablebadges)) {
|
||||
|
||||
$hash = required_param('b', PARAM_ALPHANUM); // Issued badge unique hash for badge assertion.
|
||||
$action = optional_param('action', null, PARAM_BOOL); // Generates badge class if true.
|
||||
$obversion = optional_param('obversion', OPEN_BADGES_V1, PARAM_INT); // For control format OB specification version.
|
||||
// OB specification version. If it's not defined, the site will be used as default.
|
||||
$obversion = optional_param('obversion', badges_open_badges_backpack_api(), PARAM_INT);
|
||||
|
||||
$assertion = new core_badges_assertion($hash, $obversion);
|
||||
|
||||
|
@ -54,6 +54,9 @@ class issued_badge implements renderable {
|
||||
/** @var badge class */
|
||||
public $badgeid = 0;
|
||||
|
||||
/** @var unique hash identifying the issued badge */
|
||||
public $hash;
|
||||
|
||||
/**
|
||||
* Initializes the badge to display
|
||||
*
|
||||
@ -62,7 +65,8 @@ class issued_badge implements renderable {
|
||||
public function __construct($hash) {
|
||||
global $DB;
|
||||
|
||||
$assertion = new \core_badges_assertion($hash);
|
||||
$this->hash = $hash;
|
||||
$assertion = new \core_badges_assertion($hash, badges_open_badges_backpack_api());
|
||||
$this->issued = $assertion->get_badge_assertion();
|
||||
$this->badgeclass = $assertion->get_badge_class();
|
||||
|
||||
|
@ -337,13 +337,13 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
|
||||
if ($USER->id == $userinfo->id && !empty($CFG->enablebadges)) {
|
||||
$output .= $this->output->single_button(
|
||||
new moodle_url('/badges/badge.php', array('hash' => $issued['uid'], 'bake' => true)),
|
||||
new moodle_url('/badges/badge.php', array('hash' => $ibadge->hash, 'bake' => true)),
|
||||
get_string('download'),
|
||||
'POST');
|
||||
if (!empty($CFG->badges_allowexternalbackpack) && ($expiration > $now) && badges_user_has_backpack($USER->id)) {
|
||||
|
||||
if (badges_open_badges_backpack_api() == OPEN_BADGES_V1) {
|
||||
$assertion = new moodle_url('/badges/assertion.php', array('b' => $issued['uid']));
|
||||
$assertion = new moodle_url('/badges/assertion.php', array('b' => $ibadge->hash));
|
||||
$action = new component_action('click', 'addtobackpack', array('assertion' => $assertion->out(false)));
|
||||
$attributes = array(
|
||||
'type' => 'button',
|
||||
@ -354,7 +354,7 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
$this->output->add_action_handler($action, 'addbutton');
|
||||
$output .= $tobackpack;
|
||||
} else {
|
||||
$assertion = new moodle_url('/badges/backpack-add.php', array('hash' => $issued['uid']));
|
||||
$assertion = new moodle_url('/badges/backpack-add.php', array('hash' => $ibadge->hash));
|
||||
$attributes = ['class' => 'btn btn-secondary m-1', 'role' => 'button'];
|
||||
$tobackpack = html_writer::link($assertion, get_string('addtobackpack', 'badges'), $attributes);
|
||||
$output .= $tobackpack;
|
||||
|
Loading…
x
Reference in New Issue
Block a user