Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

Badge award criteria

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: 518 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

award_criteria:: (11 methods):
  __construct()
  build()
  get_title()
  config_options()
  config_form_criteria()
  mark_complete()
  get_params()
  delete()
  save()
  make_clone()
  is_enabled()


Class: award_criteria  - X-Ref

Award criteria abstract definition

__construct($params)   X-Ref
The base constructor

param: array $params

build($params)   X-Ref
Factory method for creating criteria class object

param: array $params associative arrays varname => value
return: award_criteria

get_title()   X-Ref
Return criteria title

return: string

config_options(&$mform, $param)   X-Ref
Add appropriate parameter elements to the criteria form


config_form_criteria($data)   X-Ref
Add appropriate criteria elements

param: stdClass $data details of various criteria

mark_complete($userid)   X-Ref
Mark this criteria as complete for a user

param: int $userid User whose criteria is completed.

get_params($cid)   X-Ref
Return criteria parameters

param: int $critid Criterion ID
return: array

delete()   X-Ref
Delete this criterion


save($params = array()   X-Ref
Saves intial criteria records with required parameters set up.

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

make_clone($newbadgeid)   X-Ref
Saves intial criteria records with required parameters set up.


is_enabled()   X-Ref
Allow some specific criteria types to be disabled based on config.

return: boolean