Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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