Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Communicate with backpacks.

Author: Tung Thai <Tung.ThaiDuc@nashtechglobal.com>
Copyright: 2020 Tung Thai based on Totara Learning Solutions Ltd {@link http://www.totaralms.com/} dode
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 236 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

backpack_api2p1:: (7 methods):
  __construct()
  define_mappings()
  disconnect_backpack()
  curl_request()
  get_stored_token()
  get_clientid()
  put_assertions()


Class: backpack_api2p1  - X-Ref

To process badges with backpack and control api request and this class using for Open Badge API v2.1 methods.

__construct($externalbackpack)   X-Ref
backpack_api2p1 constructor.

param: object $externalbackpack object

define_mappings()   X-Ref
Define the mappings supported by this usage and api version.


disconnect_backpack($backpack)   X-Ref
Disconnect the backpack from this user.

param: object $backpack to disconnect.
return: bool

curl_request($action, $postdata = null)   X-Ref
Make an api request.

param: string $action The api function.
param: string $postdata The body of the api request.
return: mixed

get_stored_token($externalbackpackid)   X-Ref
Get token.

param: int $externalbackpackid ID of external backpack.
return: oauth2\badge_backpack_oauth2|false|stdClass|null

get_clientid($issuerid)   X-Ref
Get client id.

param: int $issuerid id of Oauth2 service.

put_assertions($hash)   X-Ref
Export a badge to the backpack site.

param: string $hash of badge issued.
return: array