Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 403]

Badge assertion library.

Author: Yuliya Bozhko <yuliya.bozhko@totaralms.com>
Copyright: 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 407 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: core_badges_assertion  - X-Ref

Class that represents badge assertion.

__construct($hash, $obversion = OPEN_BADGES_V2)   X-Ref
Constructs with issued badge unique hash.

param: string $hash Badge unique hash from badge_issued table.
param: int $obversion to control version JSON-LD.

get_badge_id()   X-Ref
Get the local id for this badge.

return: int

get_assertion_hash()   X-Ref
Get the local id for this badge assertion.

return: string

get_badge_assertion($issued = true, $usesalt = true)   X-Ref
Get badge assertion.

param: boolean $issued Include the nested badge issued information.
param: boolean $usesalt Hash the identity and include the salt information for the hash.
return: array Badge assertion.

get_badge_class($issued = true)   X-Ref
Get badge class information.

param: boolean $issued Include the nested badge issuer information.
return: array Badge Class information.

get_issuer()   X-Ref
Get badge issuer information.

return: array Issuer information.

get_related_badges(badge $badge)   X-Ref
Get related badges of the badge.

param: badge $badge Badge object.
return: array|bool List related badges.

get_endorsement()   X-Ref
Get endorsement of the badge.

return: false|stdClass Endorsement information.

get_criteria_badge_class()   X-Ref
Get criteria of badge class.

return: array|string Criteria information.

get_alignments()   X-Ref
Get alignment of the badge.

return: array information.

embed_data_badge_version2(&$json, $type = OPEN_BADGES_V2_TYPE_ASSERTION)   X-Ref
Embed data of Open Badges Specification Version 2.0 to json.

param: array $json for assertion, badges, issuer.
param: string $type Content type.