Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Functions | Variables
badgeslib.php File Reference

Contains classes, functions and constants used in badges. More...

Functions

 badge_assemble_notification (stdClass $badge)
 Creates single message for all notification and sends it out. More...
 
 badge_award_criteria_competency_has_records_for_competencies ($competencyids)
 Check if any badge has records for competencies. More...
 
 badge_message_from_template ($message, $params)
 Replaces variables in a message template and returns text ready to be emailed to a user. More...
 
 badges_add_course_navigation (navigation_node $coursenode, stdClass $course)
 Extends the course administration navigation with the Badges page. More...
 
 badges_award_handle_manual_criteria_review (stdClass $data)
 Triggered when badge is manually awarded. More...
 
 badges_bake ($hash, $badgeid, $userid=0, $pathhash=false)
 Bake issued badge. More...
 
 badges_calculate_message_schedule ($schedule)
 Caclulates date for the next message digest to badge creators. More...
 
 badges_check_backpack_accessibility ()
 Checks if badges can be pushed to external backpack. More...
 
 badges_create_site_backpack ($data)
 Create the backpack with this data. More...
 
 badges_disconnect_user_backpack ($userid)
 Disconnect from the user backpack by deleting the user preferences. More...
 
 badges_download ($userid)
 Download all user badges in zip archive. More...
 
 badges_external_create_mapping ($sitebackpackid, $type, $internalid, $externalid)
 Save the info about which objects we connected with a backpack before. More...
 
 badges_external_delete_mapping ($sitebackpackid, $type, $internalid)
 Delete a specific external mapping information for a backpack. More...
 
 badges_external_delete_mappings ($sitebackpackid)
 Delete all external mapping information for a backpack. More...
 
 badges_external_get_mapping ($sitebackpackid, $type, $internalid)
 Used to remember which objects we connected with a backpack before. More...
 
 badges_get_badge_api_versions ()
 List the supported badges api versions. More...
 
 badges_get_badges ($type, $courseid=0, $sort='', $dir='', $page=0, $perpage=BADGE_PERPAGE, $user=0)
 Get all badges. More...
 
 badges_get_default_issuer ()
 Get the default issuer for a badge from this site. More...
 
 badges_get_site_backpack ($id)
 Get a site backpacks by id or url. More...
 
 badges_get_site_backpacks ()
 List the backpacks at site level. More...
 
 badges_get_user_badges ($userid, $courseid=0, $page=0, $perpage=0, $search='', $onlypublic=false)
 Get badges for a specific user. More...
 
 badges_handle_course_deletion ($courseid)
 Handles what happens to the course badges when a course is deleted. More...
 
 badges_list_criteria ($enabled=true)
 Return all the enabled criteria types for this site. More...
 
 badges_local_backpack_js ($checksite=false)
 No js files are required for backpack support. More...
 
 badges_notify_badge_award (badge $badge, $userid, $issued, $filepathhash)
 Sends notifications to users about awarded badges. More...
 
 badges_open_badges_backpack_api ()
 Is any backpack enabled that supports open badges V1? More...
 
 badges_process_badge_image (badge $badge, $iconfile)
 Process badge image from form data. More...
 
 badges_send_verification_email ($email, $backpackid, $backpackpassword)
 Create and send a verification email to the email address supplied. More...
 
 badges_setup_backpack_js ()
 Loads JS files required for backpack support. More...
 
 badges_update_site_backpack ($id, $data)
 Update the backpack with this id. More...
 
 badges_user_has_backpack ($userid)
 Checks if user has external backpack connected. More...
 
 badges_verify_backpack (int $backpackid)
 Attempt to authenticate with a backpack credentials and return an error if the authentication fails. More...
 
 badges_verify_site_backpack ()
 Attempt to authenticate with the site backpack credentials and return an error if the authentication fails. More...
 
 get_backpack_settings ($userid, $refresh=false)
 Returns external backpack settings and badges from this backpack. More...
 
 print_badge_image (badge $badge, stdClass $context, $size='small')
 Print badge image. More...
 

Variables

const BADGE_BACKPACKAPIURL 'https://backpack.openbadges.org'
 
const BADGE_BACKPACKURL 'https://backpack.openbadges.org'
 
const BADGE_BACKPACKWEBURL 'https://backpack.openbadges.org'
 
const BADGE_CRITERIA_AGGREGATION_ALL 1
 
const BADGE_CRITERIA_AGGREGATION_ANY 2
 
const BADGE_MESSAGE_ALWAYS 1
 
const BADGE_MESSAGE_DAILY 2
 
const BADGE_MESSAGE_MONTHLY 4
 
const BADGE_MESSAGE_NEVER 0
 
const BADGE_MESSAGE_WEEKLY 3
 
const BADGE_PERPAGE 50
 
const BADGE_STATUS_ACTIVE 1
 
const BADGE_STATUS_ACTIVE_LOCKED 3
 
const BADGE_STATUS_ARCHIVED 4
 
const BADGE_STATUS_INACTIVE 0
 
const BADGE_STATUS_INACTIVE_LOCKED 2
 
const BADGE_TYPE_COURSE 2
 
const BADGE_TYPE_SITE 1
 
const BADGRIO_BACKPACKAPIURL 'https://api.badgr.io/v2'
 
const BADGRIO_BACKPACKWEBURL 'https://badgr.io'
 
const OPEN_BADGES_V1 1
 
const OPEN_BADGES_V2 2
 
const OPEN_BADGES_V2_CONTEXT 'https://w3id.org/openbadges/v2'
 
const OPEN_BADGES_V2_TYPE_ASSERTION 'Assertion'
 
const OPEN_BADGES_V2_TYPE_AUTHOR 'Author'
 
const OPEN_BADGES_V2_TYPE_BADGE 'BadgeClass'
 
const OPEN_BADGES_V2_TYPE_ENDORSEMENT 'Endorsement'
 
const OPEN_BADGES_V2_TYPE_ISSUER 'Issuer'
 

Detailed Description

Contains classes, functions and constants used in badges.

@subpackage badges

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Author
Yuliya Bozhko yuliy.nosp@m.a.bo.nosp@m.zhko@.nosp@m.tota.nosp@m.ralms.nosp@m..com