MDL-66940 badges: Create page to display badges info
The OBv2.0 specification includes a field "Criteria" for BadgeClass. Until now, this field was filled using the URL of the badge assertion, but that is causing some issues in Badgr because it linked to the badge assertion of the first user sending this badge to the Badgr backpack (so then, the following users linked to the first user assertion page too). This patch adds a new page, badgeclass.php which will be used from now to display any badge information which is not related to any assertion (like happens with the criteria in BadgeClass).
This commit is contained in:
@@ -196,7 +196,10 @@ class core_badges_assertion {
|
||||
}
|
||||
}
|
||||
$class['image'] = 'data:image/png;base64,' . $imagedata;
|
||||
$class['criteria'] = $this->_url->out(false); // Currently issued badge URL.
|
||||
|
||||
$params = ['id' => $this->get_badge_id()];
|
||||
$badgeurl = new moodle_url('/badges/badgeclass.php', $params);
|
||||
$class['criteria'] = $badgeurl->out(false); // Currently badge URL.
|
||||
if ($issued) {
|
||||
$params = ['id' => $this->get_badge_id(), 'obversion' => $this->_obversion];
|
||||
$issuerurl = new moodle_url('/badges/issuer_json.php', $params);
|
||||
@@ -281,13 +284,15 @@ class core_badges_assertion {
|
||||
public function get_criteria_badge_class() {
|
||||
$badge = new badge($this->_data->id);
|
||||
$narrative = $badge->markdown_badge_criteria();
|
||||
$params = ['id' => $this->get_badge_id()];
|
||||
$badgeurl = new moodle_url('/badges/badgeclass.php', $params);
|
||||
if (!empty($narrative)) {
|
||||
$criteria = array();
|
||||
$criteria['id'] = $this->_url->out(false);
|
||||
$criteria = [];
|
||||
$criteria['id'] = $badgeurl->out(false);
|
||||
$criteria['narrative'] = $narrative;
|
||||
return $criteria;
|
||||
} else {
|
||||
return $this->_url->out(false);
|
||||
return $badgeurl->out(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user