Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

This file contains the badge earned badge award criteria type class

Copyright: 2019 Damyon Wiese
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 288 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

award_criteria_competency:: (7 methods):
  get_details()
  get_options()
  save()
  review()
  get_completed_criteria_sql()
  is_enabled()
  has_records_for_competencies()


Class: award_criteria_competency  - X-Ref

Badge award criteria -- award on competency completion

get_details($short = '')   X-Ref
Get criteria details for displaying to users

param: string $short Print short version of criteria
return: string

get_options(&$mform)   X-Ref
Add appropriate new criteria options to the form

param: object $mform moodle form
return: array First item is a boolean to indicate an error and the second is the error message.

save($params = array()   X-Ref
Save criteria records

param: array $params Values from the form or any other array.

review($userid, $filtered = false)   X-Ref
Review this criteria and decide if it has been completed

param: int $userid User whose criteria completion needs to be reviewed.
param: bool $filtered An additional parameter indicating that user list
return: bool Whether criteria is complete.

get_completed_criteria_sql()   X-Ref
Returns array with sql code and parameters returning all ids
of users who meet this particular criterion.

return: array list($join, $where, $params)

is_enabled()   X-Ref
Hide this criteria when competencies are disabled.

return: boolean

has_records_for_competencies($competencyids)   X-Ref
Check if any badge has records for competencies.

param: array $competencyids Array of competencies ids.
return: boolean Return true if competencies were found in any badge.