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 311 and 402]

(no description)

File Size: 199 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, ?array $completionstate = null)   X-Ref
activity_custom_completion constructor.

param: cm_info $cm
param: int $userid
param: array|null $completionstate The current state of the core completion criteria

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