Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

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: 500 lines (19 kb)
Included or required:0 times
Referenced: 1 time
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