| Moodle APIs 4.3
    Moodle 4.3.6 (Build: 20240812) | 
Class that represents badge. More...
| Public Member Functions | |
| __construct ($badgeid) | |
| Constructs with badge details. | |
| add_related_badges ($relatedids) | |
| Add multiple related badges. | |
| calculate_expiry ($timestamp) | |
| Calculates badge expiry date based on either expirydate or expiryperiod. | |
| can_expire () | |
| Checks if badge has expiry period or date set up. | |
| delete ($archive=true) | |
| Fully deletes the badge or marks it as archived. | |
| delete_alignment ($alignmentid) | |
| Delete a alignment of badge. | |
| delete_related_badge ($relatedid) | |
| Delete an related badge. | |
| get_accepted_criteria () | |
| Return array of accepted criteria types for this badge. | |
| get_aggregation_method ($criteriatype=0) | |
| Get aggregation method for badge criteria. | |
| get_alignments () | |
| Get alignments of badge. | |
| get_awards () | |
| Gets list of users who have earned an instance of this badge. | |
| get_badge_issuer (?int $obversion=null) | |
| Define issuer information by format Open Badges specification version 2. | |
| get_badge_tags () | |
| Get tags of badge. | |
| get_context () | |
| Use to get context instance of a badge. | |
| get_criteria () | |
| Returns badge award criteria. | |
| get_criteria_completions ($userid) | |
| Gets an array of completed criteria from 'badge_criteria_met' table. | |
| get_endorsement () | |
| Get endorsement of badge. | |
| get_related_badges ($activeonly=false) | |
| Get related badges of badge. | |
| get_status_name () | |
| Use to get the name of badge status. | |
| has_awards () | |
| Checks if badge has been awarded to users. | |
| has_criteria () | |
| Checks if badges has award criteria set up. | |
| has_manual_award_criteria () | |
| Checks if badge has manual award criteria set. | |
| has_related () | |
| Checks if badge has related badges. | |
| is_active () | |
| Checks if badges is active. | |
| is_issued ($userid) | |
| Indicates whether badge has already been issued to a user. | |
| is_locked () | |
| Checks if badges is locked. | |
| issue ($userid, $nobake=false) | |
| Issue a badge to user. | |
| make_clone () | |
| Creates and saves a clone of badge with all its properties. | |
| markdown_badge_criteria () | |
| Markdown language support for criteria. | |
| review_all_criteria () | |
| Reviews all badge criteria and checks if badge can be instantly awarded. | |
| save () | |
| Save/update badge information in 'badge' table only. | |
| save_alignment ($alignment, $alignmentid=0) | |
| Insert/update alignment information of badge. | |
| save_endorsement ($endorsement) | |
| Insert/update Endorsement information of badge. | |
| set_status ($status=0) | |
| Use to set badge status. | |
| Static Public Member Functions | |
| static | get_aggregation_methods () | 
| Return array of aggregation methods. | |
| Public Attributes | |
| int | $attachment | 
| Is this badge image baked. | |
| int null | $awards | 
| Total users which have the award. | |
| integer | $courseid | 
| The course this badge belongs to. | |
| array | $criteria = array() | 
| Badge criteria. | |
| int null | $dateissued | 
| The date the badges were issued. | |
| string | $description | 
| Badge description. | |
| integer | $expiredate | 
| Timestamp this badge will expire. | |
| integer | $expireperiod | 
| Duration this badge is valid for. | |
| int | $id | 
| Badge id. | |
| string | $imageauthoremail | 
| The email of the author of the image for this badge. | |
| string | $imageauthorname | 
| The author of the image for this badge. | |
| string | $imageauthorurl | 
| The url of the author of the image for this badge. | |
| string | $imagecaption | 
| The caption of the image for this badge. | |
| string | $issuercontact | 
| The email of the issuer of this badge. | |
| string | $issuername | 
| The name of the issuer of this badge. | |
| string | $issuerurl | 
| The url of the issuer of this badge. | |
| string | $language | 
| What language is this badge written in. | |
| string | $message | 
| The message this badge includes. | |
| array | $message_editor = [] | 
| Message editor. | |
| string null | $messageformat | 
| Message format. | |
| string | $messagesubject | 
| The subject of the message for this badge. | |
| string | $name | 
| Badge name. | |
| int | $nextcron | 
| Timestamp to next run cron for this badge. | |
| int | $notification | 
| Send a message when this badge is awarded. | |
| string null | $statstring | 
| The name of badge status. | |
| int | $status = 0 | 
| Lifecycle status for this badge. | |
| integer | $timecreated | 
| Timestamp this badge was created. | |
| integer | $timemodified | 
| Timestamp this badge was modified. | |
| integer | $type | 
| Site or course badge. | |
| string null | $uniquehash | 
| Unique hash. | |
| int | $usercreated | 
| The user who created this badge. | |
| int | $usermodified | 
| The user who modified this badge. | |
| int | $version | 
| What backpack api version to use for this badge. | |
Class that represents badge.
| core_badges\badge::__construct | ( | $badgeid | ) | 
Constructs with badge details.
| int | $badgeid | badge ID. | 
| core_badges\badge::add_related_badges | ( | $relatedids | ) | 
Add multiple related badges.
| array | $relatedids | Id of badges. | 
| core_badges\badge::calculate_expiry | ( | $timestamp | ) | 
Calculates badge expiry date based on either expirydate or expiryperiod.
| int | $timestamp | Time of badge issue | 
| int | A timestamp | 
| core_badges\badge::can_expire | ( | ) | 
Checks if badge has expiry period or date set up.
| boolean | A status indicating badge can expire | 
| core_badges\badge::delete | ( | $archive = true | ) | 
Fully deletes the badge or marks it as archived.
| boolean | $archive | Achive a badge without actual deleting of any data. | 
| core_badges\badge::delete_alignment | ( | $alignmentid | ) | 
Delete a alignment of badge.
| int | $alignmentid | ID alignment. | 
| boolean | A status for delete a alignment. | 
| core_badges\badge::delete_related_badge | ( | $relatedid | ) | 
Delete an related badge.
| int | $relatedid | Id related badge. | 
| boolean | A status for delete an related badge. | 
| core_badges\badge::get_accepted_criteria | ( | ) | 
Return array of accepted criteria types for this badge.
| array | 
| core_badges\badge::get_aggregation_method | ( | $criteriatype = 0 | ) | 
Get aggregation method for badge criteria.
| int | $criteriatype | If none supplied, get overall aggregation method (optional) | 
| int | One of BADGE_CRITERIA_AGGREGATION_ALL or BADGE_CRITERIA_AGGREGATION_ANY | 
| 
 | static | 
Return array of aggregation methods.
| array | 
| core_badges\badge::get_alignments | ( | ) | 
Get alignments of badge.
| array | List content alignments. | 
| core_badges\badge::get_awards | ( | ) | 
Gets list of users who have earned an instance of this badge.
| array | An array of objects with information about badge awards. | 
| core_badges\badge::get_badge_issuer | ( | ?int | $obversion = null | ) | 
Define issuer information by format Open Badges specification version 2.
| int | $obversion | OB version to use. | 
| array | Issuer informations of the badge. | 
| core_badges\badge::get_badge_tags | ( | ) | 
Get tags of badge.
| array | Badge tags. | 
| core_badges\badge::get_context | ( | ) | 
Use to get context instance of a badge.
| context|void | instance. | 
| core_badges\badge::get_criteria | ( | ) | 
Returns badge award criteria.
| array | An array of badge criteria | 
| core_badges\badge::get_criteria_completions | ( | $userid | ) | 
Gets an array of completed criteria from 'badge_criteria_met' table.
| int | $userid | Completions for a user | 
| array | Records of criteria completions | 
| core_badges\badge::get_endorsement | ( | ) | 
Get endorsement of badge.
| array|stdClass | Endorsement information. | 
| core_badges\badge::get_related_badges | ( | $activeonly = false | ) | 
Get related badges of badge.
| boolean | $activeonly | Do not get the inactive badges when is true. | 
| array | Related badges information. | 
| core_badges\badge::get_status_name | ( | ) | 
Use to get the name of badge status.
| string | 
| core_badges\badge::has_awards | ( | ) | 
Checks if badge has been awarded to users.
Used in badge editing.
| boolean | A status indicating badge has been awarded at least once | 
| core_badges\badge::has_criteria | ( | ) | 
Checks if badges has award criteria set up.
| boolean | A status indicating badge has at least one criterion | 
| core_badges\badge::has_manual_award_criteria | ( | ) | 
Checks if badge has manual award criteria set.
| boolean | A status indicating badge can be awarded manually | 
| core_badges\badge::has_related | ( | ) | 
Checks if badge has related badges.
| boolean | A status related badge. | 
| core_badges\badge::is_active | ( | ) | 
Checks if badges is active.
Used in badge award.
| boolean | A status indicating badge is active | 
| core_badges\badge::is_issued | ( | $userid | ) | 
Indicates whether badge has already been issued to a user.
| int | $userid | User to check | 
| boolean | 
| core_badges\badge::is_locked | ( | ) | 
Checks if badges is locked.
Used in badge award and editing.
| boolean | A status indicating badge is locked | 
| core_badges\badge::issue | ( | $userid, | |
| $nobake = false ) | 
Issue a badge to user.
| int | $userid | User who earned the badge | 
| boolean | $nobake | Not baking actual badges (for testing purposes) | 
| core_badges\badge::make_clone | ( | ) | 
Creates and saves a clone of badge with all its properties.
Clone is not active by default and has 'Copy of' attached to its name.
| int | ID of new badge. | 
| core_badges\badge::markdown_badge_criteria | ( | ) | 
Markdown language support for criteria.
| string\$output | Markdown content to output. | 
| core_badges\badge::review_all_criteria | ( | ) | 
Reviews all badge criteria and checks if badge can be instantly awarded.
| int | Number of awards | 
| core_badges\badge::save | ( | ) | 
Save/update badge information in 'badge' table only.
Cannot be used for updating awards and criteria settings.
| boolean | Returns true on success. | 
| core_badges\badge::save_alignment | ( | $alignment, | |
| $alignmentid = 0 ) | 
Insert/update alignment information of badge.
| stdClass | $alignment | Data of a alignment. | 
| int | $alignmentid | ID alignment. | 
| bool|int | A status/ID when insert or update data. | 
| core_badges\badge::save_endorsement | ( | $endorsement | ) | 
Insert/update Endorsement information of badge.
| stdClass | $endorsement | Data of an endorsement. | 
| bool|int | A status/ID when insert or update data. | 
| core_badges\badge::set_status | ( | $status = 0 | ) | 
Use to set badge status.
Only active badges can be earned/awarded/issued.
| int | $status | Status from BADGE_STATUS constants | 
| int null core_badges\badge::$awards | 
Total users which have the award.
Called from badges_get_badges()
| int null core_badges\badge::$dateissued | 
The date the badges were issued.
Called from badges_get_badges()
| array core_badges\badge::$message_editor = [] | 
Message editor.
Called from file_prepare_standard_editor()
| string null core_badges\badge::$messageformat | 
Message format.
Called from file_prepare_standard_editor()
| string null core_badges\badge::$statstring | 
The name of badge status.
Called from badges_get_badges()
| string null core_badges\badge::$uniquehash | 
Unique hash.
Called from badges_get_badges()