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 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(no description)

File Size: 194 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: activity_custom_completion  - X-Ref

Base class for defining an activity module's custom completion rules.

Class for defining an activity module's custom completion rules and fetching the completion statuses
of the custom completion rules for a given module instance and a user.

__construct(cm_info $cm, int $userid)   X-Ref
activity_custom_completion constructor.

param: cm_info $cm
param: int $userid

validate_rule(string $rule)   X-Ref
Validates that the custom rule is defined by this plugin and is enabled for this activity instance.

param: string $rule The custom completion rule.

is_defined(string $rule)   X-Ref
Whether this module defines this custom rule.

param: string $rule The custom completion rule.
return: bool

is_available(string $rule)   X-Ref
Checks whether the custom completion rule is being used by the activity module instance.

param: string $rule The custom completion rule.
return: bool

get_available_custom_rules()   X-Ref
Fetches the list of custom completion rules that are being used by this activity module instance.

return: array

get_overall_completion_state()   X-Ref
Fetches the overall completion status of this activity instance for a user based on its available custom completion rules.

return: int The completion state (e.g. COMPLETION_COMPLETE, COMPLETION_INCOMPLETE).

get_custom_rule_description(string $rule)   X-Ref
Fetches the description for a given custom completion rule.

param: string $rule The custom completion rule.
return: string

manual_completion_always_shown()   X-Ref
Show the manual completion or not regardless of the course's showcompletionconditions setting.
Returns false by default for plugins that don't need to override the course's showcompletionconditions setting.
Activity plugins that need to always show manual completion need to override this function.

return: bool

get_cm_completion_class(string $modname)   X-Ref
Fetches the module's custom completion class implementation if it's available.

param: string $modname The activity module name. Usually from cm_info::modname.
return: string|null