Skip to content

Commit

Permalink
Merge branch 'MDL-65315-37' of git://github.com/peterRd/moodle into M…
Browse files Browse the repository at this point in the history
…OODLE_37_STABLE
  • Loading branch information
junpataleta committed Oct 4, 2019
2 parents 2ab788b + ce20bd7 commit 60e2e90
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions badges/classes/assertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ public function get_badge_assertion($issued = true, $usesalt = true) {
$hash = $this->_data->uniquehash;
$email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
$assertionurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'obversion' => $this->_obversion));
$classurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'action' => 1));

if ($this->_obversion == OPEN_BADGES_V2) {
$classurl = new moodle_url('/badges/badge_json.php', array('id' => $this->get_badge_id()));
} else {
$classurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'action' => 1));
}

// Required.
$assertion['uid'] = $hash;
Expand Down Expand Up @@ -193,7 +198,11 @@ public function get_badge_class($issued = true) {
$class['image'] = 'data:image/png;base64,' . $imagedata;
$class['criteria'] = $this->_url->out(false); // Currently issued badge URL.
if ($issued) {
$issuerurl = new moodle_url('/badges/assertion.php', array('b' => $this->_data->uniquehash, 'action' => 0));
if ($this->_obversion == OPEN_BADGES_V2) {
$issuerurl = new moodle_url('/badges/badge_json.php', array('id' => $this->get_badge_id(), 'action' => 0));
} else {
$issuerurl = new moodle_url('/badges/assertion.php', array('b' => $this->_data->uniquehash, 'action' => 0));
}
$class['issuer'] = $issuerurl->out(false);
}
$this->embed_data_badge_version2($class, OPEN_BADGES_V2_TYPE_BADGE);
Expand Down Expand Up @@ -329,10 +338,10 @@ protected function embed_data_badge_version2 (&$json, $type = OPEN_BADGES_V2_TYP
$hash = $this->_data->uniquehash;
$assertionsurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'obversion' => $this->_obversion));
$classurl = new moodle_url(
'/badges/assertion.php',
array('b' => $hash, 'action' => 1, 'obversion' => $this->_obversion)
'/badges/badge_json.php',
array('id' => $this->get_badge_id())
);
$issuerurl = new moodle_url('/badges/assertion.php', array('b' => $this->_data->uniquehash, 'action' => 0,
$issuerurl = new moodle_url('/badges/badge_json.php', array('id' => $this->get_badge_id(), 'action' => 0,
'obversion' => $this->_obversion));
// For assertion.
if ($type == OPEN_BADGES_V2_TYPE_ASSERTION) {
Expand Down

0 comments on commit 60e2e90

Please sign in to comment.