[ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
Contains classes, functions and constants used in badges.
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: | 1267 lines (44 kb) |
Included or required: | 0 times |
Referenced: | 3 times |
Includes or requires: | 2 files badges/lib/bakerlib.php badges/lib/backpacklib.php |
badge:: (39 methods):
__construct()
get_context()
get_aggregation_methods()
get_accepted_criteria()
save()
make_clone()
is_active()
get_status_name()
set_status()
is_locked()
has_awards()
get_awards()
is_issued()
issue()
review_all_criteria()
get_criteria_completions()
has_criteria()
get_criteria()
get_aggregation_method()
can_expire()
calculate_expiry()
has_manual_award_criteria()
delete()
badges_notify_badge_award()
badges_calculate_message_schedule()
badge_message_from_template()
badges_get_badges()
badges_get_user_badges()
badges_add_course_navigation()
badges_award_handle_manual_criteria_review()
badges_process_badge_image()
print_badge_image()
badges_bake()
get_backpack_settings()
badges_download()
badges_check_backpack_accessibility()
badges_user_has_backpack()
badges_handle_course_deletion()
badges_setup_backpack_js()
__construct($badgeid) X-Ref |
Constructs with badge details. param: int $badgeid badge ID. |
get_context() X-Ref |
Use to get context instance of a badge. return: context instance. |
get_aggregation_methods() X-Ref |
Return array of aggregation methods return: array |
get_accepted_criteria() X-Ref |
Return array of accepted criteria types for this badge return: array |
save() X-Ref |
Save/update badge information in 'badge' table only. Cannot be used for updating awards and criteria settings. return: bool Returns true on success. |
make_clone() X-Ref |
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. return: int ID of new badge. |
is_active() X-Ref |
Checks if badges is active. Used in badge award. return: bool A status indicating badge is active |
get_status_name() X-Ref |
Use to get the name of badge status. |
set_status($status = 0) X-Ref |
Use to set badge status. Only active badges can be earned/awarded/issued. param: int $status Status from BADGE_STATUS constants |
is_locked() X-Ref |
Checks if badges is locked. Used in badge award and editing. return: bool A status indicating badge is locked |
has_awards() X-Ref |
Checks if badge has been awarded to users. Used in badge editing. return: bool A status indicating badge has been awarded at least once |
get_awards() X-Ref |
Gets list of users who have earned an instance of this badge. return: array An array of objects with information about badge awards. |
is_issued($userid) X-Ref |
Indicates whether badge has already been issued to a user. |
issue($userid, $nobake = false) X-Ref |
Issue a badge to user. param: int $userid User who earned the badge param: bool $nobake Not baking actual badges (for testing purposes) |
review_all_criteria() X-Ref |
Reviews all badge criteria and checks if badge can be instantly awarded. return: int Number of awards |
get_criteria_completions($userid) X-Ref |
Gets an array of completed criteria from 'badge_criteria_met' table. param: int $userid Completions for a user return: array Records of criteria completions |
has_criteria() X-Ref |
Checks if badges has award criteria set up. return: bool A status indicating badge has at least one criterion |
get_criteria() X-Ref |
Returns badge award criteria return: array An array of badge criteria |
get_aggregation_method($criteriatype = 0) X-Ref |
Get aggregation method for badge criteria param: int $criteriatype If none supplied, get overall aggregation method (optional) return: int One of BADGE_CRITERIA_AGGREGATION_ALL or BADGE_CRITERIA_AGGREGATION_ANY |
can_expire() X-Ref |
Checks if badge has expiry period or date set up. return: bool A status indicating badge can expire |
calculate_expiry($timestamp) X-Ref |
Calculates badge expiry date based on either expirydate or expiryperiod. param: int $timestamp Time of badge issue return: int A timestamp |
has_manual_award_criteria() X-Ref |
Checks if badge has manual award criteria set. return: bool A status indicating badge can be awarded manually |
delete($archive = true) X-Ref |
Fully deletes the badge or marks it as archived. param: $archive bool Achive a badge without actual deleting of any data. |
badges_notify_badge_award(badge $badge, $userid, $issued, $filepathhash) X-Ref |
Sends notifications to users about awarded badges. param: badge $badge Badge that was issued param: int $userid Recipient ID param: string $issued Unique hash of an issued badge param: string $filepathhash File path hash of an issued badge for attachments |
badges_calculate_message_schedule($schedule) X-Ref |
Caclulates date for the next message digest to badge creators. param: in $schedule Type of message schedule BADGE_MESSAGE_DAILY|BADGE_MESSAGE_WEEKLY|BADGE_MESSAGE_MONTHLY. return: int Timestamp for next cron |
badge_message_from_template($message, $params) X-Ref |
Replaces variables in a message template and returns text ready to be emailed to a user. param: string $message Message body. return: string Message with replaced values |
badges_get_badges($type, $courseid = 0, $sort = '', $dir = '', $page = 0, $perpage = BADGE_PERPAGE, $user = 0) X-Ref |
Get all badges. param: int Type of badges to return param: int Course ID for course badges param: string $sort An SQL field to sort by param: string $dir The sort direction ASC|DESC param: int $page The page or records to return param: int $perpage The number of records to return per page param: int $user User specific search return: array $badge Array of records matching criteria |
badges_get_user_badges($userid, $courseid = 0, $page = 0, $perpage = 0, $search = '', $onlypublic = false) X-Ref |
Get badges for a specific user. param: int $userid User ID param: int $courseid Badges earned by a user in a specific course param: int $page The page or records to return param: int $perpage The number of records to return per page param: string $search A simple string to search for param: bool $onlypublic Return only public badges return: array of badges ordered by decreasing date of issue |
badges_add_course_navigation(navigation_node $coursenode, stdClass $course) X-Ref |
Extends the course administration navigation with the Badges page param: navigation_node $coursenode param: object $course |
badges_award_handle_manual_criteria_review(stdClass $data) X-Ref |
Triggered when badge is manually awarded. param: object $data return: boolean |
badges_process_badge_image(badge $badge, $iconfile) X-Ref |
Process badge image from form data param: badge $badge Badge object param: string $iconfile Original file |
print_badge_image(badge $badge, stdClass $context, $size = 'small') X-Ref |
Print badge image. param: badge $badge Badge object param: stdClass $context param: string $size |
badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) X-Ref |
Bake issued badge. param: string $hash Unique hash of an issued badge. param: int $badgeid ID of the original badge. param: int $userid ID of badge recipient (optional). param: boolean $pathhash Return file pathhash instead of image url (optional). return: string|url Returns either new file path hash or new file URL |
get_backpack_settings($userid, $refresh = false) X-Ref |
Returns external backpack settings and badges from this backpack. This function first checks if badges for the user are cached and tries to retrieve them from the cache. Otherwise, badges are obtained through curl request to the backpack. param: int $userid Backpack user ID. param: boolean $refresh Refresh badges collection in cache. return: null|object Returns null is there is no backpack or object with backpack settings. |
badges_download($userid) X-Ref |
Download all user badges in zip archive. param: int $userid ID of badge owner. |
badges_check_backpack_accessibility() X-Ref |
Checks if badges can be pushed to external backpack. return: string Code of backpack accessibility status. |
badges_user_has_backpack($userid) X-Ref |
Checks if user has external backpack connected. param: int $userid ID of a user. return: bool True|False whether backpack connection exists. |
badges_handle_course_deletion($courseid) X-Ref |
Handles what happens to the course badges when a course is deleted. param: int $courseid course ID. return: void. |
badges_setup_backpack_js() X-Ref |
Loads JS files required for backpack support. return: void |
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |